APRONXX
0.9.12
|
Level 0 linear expression (ap_linexpr0_t wrapper). More...
#include <apxx_linexpr0.hh>
Inherits apron::use_malloc.
Classes | |
class | const_iterator |
Iterator to traverse a constant linexpr0. More... | |
class | iterator |
Iterator to traverse and mutate a linear expression. More... | |
Public Member Functions | |
Constructors | |
linexpr0 (ap_linexpr_discr_t discr=AP_LINEXPR_SPARSE, size_t size=0) | |
Creates a new expression. More... | |
linexpr0 (const linexpr0 &x) | |
Makes a (deep) copy. More... | |
linexpr0 (const linexpr0 &x, const dimchange &d) | |
Makes a (deep) copy, and adds some dimensions (shifting coefficients if needed). More... | |
linexpr0 (const linexpr0 &x, const dimperm &d) | |
Makes a (deep) copy, and applies a permutation on coefficients. More... | |
linexpr0 (size_t size, const coeff coeffs[], const coeff &cst, ap_linexpr_discr_t discr=AP_LINEXPR_SPARSE) | |
Makes a new linear expression with the given size and coefficients (copied). More... | |
linexpr0 (const std::vector< coeff > &coeffs, const coeff &cst, ap_linexpr_discr_t discr=AP_LINEXPR_SPARSE) | |
Makes a new linear expression with the given coefficients (copied). More... | |
linexpr0 (size_t size, const coeff coeffs[], const ap_dim_t dims[], const coeff &cst) | |
Makes a new linear expression with the given size and coefficients (copied). More... | |
Destructor | |
~linexpr0 () | |
Frees all space for the expression and coefficients. More... | |
Assignment | |
linexpr0 & | operator= (const linexpr0 &x) |
Makes a (deep) copy. More... | |
Dimension operations | |
void | resize (size_t size) |
Changes the number of coefficients in the expression. (Useful only for dense expressions.) More... | |
void | add_dimensions (const dimchange &d) |
Adds some dimensions, shifting coefficients if needed. More... | |
void | permute_dimensions (const dimperm &d) |
Applies a permutation on coefficients. More... | |
Accesses, size | |
size_t | size () const |
Returns the number of coefficients in the expression. More... | |
ap_linexpr_discr_t | get_discr () const |
Returns the expression type. More... | |
coeff & | get_cst () |
Returns a (modifiable) reference to the constant coefficient. More... | |
const coeff & | get_cst () const |
Returns a reference to the constant coefficient. More... | |
coeff & | operator[] (ap_dim_t dim) |
Returns a (modifiable) reference to the coefficient corresponding to the given dimension. More... | |
const coeff & | operator[] (ap_dim_t dim) const |
Returns a reference to the coefficient corresponding to the given dimension. More... | |
Iterator | |
iterator | begin () |
Returns a new iterator to traverse and mutate the linear expression. More... | |
const_iterator | begin () const |
Returns a new constant iterator to traverse the linear expression. More... | |
Operators | |
void | minimize () |
Minimizes all coefficients. More... | |
long | hash () const |
Returns a hash-code. More... | |
C API compatibility | |
const ap_linexpr0_t * | get_ap_linexpr0_t () const |
Returns a pointer to the internal APRON object stored in *this. More... | |
ap_linexpr0_t * | get_ap_linexpr0_t () |
Returns a pointer to the internal APRON object stored in *this. More... | |
![]() | |
void * | operator new (size_t sz) |
void * | operator new[] (size_t sz) |
void | operator delete (void *p) |
void | operator delete[] (void *p) |
Protected Member Functions | |
linexpr0 (ap_linexpr0_t *p) | |
Internal use only. Shallow copy of structure followed by a free to take ownership of expression. More... | |
Protected Attributes | |
ap_linexpr0_t | l |
Structure managed by APRON. More... | |
Printing | |
std::ostream & | operator<< (std::ostream &os, const linexpr0 &s) |
Printing. More... | |
void | print (char **name_of_dim=NULL, FILE *stream=stdout) const |
Prints to a C stream. More... | |
Tests | |
int | compare (const linexpr0 &x, const linexpr0 &y) |
Lexicography ordering, terminating with constant coefficients. More... | |
bool | equal (const linexpr0 &x, const linexpr0 &y) |
Structural, syntactical equality. More... | |
bool | is_integer (size_t intdim) const |
Whether only dimensions greater than intdim have a non-zero coefficient. More... | |
bool | is_real (size_t intdim) const |
Whether only dimensions strictly smaller than intdim have a non-zero coefficient. More... | |
ap_linexpr_type_t | get_type () const |
Gets the type of the linear expression. More... | |
bool | is_linear () const |
Whether all coefficients are scalar. More... | |
bool | is_quasilinear () const |
Whether all coefficients are scalar, except maybe the constant one. More... | |
Level 0 linear expression (ap_linexpr0_t wrapper).
A linexpr0 object represents a linear expression with scalar or interval coefficients (coeff). They have a constant coefficient, plus a coefficient for each represented dimension. An expression can be either sparse (AP_LINEXPR_SPARSE
) or dense (AP_LINEXPR_DENSE
). Dense expressions use an array of coefficients to represent dimensions from 0 up to the expression size. Sparse expressions can have 'holes' between coefficients and grow automatically when a coefficient for a non-existing dimension is accessed.
|
inlineprotected |
Internal use only. Shallow copy of structure followed by a free to take ownership of expression.
|
inline |
Creates a new expression.
discr
whether the expression is sparse (AP_LINEXPR_SPARSE
) or dense (AP_LINEXPR_DENSE
). size
is the initial number of dimensions.
|
inline |
Makes a (deep) copy.
Makes a (deep) copy, and adds some dimensions (shifting coefficients if needed).
Makes a (deep) copy, and applies a permutation on coefficients.
|
inline |
Makes a new linear expression with the given size and coefficients (copied).
discr
whether the expression is sparse (AP_LINEXPR_SPARSE
) or dense (AP_LINEXPR_DENSE
). coeffs
has size size, coeffs[i] corresponds to the coefficient for dimension i. cst
corresponds to the constant coefficient.
|
inline |
Makes a new linear expression with the given coefficients (copied).
discr
whether the expression is sparse (AP_LINEXPR_SPARSE
) or dense (AP_LINEXPR_DENSE
). coeffs
vector of coefficients, coeffs[i] corresponds to the coefficient for dimension i. cst
corresponds to the constant coefficient.
|
inline |
Makes a new linear expression with the given size and coefficients (copied).
The expression is always sparse.
coeffs
has size size, coeffs[i] corresponds to the coefficient for dimension dims[i]; dims
is a list of size dimensions (sorted in increasing order) cst
corresponds to the constant coefficient.
|
inline |
Frees all space for the expression and coefficients.
|
inline |
Adds some dimensions, shifting coefficients if needed.
|
inline |
Returns a new iterator to traverse and mutate the linear expression.
|
inline |
Returns a new constant iterator to traverse the linear expression.
|
inline |
Returns a pointer to the internal APRON object stored in *this.
|
inline |
Returns a pointer to the internal APRON object stored in *this.
|
inline |
Returns a (modifiable) reference to the constant coefficient.
|
inline |
Returns a reference to the constant coefficient.
|
inline |
Returns the expression type.
AP_LINEXPR_SPARSE
or AP_LINEXPR_DENSE
.
|
inline |
Gets the type of the linear expression.
AP_LINEXPR_INTLINEAR
(coefficients are interval), AP_LINEXPR_QUASILINEAR
(coefficients are scalar except the constant one), or AP_LINEXPR_LINEAR
(all coefficients are scalar).
|
inline |
Returns a hash-code.
|
inline |
Whether only dimensions greater than intdim
have a non-zero coefficient.
|
inline |
Whether all coefficients are scalar.
|
inline |
Whether all coefficients are scalar, except maybe the constant one.
|
inline |
Whether only dimensions strictly smaller than intdim
have a non-zero coefficient.
|
inline |
Minimizes all coefficients.
In sparse expressions, also remove zero and unused (hole) coefficients to save space.
|
inline |
Returns a (modifiable) reference to the coefficient corresponding to the given dimension.
Always succeeds if the expression is sparse: if the dimension has no coefficient yet, it is created and returned (linear time in the worst case).
std::out_of_range | if the expression is dense and the dimension exceeds the size of the expression. |
|
inline |
Returns a reference to the coefficient corresponding to the given dimension.
|
inline |
Applies a permutation on coefficients.
|
inline |
Prints to a C stream.
|
inline |
Changes the number of coefficients in the expression. (Useful only for dense expressions.)
|
inline |
Returns the number of coefficients in the expression.
Lexicography ordering, terminating with constant coefficients.
|
friend |
Printing.
Variable naming can be configured through the varname stream modifier.
|
protected |
Structure managed by APRON.