#include "base/c_allocator.h"
#include "base/intutils.h"
#include "dbm/dbm.h"
Go to the source code of this file.
Typedefs | |
typedef const int32_t * | mingraph_t |
Style typedef: to make the difference clear between just allocated memory and the minimal graph representation. | |
Enumerations | |
enum | representationOfMinDBM_t { dbm_MINDBM_TRIVIAL = 0, dbm_MINDBM_COPY32, dbm_MINDBM_BITMATRIX32, dbm_MINDBM_TUPLES32, dbm_MINDBM_COPY16, dbm_MINDBM_BITMATRIX16, dbm_MINDBM_TUPLES16, dbm_MINDBM_ERROR } |
Simple type to allow for statistics on the different internal formats used. More... | |
Functions | |
int32_t * | dbm_writeToMinDBMWithOffset (const raw_t *dbm, cindex_t dim, BOOL minimizeGraph, BOOL tryConstraints16, allocator_t c_alloc, size_t offset) |
Save a DBM in minimal representation. | |
int32_t * | dbm_writeAnalyzedDBM (const raw_t *dbm, cindex_t dim, uint32_t *bitMatrix, size_t nbConstraints, BOOL tryConstraints16, allocator_t c_alloc, size_t offset) |
Save a pre-analyzed DBM in minimal representation. | |
size_t | dbm_analyzeForMinDBM (const raw_t *dbm, cindex_t dim, uint32_t *bitMatrix) |
Analyze a DBM for its minimal graph representation. | |
size_t | dbm_cleanBitMatrix (const raw_t *dbm, cindex_t dim, uint32_t *bitMatrix, size_t nbConstraints) |
This is a post-processing function for dbm_analyzeForMinDBM to remove constraints of the form x>=0 that are part of the minimal graph but that do not give much information. | |
size_t | dbm_getBitMatrixFromMinDBM (uint32_t *bitMatrix, mingraph_t ming, BOOL isUnpacked, raw_t *buffer) |
Get back the minimal graph from the internal representation. | |
void | dbm_bitMatrix2indices (const uint32_t *bitMatrix, size_t nbConstraints, uint32_t *index, cindex_t dim) |
Convert a bit matrix marking constraints to an array of indices. | |
cindex_t | dbm_readFromMinDBM (raw_t *dbm, mingraph_t minDBM) |
Read a DBM from its minimal DBM representation. | |
cindex_t | dbm_getDimOfMinDBM (mingraph_t minDBM) |
Dimension of a DBM from its packed minimal representation. | |
size_t | dbm_getSizeOfMinDBM (mingraph_t minDBM) |
Size of the representation of the MinDBM. | |
BOOL | dbm_isEqualToMinDBM (const raw_t *dbm, cindex_t dim, mingraph_t minDBM) |
Equality test with a full DBM. | |
static BOOL | dbm_areMinDBMVerbatimEqual (mingraph_t mg1, mingraph_t mg2) |
Equality test between 2 minimal graphs (saved with the same function and flags). | |
BOOL | dbm_isAnalyzedDBMEqualToMinDBM (const raw_t *dbm, cindex_t dim, uint32_t *bitMatrix, size_t *nbConstraints, mingraph_t minDBM) |
Equality test with a full DBM. | |
BOOL | dbm_isUnpackedEqualToMinDBM (const raw_t *dbm, cindex_t dim, mingraph_t minDBM, raw_t *buffer) |
Another variant for equality checking: this one may unpack the minimal graph if needed. | |
relation_t | dbm_relationWithMinDBM (const raw_t *dbm, cindex_t dim, mingraph_t minDBM, raw_t *unpackBuffer) |
Relation between a full DBM and a minimal representation DBM. | |
relation_t | dbm_approxRelationWithMinDBM (const raw_t *dbm, cindex_t dim, mingraph_t minDBM, raw_t *unpackBuffer) |
Variant of the previous relation function. | |
void | dbm_convexUnionWithMinDBM (raw_t *dbm, cindex_t dim, mingraph_t minDBM, raw_t *unpackBuffer) |
Convex union. | |
representationOfMinDBM_t | dbm_getRepresentationType (mingraph_t minDBM) |
The minimal graph is represented internally by the cheapest format possible, and in some cases it may even not be reduced. In addition to this, the size of the minimal graph depends on the actual input DBM, which makes the size of the allocated memory unpredictable from the caller point of view.
int32_t* function(uint32_t size, void *data)
int
to allocate, and it returns a pointer to a int32_t
[size]Possible wrappers are:
int32_t *alloc(uint32_t size, void *data) { return ((Alloc*)data)->alloc(size); }
int32_t *alloc(uint32_t size, void *) { return (int32_t*) malloc(size*sizeof(int32_t)); }
int32_t *alloc(uint32_t size, void *) { return new int32_t[size]; }
The allocator function and the custom data are packed together inside the allocator_t type.
|
Style typedef: to make the difference clear between just allocated memory and the minimal graph representation.
|
|
|
Analyze a DBM for its minimal graph representation.
Computes the smallest number of constraints needed to represent the same zone as the full DBM in dbm. The result in returned in bitMatrix: If the bit
|
|
Variant of the previous relation function. This may be cheaper if what count is to know (subset or equal) or different or superset. if unpackBuffer != NULL then dbm_EQUAL or dbm_SUBSET is returned if dbm == minDBM dbm_SUBSET is returned if dbm < minDBM dbm_SUPERSET is returned if dbm > minDBM dbm_DIFFERENT is returned if dbm not comparable with minDBM else dbm_SUBSET is returned if dbm <= minDBM dbm_DIFFERENT is returned otherwise
|
|
Equality test between 2 minimal graphs (saved with the same function and flags).
|
|
Convert a bit matrix marking constraints to an array of indices. Encoding: i[k] = (index[k] & 0xffff) and j[k] = (index[k] >> 16)
|
|
This is a post-processing function for dbm_analyzeForMinDBM to remove constraints of the form x>=0 that are part of the minimal graph but that do not give much information.
|
|
Convex union. This may cost dim^3 in time since the minimal DBM has to be unpacked to a full DBM. Computes dbm = dbm + minDBM
|
|
Get back the minimal graph from the internal representation. It might be the case that the minimal graph is recomputed if the DBM was copied.
|
|
Dimension of a DBM from its packed minimal representation.
|
|
|
|
Size of the representation of the MinDBM. This is the size of the allocated memory (without offset) for the minimal representation. It is at most dim*(dim-1)+1 because in the worst case the DBM is copied without its diagonal and we need one integer to store the size.
|
|
Equality test with a full DBM. This variant of the equality test may be used if the DBM has already been analyzed or if you need to reuse the result of the analysis.
|
|
Equality test with a full DBM. Unfortunately, this may be expensive (dim^3) if the minimal graph format is used.
|
|
Another variant for equality checking: this one may unpack the minimal graph if needed. It needs a buffer as an input to do so.
|
|
Read a DBM from its minimal DBM representation.
|
|
Relation between a full DBM and a minimal representation DBM. The relation may be exact or not: if the relation is exact then dbm_EQUAL is returned if dbm == minDBM dbm_SUBSET is returned if dbm < minDBM dbm_SUPERSET is returned if dbm > minDBM dbm_DIFFERENT is returned if dbm not comparable with minDBM else dbm_SUBSET is returned if dbm <= minDBM dbm_DIFFERENT otherwise
|
|
Save a pre-analyzed DBM in minimal representation.
|
|
Save a DBM in minimal representation.
The API supports allocation of larger data structures than needed for the actual zone representation. When the offset argument is bigger than zero, offset extra integers are allocated and the zone is written with the given offset. Thus when
int32_t *memory = dbm_writeToMinDBMWithOffset(...); mingraph_t mg = &memory[offset]; NOTES:
|