|  | 
|  | Linear_Expression (Representation r=default_representation) | 
|  | Default constructor: returns a copy of Linear_Expression::zero(). 
 | 
|  | 
|  | Linear_Expression (const Linear_Expression &e) | 
|  | Ordinary copy constructor.  More... 
 | 
|  | 
|  | Linear_Expression (const Linear_Expression &e, Representation r) | 
|  | Copy constructor that takes also a Representation. 
 | 
|  | 
| template<typename LE_Adapter > | 
|  | Linear_Expression (const LE_Adapter &e, typename Enable_If< Is_Same_Or_Derived< Expression_Adapter_Base, LE_Adapter >::value, void * >::type=0) | 
|  | Copy constructor from a linear expression adapter.  More... 
 | 
|  | 
| template<typename LE_Adapter > | 
|  | Linear_Expression (const LE_Adapter &e, Representation r, typename Enable_If< Is_Same_Or_Derived< Expression_Adapter_Base, LE_Adapter >::value, void * >::type=0) | 
|  | Copy constructor from a linear expression adapter that takes a Representation. 
 | 
|  | 
| template<typename LE_Adapter > | 
|  | Linear_Expression (const LE_Adapter &e, dimension_type space_dim, typename Enable_If< Is_Same_Or_Derived< Expression_Adapter_Base, LE_Adapter >::value, void * >::type=0) | 
|  | Copy constructor from a linear expression adapter that takes a space dimension.  More... 
 | 
|  | 
| template<typename LE_Adapter > | 
|  | Linear_Expression (const LE_Adapter &e, dimension_type space_dim, Representation r, typename Enable_If< Is_Same_Or_Derived< Expression_Adapter_Base, LE_Adapter >::value, void * >::type=0) | 
|  | Copy constructor from a linear expression adapter that takes a space dimension and a Representation. 
 | 
|  | 
| Linear_Expression & | operator= (const Linear_Expression &e) | 
|  | Assignment operator. 
 | 
|  | 
|  | ~Linear_Expression () | 
|  | Destructor. 
 | 
|  | 
|  | Linear_Expression (Coefficient_traits::const_reference n, Representation r=default_representation) | 
|  | Builds the linear expression corresponding to the inhomogeneous term n.
 | 
|  | 
|  | Linear_Expression (Variable v, Representation r=default_representation) | 
|  | Builds the linear expression corresponding to the variable v.  More...
 | 
|  | 
| Representation | representation () const | 
|  | Returns the current representation of *this. 
 | 
|  | 
| void | set_representation (Representation r) | 
|  | Converts *this to the specified representation. 
 | 
|  | 
| const_iterator | begin () const | 
|  | 
| const_iterator | end () const | 
|  | 
| const_iterator | lower_bound (Variable v) const | 
|  | 
| dimension_type | space_dimension () const | 
|  | Returns the dimension of the vector space enclosing *this.
 | 
|  | 
| void | set_space_dimension (dimension_type n) | 
|  | Sets the dimension of the vector space enclosing *thiston.
 | 
|  | 
| Coefficient_traits::const_reference | coefficient (Variable v) const | 
|  | Returns the coefficient of vin*this.
 | 
|  | 
| void | set_coefficient (Variable v, Coefficient_traits::const_reference n) | 
|  | Sets the coefficient of vin*thiston.
 | 
|  | 
| Coefficient_traits::const_reference | inhomogeneous_term () const | 
|  | Returns the inhomogeneous term of *this.
 | 
|  | 
| void | set_inhomogeneous_term (Coefficient_traits::const_reference n) | 
|  | Sets the inhomogeneous term of *thiston.
 | 
|  | 
| void | linear_combine (const Linear_Expression &y, Variable v) | 
|  | 
| void | linear_combine (const Linear_Expression &y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2) | 
|  | 
| void | linear_combine_lax (const Linear_Expression &y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2) | 
|  | 
| void | swap_space_dimensions (Variable v1, Variable v2) | 
|  | Swaps the coefficients of the variables v1andv2.
 | 
|  | 
| void | remove_space_dimensions (const Variables_Set &vars) | 
|  | Removes all the specified dimensions from the expression.  More... 
 | 
|  | 
| void | shift_space_dimensions (Variable v, dimension_type n) | 
|  | 
| void | permute_space_dimensions (const std::vector< Variable > &cycle) | 
|  | Permutes the space dimensions of the expression.  More... 
 | 
|  | 
| bool | is_zero () const | 
|  | Returns trueif and only if*thisis . 
 | 
|  | 
| bool | all_homogeneous_terms_are_zero () const | 
|  | Returns trueif and only if all the homogeneous terms of*thisare . 
 | 
|  | 
| memory_size_type | total_memory_in_bytes () const | 
|  | Returns a lower bound to the total size in bytes of the memory occupied by *this.
 | 
|  | 
| memory_size_type | external_memory_in_bytes () const | 
|  | Returns the size in bytes of the memory managed by *this.
 | 
|  | 
| bool | OK () const | 
|  | Checks if all the invariants are satisfied. 
 | 
|  | 
| void | ascii_dump () const | 
|  | Writes to std::cerran ASCII representation of*this.
 | 
|  | 
| void | ascii_dump (std::ostream &s) const | 
|  | Writes to san ASCII representation of*this.
 | 
|  | 
| void | print () const | 
|  | Prints *thistostd::cerrusingoperator<<.
 | 
|  | 
| bool | ascii_load (std::istream &s) | 
|  | Loads from san ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets*thisaccordingly. Returnstrueif successful,falseotherwise.
 | 
|  | 
| void | m_swap (Linear_Expression &y) | 
|  | Swaps *thiswithy.
 | 
|  | 
|  | Linear_Expression (const Linear_Expression &e, dimension_type space_dim) | 
|  | Copy constructor with a specified space dimension. 
 | 
|  | 
|  | Linear_Expression (const Linear_Expression &e, dimension_type space_dim, Representation r) | 
|  | Copy constructor with a specified space dimension and representation. 
 | 
|  | 
| bool | is_equal_to (const Linear_Expression &x) const | 
|  | 
| void | normalize () | 
|  | 
| void | sign_normalize () | 
|  | 
| bool | all_zeroes (const Variables_Set &vars) const | 
|  | Returns trueif the coefficient of each variable invars[i] is . 
 | 
|  | 
|  | 
| (Note that these are not member functions.)  | 
| Linear_Expression | operator+ (const Linear_Expression &e1, const Linear_Expression &e2) | 
|  | Returns the linear expression e1+e2.  More...
 | 
|  | 
| Linear_Expression | operator+ (Variable v, Variable w) | 
|  | Returns the linear expression v+w.  More...
 | 
|  | 
| Linear_Expression | operator+ (Variable v, const Linear_Expression &e) | 
|  | Returns the linear expression v+e.  More...
 | 
|  | 
| Linear_Expression | operator+ (const Linear_Expression &e, Variable v) | 
|  | Returns the linear expression e+v.  More...
 | 
|  | 
| Linear_Expression | operator+ (Coefficient_traits::const_reference n, const Linear_Expression &e) | 
|  | Returns the linear expression n+e.  More...
 | 
|  | 
| Linear_Expression | operator+ (const Linear_Expression &e, Coefficient_traits::const_reference n) | 
|  | Returns the linear expression e+n.  More...
 | 
|  | 
| Linear_Expression | operator+ (const Linear_Expression &e) | 
|  | Returns the linear expression e.  More...
 | 
|  | 
| Linear_Expression | operator- (const Linear_Expression &e) | 
|  | Returns the linear expression - e.  More...
 | 
|  | 
| Linear_Expression | operator- (const Linear_Expression &e1, const Linear_Expression &e2) | 
|  | Returns the linear expression e1-e2.  More...
 | 
|  | 
| Linear_Expression | operator- (Variable v, Variable w) | 
|  | Returns the linear expression v-w.  More...
 | 
|  | 
| Linear_Expression | operator- (Variable v, const Linear_Expression &e) | 
|  | Returns the linear expression v-e.  More...
 | 
|  | 
| Linear_Expression | operator- (const Linear_Expression &e, Variable v) | 
|  | Returns the linear expression e-v.  More...
 | 
|  | 
| Linear_Expression | operator- (Coefficient_traits::const_reference n, const Linear_Expression &e) | 
|  | Returns the linear expression n-e.  More...
 | 
|  | 
| Linear_Expression | operator- (const Linear_Expression &e, Coefficient_traits::const_reference n) | 
|  | Returns the linear expression e-n.  More...
 | 
|  | 
| Linear_Expression | operator* (Coefficient_traits::const_reference n, const Linear_Expression &e) | 
|  | Returns the linear expression n*e.  More...
 | 
|  | 
| Linear_Expression | operator* (const Linear_Expression &e, Coefficient_traits::const_reference n) | 
|  | Returns the linear expression e*n.  More...
 | 
|  | 
| Linear_Expression & | operator+= (Linear_Expression &e1, const Linear_Expression &e2) | 
|  | Returns the linear expression e1+e2and assigns it toe1.  More...
 | 
|  | 
| Linear_Expression & | operator+= (Linear_Expression &e, Variable v) | 
|  | Returns the linear expression e+vand assigns it toe.  More...
 | 
|  | 
| Linear_Expression & | operator+= (Linear_Expression &e, Coefficient_traits::const_reference n) | 
|  | Returns the linear expression e+nand assigns it toe.  More...
 | 
|  | 
| Linear_Expression & | operator-= (Linear_Expression &e1, const Linear_Expression &e2) | 
|  | Returns the linear expression e1-e2and assigns it toe1.  More...
 | 
|  | 
| Linear_Expression & | operator-= (Linear_Expression &e, Variable v) | 
|  | Returns the linear expression e-vand assigns it toe.  More...
 | 
|  | 
| Linear_Expression & | operator-= (Linear_Expression &e, Coefficient_traits::const_reference n) | 
|  | Returns the linear expression e-nand assigns it toe.  More...
 | 
|  | 
| Linear_Expression & | operator*= (Linear_Expression &e, Coefficient_traits::const_reference n) | 
|  | Returns the linear expression n*eand assigns it toe.  More...
 | 
|  | 
| Linear_Expression & | operator/= (Linear_Expression &e, Coefficient_traits::const_reference n) | 
|  | Returns the linear expression n/eand assigns it toe.  More...
 | 
|  | 
| void | neg_assign (Linear_Expression &e) | 
|  | Assigns to eits own negation.  More...
 | 
|  | 
| Linear_Expression & | add_mul_assign (Linear_Expression &e, Coefficient_traits::const_reference n, Variable v) | 
|  | Returns the linear expression e+n*vand assigns it toe.  More...
 | 
|  | 
| void | add_mul_assign (Linear_Expression &e1, Coefficient_traits::const_reference factor, const Linear_Expression &e2) | 
|  | Sums e2multiplied byfactorintoe1.  More...
 | 
|  | 
| void | sub_mul_assign (Linear_Expression &e1, Coefficient_traits::const_reference factor, const Linear_Expression &e2) | 
|  | Subtracts e2multiplied byfactorfrome1.  More...
 | 
|  | 
| Linear_Expression & | sub_mul_assign (Linear_Expression &e, Coefficient_traits::const_reference n, Variable v) | 
|  | Returns the linear expression e-n*vand assigns it toe.  More...
 | 
|  | 
| std::ostream & | operator<< (std::ostream &s, const Linear_Expression &e) | 
|  | Output operator.  More... 
 | 
|  | 
| void | swap (Linear_Expression &x, Linear_Expression &y) | 
|  | Swaps xwithy.  More...
 | 
|  | 
| Linear_Expression | operator+ (const Linear_Expression &e) | 
|  | 
| Linear_Expression | operator+ (const Linear_Expression &e, Coefficient_traits::const_reference n) | 
|  | 
| Linear_Expression | operator+ (const Linear_Expression &e, const Variable v) | 
|  | 
| Linear_Expression | operator- (const Linear_Expression &e, Coefficient_traits::const_reference n) | 
|  | 
| Linear_Expression | operator- (const Variable v, const Variable w) | 
|  | 
| Linear_Expression | operator* (const Linear_Expression &e, Coefficient_traits::const_reference n) | 
|  | 
| Linear_Expression & | operator+= (Linear_Expression &e, Coefficient_traits::const_reference n) | 
|  | 
| Linear_Expression & | operator-= (Linear_Expression &e, Coefficient_traits::const_reference n) | 
|  | 
| Linear_Expression | operator+ (const Linear_Expression &e1, const Linear_Expression &e2) | 
|  | 
| Linear_Expression | operator+ (const Variable v, const Linear_Expression &e) | 
|  | 
| Linear_Expression | operator+ (Coefficient_traits::const_reference n, const Linear_Expression &e) | 
|  | 
| Linear_Expression | operator+ (const Variable v, const Variable w) | 
|  | 
| Linear_Expression | operator- (const Linear_Expression &e) | 
|  | 
| Linear_Expression | operator- (const Linear_Expression &e1, const Linear_Expression &e2) | 
|  | 
| Linear_Expression | operator- (const Variable v, const Linear_Expression &e) | 
|  | 
| Linear_Expression | operator- (const Linear_Expression &e, const Variable v) | 
|  | 
| Linear_Expression | operator- (Coefficient_traits::const_reference n, const Linear_Expression &e) | 
|  | 
| Linear_Expression | operator* (Coefficient_traits::const_reference n, const Linear_Expression &e) | 
|  | 
| Linear_Expression & | operator+= (Linear_Expression &e1, const Linear_Expression &e2) | 
|  | 
| Linear_Expression & | operator+= (Linear_Expression &e, const Variable v) | 
|  | 
| Linear_Expression & | operator-= (Linear_Expression &e1, const Linear_Expression &e2) | 
|  | 
| Linear_Expression & | operator-= (Linear_Expression &e, const Variable v) | 
|  | 
| Linear_Expression & | operator*= (Linear_Expression &e, Coefficient_traits::const_reference n) | 
|  | 
| Linear_Expression & | operator/= (Linear_Expression &e, Coefficient_traits::const_reference n) | 
|  | 
| void | neg_assign (Linear_Expression &e) | 
|  | 
| Linear_Expression & | add_mul_assign (Linear_Expression &e, Coefficient_traits::const_reference n, const Variable v) | 
|  | 
| Linear_Expression & | sub_mul_assign (Linear_Expression &e, Coefficient_traits::const_reference n, const Variable v) | 
|  | 
| std::ostream & | operator<< (std::ostream &s, const Linear_Expression &e) | 
|  | 
| void | swap (Linear_Expression &x, Linear_Expression &y) | 
|  | 
A linear expression. 
An object of the class Linear_Expression represents the linear expression 
![\[ \sum_{i=0}^{n-1} a_i x_i + b \]](form_522.png) 
 where  is the dimension of the vector space, each
 is the dimension of the vector space, each  is the integer coefficient of the
 is the integer coefficient of the  -th variable
-th variable  and
 and  is the integer for the inhomogeneous term.
 is the integer for the inhomogeneous term.
- How to build a linear expression.
Linear expressions are the basic blocks for defining both constraints (i.e., linear equalities or inequalities) and generators (i.e., lines, rays, points and closure points). A full set of functions is defined to provide a convenient interface for building complex linear expressions starting from simpler ones and from objects of the classes Variable and Coefficient: available operators include unary negation, binary addition and subtraction, as well as multiplication by a Coefficient. The space dimension of a linear expression is defined as the maximum space dimension of the arguments used to build it: in particular, the space dimension of a Variable x is defined as x.id()+1, whereas all the objects of the class Coefficient have space dimension zero.
- Example
- The following code builds the linear expression  , having space dimension , having space dimension :  Another way to build the same linear expression is:  Note that :  Another way to build the same linear expression is:  Note thate1,e2ande3have space dimension 1, 2 and 3, respectively; also, in the fourth line of code,eis created with space dimension zero and then extended to space dimension 3 in the fifth line.