APRONXX 0.9.15
apron::tcons0 Class Reference

Level 0 arbitrary constraint (ap_tcons0_t wrapper). More...

#include <apxx_tcons0.hh>

Inherits apron::use_malloc.

Public Member Functions

Constructors
 tcons0 (ap_constyp_t constyp=AP_CONS_SUPEQ)
 Creates an empty constraint.
 
 tcons0 (ap_constyp_t constyp, const texpr0::builder &t)
 Creates a new (non-modulo) constraint from an expression tree (copied).
 
 tcons0 (ap_constyp_t constyp, const texpr0::builder &t, const scalar &modulo)
 Creates a new constraint from an expression tree and a modulo scalar (both copied).
 
 tcons0 (const tcons0 &x)
 (Deep) copy of a constraint.
 
 tcons0 (const tcons0 &x, const dimchange &d, bool add=true)
 Makes a (deep) copy of a constraint, and applies a dimension change to the underlying expression.
 
 tcons0 (const tcons0 &x, const dimperm &d)
 Makes a (deep) copy of a constraint, and applies a permutation to the underlying expression.
 
 tcons0 (unsat x)
 Makes an unsatisfiable constraint (-1>=0).
 
 tcons0 (const lincons0 &x)
 Makes a constraint from a linear constraint (copying coefficients).
 
Destructor
 ~tcons0 ()
 Frees the constraint, including the embedded expression tree and optional modulo scalar.
 
Assignments
tcons0operator= (const tcons0 &x)
 (Deep) copy.
 
tcons0operator= (unsat x)
 Assigns an unsatisfiable constraint to *this (-1>=0).
 
tcons0operator= (const lincons0 &x)
 Makes *this equal to the linear constraint x (coefficients are copied), deleting the previous value of *this.
 
void set_modulo (const scalar &c)
 Sets the extra scalar modulo to c (copied).
 
void set_texpr (const texpr0::builder &c)
 Sets the underlying expression tree to c (copied).
 
Dimension operations
void add_dimensions (const dimchange &d)
 Adds dimensions to the underlying expression tree.
 
void remove_dimensions (const dimchange &d)
 Removes dimensions to the underlying expression tree.
 
void permute_dimensions (const dimperm &d)
 Applies a permutation to the underlying expression tree.
 
Accesses
ap_constyp_t & get_constyp ()
 Returns a (modifiable) reference to the constraint type.
 
const ap_constyp_t & get_constyp () const
 Returns a reference to the constraint type.
 
bool has_modulo () const
 Returns whether the constraint has a valid extra scalar (used in modulo constraints).
 
bool has_texpr () const
 Whether the constraint contains a valid expression tree.
 
scalarget_modulo ()
 Returns a (modifiable) reference to the extra scalar.
 
const scalarget_modulo () const
 Returns a reference to the extra scalar.
 
texpr0::iterator get_texpr ()
 Returns an iterator to the root of the underlying expression tree.
 
texpr0::const_iterator get_texpr () const
 Returns a const_iterator to the root of the underlying expression tree.
 
Tests
bool is_interval_cst () const
 Whether the expression is constant (i.e., has no dimension leaves).
 
bool is_interval_linear () const
 Whether the expression is linear and there is no rounding.
 
bool is_interval_polynomial () const
 Whether the expression is polynomial and there is no rounding.
 
bool is_interval_polyfrac () const
 Whether the expression is a polynomial fraction and there is no rounding.
 
bool is_scalar () const
 Whether all occurring constants are scalar.
 
C API compatibility
const ap_tcons0_t * get_ap_tcons0_t () const
 Returns a pointer to the internal APRON object stored in *this.
 
ap_tcons0_t * get_ap_tcons0_t ()
 Returns a pointer to the internal APRON object stored in *this.
 
- 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

 tcons0 (ap_tcons0_t &l)
 Internal use only. Performs a shallow copy and takes ownership of the contents.
 

Protected Attributes

ap_tcons0_t l
 Structure managed by APRON.
 

Printing

void print (char **name_of_dim=NULL, FILE *stream=stdout) const
 Prints to a C stream.
 

Detailed Description

Level 0 arbitrary constraint (ap_tcons0_t wrapper).

A tcons0 represents a constraint of the form expr==0, expr>=0, expr>0, expr!=0, or expr==0 mod c where expr is an arbitrary expression tree. It stores and manages a texpr0, a constraint type (==, >=, >, !=, mod), and (for modulo constraint) an extra scalar (c).

Constraints can be constructed using the >=, <=, >, <, ==, != operators on expression trees, or dedicated constructors:

tcons0 x = dim(1) >= dim(2) * 5;
tcons0 y = add(sqrt(dim(1),AP_RTYPE_FLOAT), dim(0), AP_RTYPE_FLOAT) != 10;
tcons0 y = tcons0(AP_CONS_EQMOD, 3*dim(0)+2*dim(1), 5);
Represents a dimension (i.e., variable by index) in an expression tree.
Definition apxx_texpr0.hh:33
tcons0(ap_tcons0_t &l)
Internal use only. Performs a shallow copy and takes ownership of the contents.
Definition apxx_tcons0.hh:24
texpr0::builder sqrt(const texpr0::builder &a, ap_texpr_rtype_t rtype=AP_RTYPE_REAL, ap_texpr_rdir_t rdir=AP_RDIR_NEAREST)
Definition apxx_texpr0.hh:842
texpr0::builder add(const texpr0::builder &a, const texpr0::builder &b, ap_texpr_rtype_t rtype=AP_RTYPE_REAL, ap_texpr_rdir_t rdir=AP_RDIR_NEAREST)
Definition apxx_texpr0.hh:772

See the documentation of the texpr0 class for more information on constructing expression trees.

Constructor & Destructor Documentation

◆ tcons0() [1/9]

tcons0::tcons0 ( ap_tcons0_t & l)
inlineprotected

Internal use only. Performs a shallow copy and takes ownership of the contents.

◆ tcons0() [2/9]

tcons0::tcons0 ( ap_constyp_t constyp = AP_CONS_SUPEQ)
inline

Creates an empty constraint.

Neither the expression tree nor the extra scalar are not created (has_texpr and has_modulo both return false).

  • constyp can be AP_CONS_EQ, AP_CONS_SUPEQ, AP_CONS_SUP, or AP_CONS_DISEQ (but not AP_CONS_EQMOD).

◆ tcons0() [3/9]

tcons0::tcons0 ( ap_constyp_t constyp,
const texpr0::builder & t )
inline

Creates a new (non-modulo) constraint from an expression tree (copied).

The extra scalar is not created (has_modulo returns false).

  • constyp can be AP_CONS_EQ, AP_CONS_SUPEQ, AP_CONS_SUP, or AP_CONS_DISEQ (but not AP_CONS_EQMOD).

◆ tcons0() [4/9]

tcons0::tcons0 ( ap_constyp_t constyp,
const texpr0::builder & t,
const scalar & modulo )
inline

Creates a new constraint from an expression tree and a modulo scalar (both copied).

  • constyp can be AP_CONS_EQ, AP_CONS_SUPEQ, AP_CONS_SUP, AP_CONS_EQMOD, or AP_CONS_DISEQ.

◆ tcons0() [5/9]

tcons0::tcons0 ( const tcons0 & x)
inline

(Deep) copy of a constraint.

◆ tcons0() [6/9]

tcons0::tcons0 ( const tcons0 & x,
const dimchange & d,
bool add = true )
inline

Makes a (deep) copy of a constraint, and applies a dimension change to the underlying expression.

  • add whether to add or remove dimensions.

◆ tcons0() [7/9]

tcons0::tcons0 ( const tcons0 & x,
const dimperm & d )
inline

Makes a (deep) copy of a constraint, and applies a permutation to the underlying expression.

◆ tcons0() [8/9]

tcons0::tcons0 ( unsat x)
inline

Makes an unsatisfiable constraint (-1>=0).

◆ tcons0() [9/9]

tcons0::tcons0 ( const lincons0 & x)
inline

Makes a constraint from a linear constraint (copying coefficients).

Real-valued addition and multiplication operators are used (i.e., no rounding).

◆ ~tcons0()

tcons0::~tcons0 ( )
inline

Frees the constraint, including the embedded expression tree and optional modulo scalar.

Member Function Documentation

◆ add_dimensions()

void tcons0::add_dimensions ( const dimchange & d)
inline

Adds dimensions to the underlying expression tree.

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ get_ap_tcons0_t() [1/2]

ap_tcons0_t * tcons0::get_ap_tcons0_t ( )
inline

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

◆ get_ap_tcons0_t() [2/2]

const ap_tcons0_t * tcons0::get_ap_tcons0_t ( ) const
inline

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

◆ get_constyp() [1/2]

ap_constyp_t & tcons0::get_constyp ( )
inline

Returns a (modifiable) reference to the constraint type.

Returns
either AP_CONS_EQ, AP_CONS_SUPEQ, AP_CONS_SUP, AP_CONS_EQMOD, or AP_CONS_DISEQ.

◆ get_constyp() [2/2]

const ap_constyp_t & tcons0::get_constyp ( ) const
inline

Returns a reference to the constraint type.

Returns
either AP_CONS_EQ, AP_CONS_SUPEQ, AP_CONS_SUP, AP_CONS_EQMOD, or AP_CONS_DISEQ.

◆ get_modulo() [1/2]

scalar & tcons0::get_modulo ( )
inline

Returns a (modifiable) reference to the extra scalar.

Exceptions
std::invalid_argumentif no valid extra scalar has been defined.

◆ get_modulo() [2/2]

const scalar & tcons0::get_modulo ( ) const
inline

Returns a reference to the extra scalar.

Exceptions
std::invalid_argumentif no valid extra scalar has been defined.

◆ get_texpr() [1/2]

texpr0::iterator tcons0::get_texpr ( )
inline

Returns an iterator to the root of the underlying expression tree.

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ get_texpr() [2/2]

texpr0::const_iterator tcons0::get_texpr ( ) const
inline

Returns a const_iterator to the root of the underlying expression tree.

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ has_modulo()

bool tcons0::has_modulo ( ) const
inline

Returns whether the constraint has a valid extra scalar (used in modulo constraints).

◆ has_texpr()

bool tcons0::has_texpr ( ) const
inline

Whether the constraint contains a valid expression tree.

◆ is_interval_cst()

bool tcons0::is_interval_cst ( ) const
inline

Whether the expression is constant (i.e., has no dimension leaves).

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ is_interval_linear()

bool tcons0::is_interval_linear ( ) const
inline

Whether the expression is linear and there is no rounding.

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ is_interval_polyfrac()

bool tcons0::is_interval_polyfrac ( ) const
inline

Whether the expression is a polynomial fraction and there is no rounding.

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ is_interval_polynomial()

bool tcons0::is_interval_polynomial ( ) const
inline

Whether the expression is polynomial and there is no rounding.

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ is_scalar()

bool tcons0::is_scalar ( ) const
inline

Whether all occurring constants are scalar.

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ operator=() [1/3]

tcons0 & tcons0::operator= ( const lincons0 & x)
inline

Makes *this equal to the linear constraint x (coefficients are copied), deleting the previous value of *this.

Real-valued addition and multiplication operators are used (i.e., no rounding).

◆ operator=() [2/3]

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

(Deep) copy.

◆ operator=() [3/3]

tcons0 & tcons0::operator= ( unsat x)
inline

Assigns an unsatisfiable constraint to *this (-1>=0).

◆ permute_dimensions()

void tcons0::permute_dimensions ( const dimperm & d)
inline

Applies a permutation to the underlying expression tree.

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ print()

void tcons0::print ( char ** name_of_dim = NULL,
FILE * stream = stdout ) const
inline

Prints to a C stream.

◆ remove_dimensions()

void tcons0::remove_dimensions ( const dimchange & d)
inline

Removes dimensions to the underlying expression tree.

Exceptions
std::invalid_argumentif no valid expression tree has been defined.

◆ set_modulo()

void tcons0::set_modulo ( const scalar & c)
inline

Sets the extra scalar modulo to c (copied).

Does not fail as get_modulo can: if the constraint was created without an extra scalar, it is created.

◆ set_texpr()

void tcons0::set_texpr ( const texpr0::builder & c)
inline

Sets the underlying expression tree to c (copied).

Does not fail as get_texpr can: if the constraint was created without an underlying expression, it is created.

Member Data Documentation

◆ l

ap_tcons0_t apron::tcons0::l
protected

Structure managed by APRON.


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