APRONXX  0.9.12
Classes | Protected Member Functions | Protected Attributes | List of all members
apron::linexpr1 Class Reference

Level 1 linear expression (ap_linexpr1_t wrapper). More...

#include <apxx_linexpr1.hh>

Inherits apron::use_malloc.

Classes

class  const_iterator
 Iterator to traverse a constant linexpr1. More...
 
class  iterator
 Iterator to traverse and mutate a linear expression. More...
 

Public Member Functions

Constructors
 linexpr1 (const environment &e, const linexpr0 &x)
 Creates a new expression from a linexpr0 (copied) and an environment (reference count incremented) associating names to dimensions in linexpr0. More...
 
 linexpr1 (const environment &e, ap_linexpr_discr_t lin_discr=AP_LINEXPR_SPARSE, size_t size=0)
 Creates a new null expression. More...
 
 linexpr1 (const linexpr1 &x)
 Makes a (deep) copy. More...
 
 linexpr1 (const linexpr1 &x, const environment &e)
 Makes a (deep) copy of x and extends its environment. More...
 
Destructor
 ~linexpr1 ()
 Frees all space for the expression and coefficients, and decrements the reference count of the environment. More...
 
Assignment
linexpr1operator= (const linexpr1 &x)
 Makes a (deep) copy. More...
 
Dimension operations
void extend_environment (const environment &e)
 Extends the environment of the expression. More...
 
Accesses, size
environment get_environment () const
 Returns the environment of the expression (with incremented reference count). More...
 
const linexpr0get_linexpr0 () const
 Returns a reference to the underlying linexpr0. More...
 
linexpr0get_linexpr0 ()
 Returns a modifiable reference to the underlying linexpr0. More...
 
size_t size () const
 Returns the number of coefficients in the expression. More...
 
ap_linexpr_discr_t get_discr () const
 Returns the type of underlying linexpr0. More...
 
coeffget_cst ()
 Returns a (modifiable) reference to the constant coefficient. More...
 
const coeffget_cst () const
 Returns a reference to the constant coefficient. More...
 
coeffoperator[] (const var &v)
 Returns a (modifiable) reference to the coefficient corresponding to the given variable name. More...
 
const coeffoperator[] (const var &v) const
 Returns a reference to the coefficient corresponding to the given variable name. More...
 
Tests
bool is_integer () const
 Whether the expression only depends on integer variables. More...
 
bool is_real () const
 Whether the expression only depends on real variables. 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...
 
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...
 
C API compatibility
const ap_linexpr1_t * get_ap_linexpr1_t () const
 Returns a pointer to the internal APRON object stored in *this. More...
 
ap_linexpr1_t * get_ap_linexpr1_t ()
 Returns a pointer to the internal APRON object stored in *this. More...
 
- Public Member Functions inherited from apron::use_malloc
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

 linexpr1 (ap_linexpr1_t &p)
 Internal use only. Shallow copy (no copy of linexpr0 or environment). More...
 

Protected Attributes

ap_linexpr1_t l
 Structure managed by APRON. More...
 

Printing

void print (FILE *stream=stdout) const
 Prints to a C stream. More...
 
std::ostream & operator<< (std::ostream &os, const linexpr1 &s)
 Printing. More...
 

Detailed Description

Level 1 linear expression (ap_linexpr1_t wrapper).

Level 1 version of linear expressions with scalar or interval coefficients (coeff). Terms are indexed using variable names (var) instead of dimensions (ap_dim_t). Internally, a linexpr1 wraps together a linexpr0 (memory managed) and an environment (holding a reference count).

Constructor & Destructor Documentation

◆ linexpr1() [1/5]

linexpr1::linexpr1 ( ap_linexpr1_t &  p)
inlineprotected

Internal use only. Shallow copy (no copy of linexpr0 or environment).

◆ linexpr1() [2/5]

linexpr1::linexpr1 ( const environment e,
const linexpr0 x 
)
inline

Creates a new expression from a linexpr0 (copied) and an environment (reference count incremented) associating names to dimensions in linexpr0.

◆ linexpr1() [3/5]

apron::linexpr1::linexpr1 ( const environment e,
ap_linexpr_discr_t  lin_discr = AP_LINEXPR_SPARSE,
size_t  size = 0 
)
inline

Creates a new null expression.

  • e associates a variable name to each dimension.
  • discr whether the expression is sparse (AP_LINEXPR_SPARSE) or dense (AP_LINEXPR_DENSE).
  • size, for AP_LINEXPR_SPARSE expressions, is the initial number of dimensions in the underlying linexpr0 (new dimensions being added as needed); ignored for AP_LINEXPR_DENSE expressions (the size being always the size of the environment).

◆ linexpr1() [4/5]

linexpr1::linexpr1 ( const linexpr1 x)
inline

Makes a (deep) copy.

◆ linexpr1() [5/5]

linexpr1::linexpr1 ( const linexpr1 x,
const environment e 
)
inline

Makes a (deep) copy of x and extends its environment.

Exceptions
std::invalid_argumentif e is not a super-environment of that of x.

◆ ~linexpr1()

linexpr1::~linexpr1 ( )
inline

Frees all space for the expression and coefficients, and decrements the reference count of the environment.

Member Function Documentation

◆ begin() [1/2]

linexpr1::iterator linexpr1::begin ( )
inline

Returns a new iterator to traverse and mutate the linear expression.

◆ begin() [2/2]

linexpr1::const_iterator linexpr1::begin ( ) const
inline

Returns a new constant iterator to traverse the linear expression.

◆ extend_environment()

void linexpr1::extend_environment ( const environment e)
inline

Extends the environment of the expression.

Exceptions
std::invalid_argumentif e is not a super-environment of that of *this.

◆ get_ap_linexpr1_t() [1/2]

const ap_linexpr1_t * linexpr1::get_ap_linexpr1_t ( ) const
inline

Returns a pointer to the internal APRON object stored in *this.

◆ get_ap_linexpr1_t() [2/2]

ap_linexpr1_t * linexpr1::get_ap_linexpr1_t ( )
inline

Returns a pointer to the internal APRON object stored in *this.

◆ get_cst() [1/2]

coeff & linexpr1::get_cst ( )
inline

Returns a (modifiable) reference to the constant coefficient.

◆ get_cst() [2/2]

const coeff & linexpr1::get_cst ( ) const
inline

Returns a reference to the constant coefficient.

◆ get_discr()

ap_linexpr_discr_t linexpr1::get_discr ( ) const
inline

Returns the type of underlying linexpr0.

Returns
Either AP_LINEXPR_SPARSE or AP_LINEXPR_DENSE.

◆ get_environment()

environment linexpr1::get_environment ( ) const
inline

Returns the environment of the expression (with incremented reference count).

◆ get_linexpr0() [1/2]

const linexpr0 & linexpr1::get_linexpr0 ( ) const
inline

Returns a reference to the underlying linexpr0.

◆ get_linexpr0() [2/2]

linexpr0 & linexpr1::get_linexpr0 ( )
inline

Returns a modifiable reference to the underlying linexpr0.

◆ get_type()

ap_linexpr_type_t linexpr1::get_type ( ) const
inline

Gets the type of the linear expression.

Returns
Either AP_LINEXPR_INTLINEAR (coefficients are interval), AP_LINEXPR_QUASILINEAR (coefficients are scalar except the constant one), or AP_LINEXPR_LINEAR (all coefficients are scalar).

◆ is_integer()

bool linexpr1::is_integer ( ) const
inline

Whether the expression only depends on integer variables.

◆ is_linear()

bool linexpr1::is_linear ( ) const
inline

Whether all coefficients are scalar.

◆ is_quasilinear()

bool linexpr1::is_quasilinear ( ) const
inline

Whether all coefficients are scalar, except maybe the constant one.

◆ is_real()

bool linexpr1::is_real ( ) const
inline

Whether the expression only depends on real variables.

◆ minimize()

void linexpr1::minimize ( )
inline

Minimizes all coefficients.

In sparse expressions, also remove zero and unused (hole) coefficients to save space.

◆ operator=()

linexpr1 & linexpr1::operator= ( const linexpr1 x)
inline

Makes a (deep) copy.

◆ operator[]() [1/2]

coeff & apron::linexpr1::operator[] ( const var v)
inline

Returns a (modifiable) reference to the coefficient corresponding to the given variable name.

Exceptions
std::invalid_argumentif the variable name is not present in the environment.

◆ operator[]() [2/2]

const coeff & apron::linexpr1::operator[] ( const var v) const
inline

Returns a reference to the coefficient corresponding to the given variable name.

Exceptions
std::invalid_argumentif the variable name is not present in the environment.

◆ print()

void linexpr1::print ( FILE *  stream = stdout) const
inline

Prints to a C stream.

◆ size()

size_t linexpr1::size ( ) const
inline

Returns the number of coefficients in the expression.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const linexpr1 s 
)
friend

Printing.

Member Data Documentation

◆ l

ap_linexpr1_t apron::linexpr1::l
protected

Structure managed by APRON.


The documentation for this class was generated from the following files: