PPL  1.2
Parma_Polyhedra_Library::Linear_Expression Class Reference

A linear expression. More...

#include <Linear_Expression_defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::Linear_Expression:
Collaboration diagram for Parma_Polyhedra_Library::Linear_Expression:

Classes

class  const_iterator
 

Public Types

typedef const Linear_Expressionconst_reference
 
typedef Linear_Expression raw_type
 

Public Member Functions

 Linear_Expression (Representation r=default_representation)
 Default constructor: returns a copy of Linear_Expression::zero(). More...
 
 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. More...
 
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. More...
 
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. More...
 
Linear_Expressionoperator= (const Linear_Expression &e)
 Assignment operator. More...
 
 ~Linear_Expression ()
 Destructor. More...
 
 Linear_Expression (Coefficient_traits::const_reference n, Representation r=default_representation)
 Builds the linear expression corresponding to the inhomogeneous term n. More...
 
 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. More...
 
void set_representation (Representation r)
 Converts *this to the specified representation. More...
 
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. More...
 
void set_space_dimension (dimension_type n)
 Sets the dimension of the vector space enclosing *this to n . More...
 
Coefficient_traits::const_reference coefficient (Variable v) const
 Returns the coefficient of v in *this. More...
 
void set_coefficient (Variable v, Coefficient_traits::const_reference n)
 Sets the coefficient of v in *this to n. More...
 
Coefficient_traits::const_reference inhomogeneous_term () const
 Returns the inhomogeneous term of *this. More...
 
void set_inhomogeneous_term (Coefficient_traits::const_reference n)
 Sets the inhomogeneous term of *this to n. More...
 
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 v1 and v2 . More...
 
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 true if and only if *this is $0$. More...
 
bool all_homogeneous_terms_are_zero () const
 Returns true if and only if all the homogeneous terms of *this are $0$. More...
 
memory_size_type total_memory_in_bytes () const
 Returns a lower bound to the total size in bytes of the memory occupied by *this. More...
 
memory_size_type external_memory_in_bytes () const
 Returns the size in bytes of the memory managed by *this. More...
 
bool OK () const
 Checks if all the invariants are satisfied. More...
 
void ascii_dump () const
 Writes to std::cerr an ASCII representation of *this. More...
 
void ascii_dump (std::ostream &s) const
 Writes to s an ASCII representation of *this. More...
 
void print () const
 Prints *this to std::cerr using operator<<. More...
 
bool ascii_load (std::istream &s)
 Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise. More...
 
void m_swap (Linear_Expression &y)
 Swaps *this with y. More...
 
 Linear_Expression (const Linear_Expression &e, dimension_type space_dim)
 Copy constructor with a specified space dimension. More...
 
 Linear_Expression (const Linear_Expression &e, dimension_type space_dim, Representation r)
 Copy constructor with a specified space dimension and representation. More...
 
bool is_equal_to (const Linear_Expression &x) const
 
void normalize ()
 
void sign_normalize ()
 
bool all_zeroes (const Variables_Set &vars) const
 Returns true if the coefficient of each variable in vars[i] is $0$. More...
 

Static Public Member Functions

static dimension_type max_space_dimension ()
 Returns the maximum space dimension a Linear_Expression can handle. More...
 
static void initialize ()
 Initializes the class. More...
 
static void finalize ()
 Finalizes the class. More...
 
static const Linear_Expressionzero ()
 Returns the (zero-dimension space) constant 0. More...
 

Static Public Attributes

static const Representation default_representation = SPARSE
 

Private Member Functions

 Linear_Expression (dimension_type space_dim, bool, Representation r=default_representation)
 Implementation sizing constructor. More...
 
Coefficient_traits::const_reference get (dimension_type i) const
 Returns the i-th coefficient. More...
 
void set (dimension_type i, Coefficient_traits::const_reference n)
 Sets the i-th coefficient to n. More...
 
Coefficient_traits::const_reference get (Variable v) const
 Returns the coefficient of v. More...
 
void set (Variable v, Coefficient_traits::const_reference n)
 Sets the coefficient of v to n. More...
 
bool all_zeroes (dimension_type start, dimension_type end) const
 Returns true if (*this)[i] is $0$, for each i in [start, end). More...
 
dimension_type num_zeroes (dimension_type start, dimension_type end) const
 Returns the number of zero coefficient in [start, end). More...
 
Coefficient gcd (dimension_type start, dimension_type end) const
 Returns the gcd of the nonzero coefficients in [start,end). If all the coefficients in this range are 0 returns 0. More...
 
void exact_div_assign (Coefficient_traits::const_reference c, dimension_type start, dimension_type end)
 
void linear_combine (const Linear_Expression &y, dimension_type i)
 
void linear_combine (const Linear_Expression &y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2, dimension_type start, dimension_type end)
 
void linear_combine_lax (const Linear_Expression &y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2, dimension_type start, dimension_type end)
 
void mul_assign (Coefficient_traits::const_reference n, dimension_type start, dimension_type end)
 Equivalent to (*this)[i] *= n, for each i in [start, end). More...
 
dimension_type last_nonzero () const
 
dimension_type last_nonzero (dimension_type first, dimension_type last) const
 
dimension_type first_nonzero (dimension_type first, dimension_type last) const
 
bool all_zeroes_except (const Variables_Set &vars, dimension_type start, dimension_type end) const
 Returns true if all coefficients in [start,end), except those corresponding to variables in vars, are zero. More...
 
void scalar_product_assign (Coefficient &result, const Linear_Expression &y) const
 Sets results to the sum of (*this)[i]*y[i], for each i. More...
 
void scalar_product_assign (Coefficient &result, const Linear_Expression &y, dimension_type start, dimension_type end) const
 Sets results to the sum of (*this)[i]*y[i], for each i in [start,end). More...
 
int scalar_product_sign (const Linear_Expression &y) const
 Computes the sign of the sum of (*this)[i]*y[i], for each i. More...
 
int scalar_product_sign (const Linear_Expression &y, dimension_type start, dimension_type end) const
 
void has_a_free_dimension_helper (std::set< dimension_type > &x) const
 Removes from the set x all the indexes of nonzero elements of *this. More...
 
bool is_equal_to (const Linear_Expression &x, dimension_type start, dimension_type end) const
 Returns true if (*this)[i] is equal to x[i], for each i in [start,end). More...
 
bool is_equal_to (const Linear_Expression &x, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2, dimension_type start, dimension_type end) const
 
void get_row (Dense_Row &r) const
 Sets r to a copy of the row that implements *this. More...
 
void get_row (Sparse_Row &r) const
 Sets r to a copy of the row that implements *this. More...
 
bool have_a_common_variable (const Linear_Expression &x, Variable first, Variable last) const
 Returns true if there is a variable from index first (included) to index last (excluded) whose coefficient is nonzero in both *this and x. More...
 
void negate (dimension_type first, dimension_type last)
 Negates the elements from index first (included) to index last (excluded). More...
 

Private Attributes

Linear_Expression_Interfaceimpl
 

Static Private Attributes

static const Linear_Expressionzero_p = 0
 Holds (between class initialization and finalization) a pointer to the (zero-dimension space) constant 0. More...
 

Friends

template<typename Row >
class Linear_Expression_Impl
 
class Grid
 
class Congruence
 
class Polyhedron
 
class PIP_Tree_Node
 
class Grid_Generator
 
class Generator
 
class Constraint
 
class Constraint_System
 
class PIP_Problem
 
class BHRZ03_Certificate
 
class Scalar_Products
 
class MIP_Problem
 
class Box_Helpers
 
class Congruence_System
 
class BD_Shape_Helpers
 
class Octagonal_Shape_Helper
 
class Termination_Helpers
 
template<typename T >
class BD_Shape
 
template<typename T >
class Octagonal_Shape
 
template<typename T >
class Linear_System
 
template<typename T >
class Box
 
template<typename T >
class Expression_Adapter
 
template<typename T >
class Expression_Hide_Inhomo
 
template<typename T >
class Expression_Hide_Last
 
Linear_Expression operator+ (const Linear_Expression &e1, const Linear_Expression &e2)
 
Linear_Expression operator+ (Coefficient_traits::const_reference n, const Linear_Expression &e)
 
Linear_Expression operator+ (const Linear_Expression &e, Coefficient_traits::const_reference n)
 
Linear_Expression operator+ (Variable v, const Linear_Expression &e)
 
Linear_Expression operator+ (Variable v, Variable w)
 
Linear_Expression operator- (const Linear_Expression &e)
 
Linear_Expression operator- (const Linear_Expression &e1, const Linear_Expression &e2)
 
Linear_Expression operator- (Variable v, Variable w)
 
Linear_Expression operator- (Coefficient_traits::const_reference n, const Linear_Expression &e)
 
Linear_Expression operator- (const Linear_Expression &e, Coefficient_traits::const_reference n)
 
Linear_Expression operator- (Variable v, const Linear_Expression &e)
 
Linear_Expression operator- (const Linear_Expression &e, Variable v)
 
Linear_Expression operator* (Coefficient_traits::const_reference n, const Linear_Expression &e)
 
Linear_Expression operator* (const Linear_Expression &e, Coefficient_traits::const_reference n)
 
Linear_Expressionoperator+= (Linear_Expression &e1, const Linear_Expression &e2)
 
Linear_Expressionoperator+= (Linear_Expression &e, Variable v)
 
Linear_Expressionoperator+= (Linear_Expression &e, Coefficient_traits::const_reference n)
 
Linear_Expressionoperator-= (Linear_Expression &e1, const Linear_Expression &e2)
 
Linear_Expressionoperator-= (Linear_Expression &e, Variable v)
 
Linear_Expressionoperator-= (Linear_Expression &e, Coefficient_traits::const_reference n)
 
Linear_Expressionoperator*= (Linear_Expression &e, Coefficient_traits::const_reference n)
 
Linear_Expressionoperator/= (Linear_Expression &e, Coefficient_traits::const_reference n)
 
void neg_assign (Linear_Expression &e)
 
Linear_Expressionadd_mul_assign (Linear_Expression &e, Coefficient_traits::const_reference n, Variable v)
 
Linear_Expressionsub_mul_assign (Linear_Expression &e, Coefficient_traits::const_reference n, Variable v)
 
void add_mul_assign (Linear_Expression &e1, Coefficient_traits::const_reference factor, const Linear_Expression &e2)
 
void sub_mul_assign (Linear_Expression &e1, Coefficient_traits::const_reference factor, const Linear_Expression &e2)
 
int compare (const Linear_Expression &x, const Linear_Expression &y)
 
std::ostream & Parma_Polyhedra_Library::IO_Operators::operator<< (std::ostream &s, const Linear_Expression &e)
 

Related Functions

(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_Expressionoperator+= (Linear_Expression &e1, const Linear_Expression &e2)
 Returns the linear expression e1 + e2 and assigns it to e1. More...
 
Linear_Expressionoperator+= (Linear_Expression &e, Variable v)
 Returns the linear expression e + v and assigns it to e. More...
 
Linear_Expressionoperator+= (Linear_Expression &e, Coefficient_traits::const_reference n)
 Returns the linear expression e + n and assigns it to e. More...
 
Linear_Expressionoperator-= (Linear_Expression &e1, const Linear_Expression &e2)
 Returns the linear expression e1 - e2 and assigns it to e1. More...
 
Linear_Expressionoperator-= (Linear_Expression &e, Variable v)
 Returns the linear expression e - v and assigns it to e. More...
 
Linear_Expressionoperator-= (Linear_Expression &e, Coefficient_traits::const_reference n)
 Returns the linear expression e - n and assigns it to e. More...
 
Linear_Expressionoperator*= (Linear_Expression &e, Coefficient_traits::const_reference n)
 Returns the linear expression n * e and assigns it to e. More...
 
Linear_Expressionoperator/= (Linear_Expression &e, Coefficient_traits::const_reference n)
 Returns the linear expression n / e and assigns it to e. More...
 
void neg_assign (Linear_Expression &e)
 Assigns to e its own negation. More...
 
Linear_Expressionadd_mul_assign (Linear_Expression &e, Coefficient_traits::const_reference n, Variable v)
 Returns the linear expression e + n * v and assigns it to e. More...
 
void add_mul_assign (Linear_Expression &e1, Coefficient_traits::const_reference factor, const Linear_Expression &e2)
 Sums e2 multiplied by factor into e1. More...
 
void sub_mul_assign (Linear_Expression &e1, Coefficient_traits::const_reference factor, const Linear_Expression &e2)
 Subtracts e2 multiplied by factor from e1. More...
 
Linear_Expressionsub_mul_assign (Linear_Expression &e, Coefficient_traits::const_reference n, Variable v)
 Returns the linear expression e - n * v and assigns it to e. More...
 
int compare (const Linear_Expression &x, const Linear_Expression &y)
 The basic comparison function. More...
 
std::ostream & operator<< (std::ostream &s, const Linear_Expression &e)
 Output operator. More...
 
void swap (Linear_Expression &x, Linear_Expression &y)
 Swaps x with y. 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_Expressionoperator+= (Linear_Expression &e, Coefficient_traits::const_reference n)
 
Linear_Expressionoperator-= (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_Expressionoperator+= (Linear_Expression &e1, const Linear_Expression &e2)
 
Linear_Expressionoperator+= (Linear_Expression &e, const Variable v)
 
Linear_Expressionoperator-= (Linear_Expression &e1, const Linear_Expression &e2)
 
Linear_Expressionoperator-= (Linear_Expression &e, const Variable v)
 
Linear_Expressionoperator*= (Linear_Expression &e, Coefficient_traits::const_reference n)
 
Linear_Expressionoperator/= (Linear_Expression &e, Coefficient_traits::const_reference n)
 
void neg_assign (Linear_Expression &e)
 
Linear_Expressionadd_mul_assign (Linear_Expression &e, Coefficient_traits::const_reference n, const Variable v)
 
Linear_Expressionsub_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)
 

Detailed Description

A linear expression.

An object of the class Linear_Expression represents the linear expression

\[ \sum_{i=0}^{n-1} a_i x_i + b \]

where $n$ is the dimension of the vector space, each $a_i$ is the integer coefficient of the $i$-th variable $x_i$ and $b$ 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 $4x - 2y - z + 14$, having space dimension $3$:
Linear_Expression e = 4*x - 2*y - z + 14;
Another way to build the same linear expression is:
e += e1 - e2 - e3;
Note that e1, e2 and e3 have space dimension 1, 2 and 3, respectively; also, in the fourth line of code, e is created with space dimension zero and then extended to space dimension 3 in the fifth line.

Definition at line 289 of file Linear_Expression_defs.hh.

Member Typedef Documentation

Constructor & Destructor Documentation

Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( Representation  r = default_representation)
explicit

Default constructor: returns a copy of Linear_Expression::zero().

Definition at line 54 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::DENSE, and Parma_Polyhedra_Library::SPARSE.

54  {
55  switch (r) {
56  case DENSE:
57  impl = new Linear_Expression_Impl<Dense_Row>();
58  break;
59  case SPARSE:
60  impl = new Linear_Expression_Impl<Sparse_Row>();
61  break;
62  default:
63  PPL_UNREACHABLE;
64  }
65 }
Dense representation: the coefficient sequence is represented as a vector of coefficients, including the zero coefficients. If there are only a few nonzero coefficients, this representation is faster and also uses a bit less memory.
Sparse representation: only the nonzero coefficient are stored. If there are many nonzero coefficient...
Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( const Linear_Expression e)

Ordinary copy constructor.

Note
The new expression will have the same representation as e (not necessarily the default_representation).

Definition at line 81 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::DENSE, impl, representation(), and Parma_Polyhedra_Library::SPARSE.

81  {
82  switch (e.representation()) {
83  case DENSE:
84  impl = new Linear_Expression_Impl<Dense_Row>(*e.impl);
85  break;
86  case SPARSE:
87  impl = new Linear_Expression_Impl<Sparse_Row>(*e.impl);
88  break;
89  default:
90  PPL_UNREACHABLE;
91  }
92 }
Dense representation: the coefficient sequence is represented as a vector of coefficients, including the zero coefficients. If there are only a few nonzero coefficients, this representation is faster and also uses a bit less memory.
Sparse representation: only the nonzero coefficient are stored. If there are many nonzero coefficient...
Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( const Linear_Expression e,
Representation  r 
)

Copy constructor that takes also a Representation.

Definition at line 94 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::DENSE, impl, and Parma_Polyhedra_Library::SPARSE.

95  {
96  switch (r) {
97  case DENSE:
98  impl = new Linear_Expression_Impl<Dense_Row>(*e.impl);
99  break;
100  case SPARSE:
101  impl = new Linear_Expression_Impl<Sparse_Row>(*e.impl);
102  break;
103  default:
104  PPL_UNREACHABLE;
105  }
106 }
Dense representation: the coefficient sequence is represented as a vector of coefficients, including the zero coefficients. If there are only a few nonzero coefficients, this representation is faster and also uses a bit less memory.
Sparse representation: only the nonzero coefficient are stored. If there are many nonzero coefficient...
template<typename LE_Adapter >
Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( const LE_Adapter &  e,
typename Enable_If< Is_Same_Or_Derived< Expression_Adapter_Base, LE_Adapter >::value, void * >::type  = 0 
)
inlineexplicit

Copy constructor from a linear expression adapter.

Note
The new expression will have the same representation as e (not necessarily the default_representation).

Definition at line 727 of file Linear_Expression_inlines.hh.

References add_mul_assign, impl, set_space_dimension(), Parma_Polyhedra_Library::swap(), and swap().

731  : impl(NULL) {
732  Linear_Expression tmp(e.representation());
733  tmp.set_space_dimension(e.space_dimension());
734  tmp.set_inhomogeneous_term(e.inhomogeneous_term());
735  for (typename LE_Adapter::const_iterator i = e.begin(),
736  i_end = e.end(); i != i_end; ++i) {
737  add_mul_assign(tmp, *i, i.variable());
738  }
739  using std::swap;
740  swap(impl, tmp.impl);
741 }
void swap(CO_Tree &x, CO_Tree &y)
void swap(Linear_Expression &x, Linear_Expression &y)
Swaps x with y.
friend Linear_Expression & add_mul_assign(Linear_Expression &e, Coefficient_traits::const_reference n, Variable v)
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
template<typename LE_Adapter >
Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( const LE_Adapter &  e,
Representation  r,
typename Enable_If< Is_Same_Or_Derived< Expression_Adapter_Base, LE_Adapter >::value, void * >::type  = 0 
)
inline

Copy constructor from a linear expression adapter that takes a Representation.

Definition at line 746 of file Linear_Expression_inlines.hh.

References add_mul_assign, impl, set_inhomogeneous_term(), set_space_dimension(), Parma_Polyhedra_Library::swap(), and swap().

751  : impl(NULL) {
752  Linear_Expression tmp(r);
753  tmp.set_space_dimension(e.space_dimension());
754  tmp.set_inhomogeneous_term(e.inhomogeneous_term());
755  for (typename LE_Adapter::const_iterator i = e.begin(),
756  i_end = e.end(); i != i_end; ++i) {
757  add_mul_assign(tmp, *i, i.variable());
758  }
759  using std::swap;
760  swap(impl, tmp.impl);
761 }
void swap(CO_Tree &x, CO_Tree &y)
void swap(Linear_Expression &x, Linear_Expression &y)
Swaps x with y.
friend Linear_Expression & add_mul_assign(Linear_Expression &e, Coefficient_traits::const_reference n, Variable v)
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
template<typename LE_Adapter >
Parma_Polyhedra_Library::Linear_Expression::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 
)
inlineexplicit

Copy constructor from a linear expression adapter that takes a space dimension.

Note
The new expression will have the same representation as e (not necessarily default_representation).

Definition at line 766 of file Linear_Expression_inlines.hh.

References add_mul_assign, impl, set_space_dimension(), Parma_Polyhedra_Library::swap(), and swap().

771  : impl(NULL) {
772  Linear_Expression tmp(e.representation());
773  tmp.set_space_dimension(space_dim);
774  tmp.set_inhomogeneous_term(e.inhomogeneous_term());
775  typedef typename LE_Adapter::const_iterator itr_t;
776  itr_t i_end;
777  if (space_dim <= e.space_dimension()) {
778  i_end = e.lower_bound(Variable(space_dim));
779  }
780  else {
781  i_end = e.end();
782  }
783  for (itr_t i = e.begin(); i != i_end; ++i) {
784  add_mul_assign(tmp, *i, i.variable());
785  }
786  using std::swap;
787  swap(impl, tmp.impl);
788 }
void swap(CO_Tree &x, CO_Tree &y)
void swap(Linear_Expression &x, Linear_Expression &y)
Swaps x with y.
friend Linear_Expression & add_mul_assign(Linear_Expression &e, Coefficient_traits::const_reference n, Variable v)
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
template<typename LE_Adapter >
Parma_Polyhedra_Library::Linear_Expression::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 
)
inline

Copy constructor from a linear expression adapter that takes a space dimension and a Representation.

Definition at line 793 of file Linear_Expression_inlines.hh.

References add_mul_assign, impl, set_inhomogeneous_term(), set_space_dimension(), Parma_Polyhedra_Library::swap(), and swap().

799  : impl(NULL) {
800  Linear_Expression tmp(r);
801  tmp.set_space_dimension(space_dim);
802  tmp.set_inhomogeneous_term(e.inhomogeneous_term());
803  typedef typename LE_Adapter::const_iterator itr_t;
804  itr_t i_end;
805  if (space_dim <= e.space_dimension()) {
806  i_end = e.lower_bound(Variable(space_dim));
807  }
808  else {
809  i_end = e.end();
810  }
811  for (itr_t i = e.begin(); i != i_end; ++i) {
812  add_mul_assign(tmp, *i, i.variable());
813  }
814  using std::swap;
815  swap(impl, tmp.impl);
816 }
void swap(CO_Tree &x, CO_Tree &y)
void swap(Linear_Expression &x, Linear_Expression &y)
Swaps x with y.
friend Linear_Expression & add_mul_assign(Linear_Expression &e, Coefficient_traits::const_reference n, Variable v)
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
Parma_Polyhedra_Library::Linear_Expression::~Linear_Expression ( )
inline

Destructor.

Definition at line 39 of file Linear_Expression_inlines.hh.

References impl.

39  {
40  delete impl;
41 }
Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( Coefficient_traits::const_reference  n,
Representation  r = default_representation 
)
explicit

Builds the linear expression corresponding to the inhomogeneous term n.

Definition at line 137 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::DENSE, and Parma_Polyhedra_Library::SPARSE.

138  {
139  switch (r) {
140  case DENSE:
141  impl = new Linear_Expression_Impl<Dense_Row>(n);
142  break;
143  case SPARSE:
144  impl = new Linear_Expression_Impl<Sparse_Row>(n);
145  break;
146  default:
147  PPL_UNREACHABLE;
148  }
149 }
Dense representation: the coefficient sequence is represented as a vector of coefficients, including the zero coefficients. If there are only a few nonzero coefficients, this representation is faster and also uses a bit less memory.
Sparse representation: only the nonzero coefficient are stored. If there are many nonzero coefficient...
Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( Variable  v,
Representation  r = default_representation 
)

Builds the linear expression corresponding to the variable v.

Exceptions
std::length_errorThrown if the space dimension of v exceeds Linear_Expression::max_space_dimension().

Definition at line 151 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::DENSE, and Parma_Polyhedra_Library::SPARSE.

151  {
152  switch (r) {
153  case DENSE:
154  impl = new Linear_Expression_Impl<Dense_Row>(v);
155  break;
156  case SPARSE:
157  impl = new Linear_Expression_Impl<Sparse_Row>(v);
158  break;
159  default:
160  PPL_UNREACHABLE;
161  break;
162  }
163 }
Dense representation: the coefficient sequence is represented as a vector of coefficients, including the zero coefficients. If there are only a few nonzero coefficients, this representation is faster and also uses a bit less memory.
Sparse representation: only the nonzero coefficient are stored. If there are many nonzero coefficient...
Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( const Linear_Expression e,
dimension_type  space_dim 
)

Copy constructor with a specified space dimension.

Definition at line 108 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::DENSE, impl, representation(), and Parma_Polyhedra_Library::SPARSE.

109  {
110  switch (e.representation()) {
111  case DENSE:
112  impl = new Linear_Expression_Impl<Dense_Row>(*e.impl, space_dim);
113  break;
114  case SPARSE:
115  impl = new Linear_Expression_Impl<Sparse_Row>(*e.impl, space_dim);
116  break;
117  default:
118  PPL_UNREACHABLE;
119  }
120 }
Dense representation: the coefficient sequence is represented as a vector of coefficients, including the zero coefficients. If there are only a few nonzero coefficients, this representation is faster and also uses a bit less memory.
Sparse representation: only the nonzero coefficient are stored. If there are many nonzero coefficient...
Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( const Linear_Expression e,
dimension_type  space_dim,
Representation  r 
)

Copy constructor with a specified space dimension and representation.

Definition at line 122 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::DENSE, impl, and Parma_Polyhedra_Library::SPARSE.

124  {
125  switch (r) {
126  case DENSE:
127  impl = new Linear_Expression_Impl<Dense_Row>(*e.impl, space_dim);
128  break;
129  case SPARSE:
130  impl = new Linear_Expression_Impl<Sparse_Row>(*e.impl, space_dim);
131  break;
132  default:
133  PPL_UNREACHABLE;
134  }
135 }
Dense representation: the coefficient sequence is represented as a vector of coefficients, including the zero coefficients. If there are only a few nonzero coefficients, this representation is faster and also uses a bit less memory.
Sparse representation: only the nonzero coefficient are stored. If there are many nonzero coefficient...
Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( dimension_type  space_dim,
bool  x,
Representation  r = default_representation 
)
private

Implementation sizing constructor.

The bool parameter is just to avoid problems with the constructor Linear_Expression(Coefficient_traits::const_reference n).

Definition at line 67 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::DENSE, and Parma_Polyhedra_Library::SPARSE.

68  {
69  switch (r) {
70  case DENSE:
71  impl = new Linear_Expression_Impl<Dense_Row>(space_dim, x);
72  break;
73  case SPARSE:
74  impl = new Linear_Expression_Impl<Sparse_Row>(space_dim, x);
75  break;
76  default:
77  PPL_UNREACHABLE;
78  }
79 }
Dense representation: the coefficient sequence is represented as a vector of coefficients, including the zero coefficients. If there are only a few nonzero coefficients, this representation is faster and also uses a bit less memory.
Sparse representation: only the nonzero coefficient are stored. If there are many nonzero coefficient...

Member Function Documentation

bool Parma_Polyhedra_Library::Linear_Expression::all_homogeneous_terms_are_zero ( ) const
inline
bool Parma_Polyhedra_Library::Linear_Expression::all_zeroes ( const Variables_Set vars) const
inline
bool Parma_Polyhedra_Library::Linear_Expression::all_zeroes ( dimension_type  start,
dimension_type  end 
) const
inlineprivate

Returns true if (*this)[i] is $0$, for each i in [start, end).

Definition at line 437 of file Linear_Expression_inlines.hh.

References Parma_Polyhedra_Library::Linear_Expression_Interface::all_zeroes(), and impl.

437  {
438  return impl->all_zeroes(start, end);
439 }
virtual bool all_zeroes(const Variables_Set &vars) const =0
Returns true if the coefficient of each variable in vars[i] is .
bool Parma_Polyhedra_Library::Linear_Expression::all_zeroes_except ( const Variables_Set vars,
dimension_type  start,
dimension_type  end 
) const
inlineprivate

Returns true if all coefficients in [start,end), except those corresponding to variables in vars, are zero.

Definition at line 481 of file Linear_Expression_inlines.hh.

References Parma_Polyhedra_Library::Linear_Expression_Interface::all_zeroes_except(), and impl.

483  {
484  return impl->all_zeroes_except(vars, start, end);
485 }
virtual bool all_zeroes_except(const Variables_Set &vars, dimension_type start, dimension_type end) const =0
Returns true if each coefficient in [start,end) is *not* in , disregarding coefficients of variables ...
void Parma_Polyhedra_Library::Linear_Expression::ascii_dump ( ) const
void Parma_Polyhedra_Library::Linear_Expression::ascii_dump ( std::ostream &  s) const
inline

Writes to s an ASCII representation of *this.

Definition at line 205 of file Linear_Expression_inlines.hh.

References Parma_Polyhedra_Library::Linear_Expression_Interface::ascii_dump(), and impl.

205  {
206  impl->ascii_dump(s);
207 }
virtual void ascii_dump(std::ostream &s) const =0
Writes to s an ASCII representation of *this.
bool Parma_Polyhedra_Library::Linear_Expression::ascii_load ( std::istream &  s)
inline

Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise.

Definition at line 210 of file Linear_Expression_inlines.hh.

References Parma_Polyhedra_Library::Linear_Expression_Interface::ascii_load(), and impl.

Referenced by Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter::ascii_load(), Parma_Polyhedra_Library::PIP_Solution_Node::ascii_load(), and Parma_Polyhedra_Library::Generator::ascii_load().

210  {
211  return impl->ascii_load(s);
212 }
virtual bool ascii_load(std::istream &s)=0
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
Linear_Expression::const_iterator Parma_Polyhedra_Library::Linear_Expression::begin ( ) const
inline

Returns an iterator that points to the first nonzero coefficient in the expression.

Definition at line 708 of file Linear_Expression_inlines.hh.

References Parma_Polyhedra_Library::Linear_Expression_Interface::begin(), and impl.

Referenced by Parma_Polyhedra_Library::Box< ITV >::affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::affine_image(), Parma_Polyhedra_Library::Box< ITV >::affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::Box< ITV >::bounds(), Parma_Polyhedra_Library::Octagonal_Shape< T >::deduce_minus_v_pm_u_bounds(), Parma_Polyhedra_Library::BD_Shape< T >::deduce_u_minus_v_bounds(), Parma_Polyhedra_Library::BD_Shape< T >::deduce_v_minus_u_bounds(), Parma_Polyhedra_Library::Octagonal_Shape< T >::deduce_v_pm_u_bounds(), Parma_Polyhedra_Library::Box< ITV >::frequency(), Parma_Polyhedra_Library::BD_Shape< T >::frequency(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::Grid::generalized_affine_image(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_image(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Grid::generalized_affine_preimage(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_preimage(), Parma_Polyhedra_Library::MIP_Problem::is_unbounded_obj_function(), Parma_Polyhedra_Library::Box< ITV >::max_min(), Parma_Polyhedra_Library::Polyhedron::modify_according_to_evolution(), and Parma_Polyhedra_Library::BD_Shape< T >::refine().

708  {
709  return const_iterator(impl->begin());
710 }
virtual const_iterator_interface * begin() const =0
Coefficient_traits::const_reference Parma_Polyhedra_Library::Linear_Expression::coefficient ( Variable  v) const
inline

Returns the coefficient of v in *this.

Definition at line 59 of file Linear_Expression_inlines.hh.

References Parma_Polyhedra_Library::Linear_Expression_Interface::coefficient(), and impl.

Referenced by Parma_Polyhedra_Library::Grid_Generator_System::affine_image(), Parma_Polyhedra_Library::Generator_System::affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_image(), Parma_Polyhedra_Library::Grid::affine_image(), Parma_Polyhedra_Library::Polyhedron::affine_image(), Parma_Polyhedra_Library::Constraint_System::affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::Grid::affine_preimage(), Parma_Polyhedra_Library::Polyhedron::affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::bounded_affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::Polyhedron::bounded_affine_image(), Parma_Polyhedra_Library::Box< ITV >::bounded_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounded_affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::bounded_affine_preimage(), Parma_Polyhedra_Library::Polyhedron::bounded_affine_preimage(), Parma_Polyhedra_Library::Congruence::coefficient(), Parma_Polyhedra_Library::Constraint::coefficient(), Parma_Polyhedra_Library::Grid_Generator::coefficient(), Parma_Polyhedra_Library::Generator::coefficient(), Parma_Polyhedra_Library::Grid_Generator::divisor(), Parma_Polyhedra_Library::Constraint::epsilon_coefficient(), Parma_Polyhedra_Library::Generator::epsilon_coefficient(), Parma_Polyhedra_Library::BD_Shape< T >::frequency(), Parma_Polyhedra_Library::Octagonal_Shape< T >::frequency(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Grid::generalized_affine_preimage(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_preimage(), Parma_Polyhedra_Library::Linear_Form< C >::Linear_Form(), Parma_Polyhedra_Library::Box< ITV >::max_min(), Parma_Polyhedra_Library::Octagonal_Shape< T >::max_min(), Parma_Polyhedra_Library::Grid_Generator::OK(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine(), and Parma_Polyhedra_Library::BD_Shape< T >::refine().

59  {
60  return impl->coefficient(v);
61 }
virtual Coefficient_traits::const_reference coefficient(Variable v) const =0
Returns the coefficient of v in *this.
Linear_Expression::const_iterator Parma_Polyhedra_Library::Linear_Expression::end ( ) const
inline

Returns an iterator that points to the last nonzero coefficient in the expression.

Definition at line 714 of file Linear_Expression_inlines.hh.

References Parma_Polyhedra_Library::Linear_Expression_Interface::end(), and impl.

Referenced by Parma_Polyhedra_Library::Box< ITV >::affine_image(), Parma_Polyhedra_Library::Box< ITV >::affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::bounds(), Parma_Polyhedra_Library::Box< ITV >::frequency(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::Grid::generalized_affine_image(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_image(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Grid::generalized_affine_preimage(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_preimage(), Parma_Polyhedra_Library::MIP_Problem::is_unbounded_obj_function(), Parma_Polyhedra_Library::Box< ITV >::max_min(), and Parma_Polyhedra_Library::Polyhedron::modify_according_to_evolution().

714  {
715  return const_iterator(impl->end());
716 }
virtual const_iterator_interface * end() const =0
void Parma_Polyhedra_Library::Linear_Expression::exact_div_assign ( Coefficient_traits::const_reference  c,
dimension_type  start,
dimension_type  end 
)
inlineprivate
void Parma_Polyhedra_Library::Linear_Expression::finalize ( )
static

Finalizes the class.

Definition at line 48 of file Linear_Expression.cc.

Referenced by Parma_Polyhedra_Library::Init::~Init().

48  {
49  PPL_ASSERT(zero_p != 0);
50  delete zero_p;
51  zero_p = 0;
52 }
static const Linear_Expression * zero_p
Holds (between class initialization and finalization) a pointer to the (zero-dimension space) constan...
dimension_type Parma_Polyhedra_Library::Linear_Expression::first_nonzero ( dimension_type  first,
dimension_type  last 
) const
inlineprivate

Returns the index of the first nonzero element, or last if there are no nonzero elements, considering only elements in [first,last).

Definition at line 520 of file Linear_Expression_inlines.hh.

Referenced by Parma_Polyhedra_Library::Box< ITV >::generalized_affine_image().

520  {
521  return impl->first_nonzero(first, last);
522 }
virtual dimension_type first_nonzero(dimension_type first, dimension_type last) const =0
Coefficient Parma_Polyhedra_Library::Linear_Expression::gcd ( dimension_type  start,
dimension_type  end 
) const
inlineprivate

Returns the gcd of the nonzero coefficients in [start,end). If all the coefficients in this range are 0 returns 0.

Definition at line 447 of file Linear_Expression_inlines.hh.

References Parma_Polyhedra_Library::Linear_Expression_Interface::gcd(), and impl.

Referenced by Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter::Artificial_Parameter().

447  {
448  return impl->gcd(start, end);
449 }
virtual Coefficient gcd(dimension_type start, dimension_type end) const =0
Returns the gcd of the nonzero coefficients in [start,end). If all the coefficients in this range are...
Coefficient_traits::const_reference Parma_Polyhedra_Library::Linear_Expression::get ( dimension_type  i) const
inlineprivate
Coefficient_traits::const_reference Parma_Polyhedra_Library::Linear_Expression::get ( Variable  v) const
inlineprivate

Returns the coefficient of v.

Definition at line 426 of file Linear_Expression_inlines.hh.

References Parma_Polyhedra_Library::Linear_Expression_Interface::get(), impl, and Parma_Polyhedra_Library::Variable::space_dimension().

426  {
427  return impl->get(v.space_dimension());
428 }
virtual Coefficient_traits::const_reference get(dimension_type i) const =0
Returns the i-th coefficient.
void Parma_Polyhedra_Library::Linear_Expression::get_row ( Dense_Row r) const
inlineprivate

Sets r to a copy of the row that implements *this.

Definition at line 554 of file Linear_Expression_inlines.hh.

554  {
555  return impl->get_row(r);
556 }
virtual void get_row(Dense_Row &r) const =0
Sets r to a copy of the row that implements *this.
void Parma_Polyhedra_Library::Linear_Expression::get_row ( Sparse_Row r) const
inlineprivate

Sets r to a copy of the row that implements *this.

Definition at line 560 of file Linear_Expression_inlines.hh.

560  {
561  return impl->get_row(r);
562 }
virtual void get_row(Dense_Row &r) const =0
Sets r to a copy of the row that implements *this.
void Parma_Polyhedra_Library::Linear_Expression::has_a_free_dimension_helper ( std::set< dimension_type > &  x) const
inlineprivate

Removes from the set x all the indexes of nonzero elements of *this.

Definition at line 532 of file Linear_Expression_inlines.hh.

532  {
534 }
virtual void has_a_free_dimension_helper(std::set< dimension_type > &x) const =0
Removes from the set x all the indexes of nonzero elements of *this.
bool Parma_Polyhedra_Library::Linear_Expression::have_a_common_variable ( const Linear_Expression x,
Variable  first,
Variable  last 
) const
inlineprivate
Coefficient_traits::const_reference Parma_Polyhedra_Library::Linear_Expression::inhomogeneous_term ( ) const
inline

Returns the inhomogeneous term of *this.

Definition at line 70 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::inhomogeneous_term().

Referenced by Parma_Polyhedra_Library::Generator_System::add_corresponding_points(), Parma_Polyhedra_Library::Box< ITV >::affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::affine_image(), Parma_Polyhedra_Library::Box< ITV >::affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::Polyhedron::BFT00_poly_hull_assign_if_exact(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::Generator_System::convert_into_non_necessarily_closed(), Parma_Polyhedra_Library::Grid_Generator::divisor(), Parma_Polyhedra_Library::Generator::divisor(), Parma_Polyhedra_Library::Polyhedron::drop_some_non_integer_points(), Parma_Polyhedra_Library::Box< ITV >::frequency(), Parma_Polyhedra_Library::BD_Shape< T >::frequency(), Parma_Polyhedra_Library::Polyhedron::frequency(), Parma_Polyhedra_Library::Octagonal_Shape< T >::frequency(), Parma_Polyhedra_Library::Grid::frequency_no_check(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Congruence::inhomogeneous_term(), Parma_Polyhedra_Library::Constraint::inhomogeneous_term(), Parma_Polyhedra_Library::Generator_System::insert(), Parma_Polyhedra_Library::Generator_System::insert_pending(), Parma_Polyhedra_Library::Grid_Generator::is_line_or_parameter(), Parma_Polyhedra_Library::Generator::is_line_or_ray(), Parma_Polyhedra_Library::Generator::is_matching_closure_point(), Parma_Polyhedra_Library::Linear_Form< C >::Linear_Form(), Parma_Polyhedra_Library::BD_Shape< T >::max_min(), Parma_Polyhedra_Library::Box< ITV >::max_min(), Parma_Polyhedra_Library::Grid::max_min(), Parma_Polyhedra_Library::Octagonal_Shape< T >::max_min(), Parma_Polyhedra_Library::Polyhedron::max_min(), Parma_Polyhedra_Library::Grid_Generator::OK(), Parma_Polyhedra_Library::Polyhedron::positive_time_elapse_assign_impl(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine(), Parma_Polyhedra_Library::BD_Shape< T >::refine(), and Parma_Polyhedra_Library::Polyhedron::strongly_minimize_generators().

70  {
71  return impl->inhomogeneous_term();
72 }
virtual Coefficient_traits::const_reference inhomogeneous_term() const =0
Returns the inhomogeneous term of *this.
void Parma_Polyhedra_Library::Linear_Expression::initialize ( )
static

Initializes the class.

Definition at line 42 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::Coefficient_zero().

Referenced by Parma_Polyhedra_Library::Init::Init().

42  {
43  PPL_ASSERT(zero_p == 0);
45 }
Coefficient_traits::const_reference Coefficient_zero()
Returns a const reference to a Coefficient with value 0.
static const Linear_Expression * zero_p
Holds (between class initialization and finalization) a pointer to the (zero-dimension space) constan...
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
bool Parma_Polyhedra_Library::Linear_Expression::is_equal_to ( const Linear_Expression x) const
inline
bool Parma_Polyhedra_Library::Linear_Expression::is_equal_to ( const Linear_Expression x,
dimension_type  start,
dimension_type  end 
) const
inlineprivate

Returns true if (*this)[i] is equal to x[i], for each i in [start,end).

Definition at line 538 of file Linear_Expression_inlines.hh.

References impl.

539  {
540  return impl->is_equal_to(*(x.impl), start, end);
541 }
virtual bool is_equal_to(const Linear_Expression_Interface &x) const =0
bool Parma_Polyhedra_Library::Linear_Expression::is_equal_to ( const Linear_Expression x,
Coefficient_traits::const_reference  c1,
Coefficient_traits::const_reference  c2,
dimension_type  start,
dimension_type  end 
) const
inlineprivate

Returns true if (*this)[i]*c1 is equal to x[i]*c2, for each i in [start,end).

Definition at line 545 of file Linear_Expression_inlines.hh.

References impl.

548  {
549  return impl->is_equal_to(*(x.impl), c1, c2, start, end);
550 }
virtual bool is_equal_to(const Linear_Expression_Interface &x) const =0
bool Parma_Polyhedra_Library::Linear_Expression::is_zero ( ) const
inline

Returns true if and only if *this is $0$.

Definition at line 91 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::is_zero().

91  {
92  return impl->is_zero();
93 }
virtual bool is_zero() const =0
Returns true if and only if *this is .
dimension_type Parma_Polyhedra_Library::Linear_Expression::last_nonzero ( ) const
inlineprivate

Returns the index of the last nonzero element, or 0 if there are no nonzero elements.

Definition at line 488 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::last_nonzero().

Referenced by Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::Grid::generalized_affine_image(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Grid::generalized_affine_preimage(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine(), and Parma_Polyhedra_Library::BD_Shape< T >::refine().

488  {
489  return impl->last_nonzero();
490 }
virtual dimension_type last_nonzero() const =0
dimension_type Parma_Polyhedra_Library::Linear_Expression::last_nonzero ( dimension_type  first,
dimension_type  last 
) const
inlineprivate

Returns the index of the last nonzero element in [first,last), or last if there are no nonzero elements.

Definition at line 526 of file Linear_Expression_inlines.hh.

526  {
527  return impl->last_nonzero(first, last);
528 }
virtual dimension_type last_nonzero() const =0
void Parma_Polyhedra_Library::Linear_Expression::linear_combine ( const Linear_Expression y,
Variable  v 
)
void Parma_Polyhedra_Library::Linear_Expression::linear_combine ( const Linear_Expression y,
Coefficient_traits::const_reference  c1,
Coefficient_traits::const_reference  c2 
)
inline

Equivalent to *this = *this * c1 + y * c2, but assumes that c1 and c2 are not 0.

Definition at line 572 of file Linear_Expression_inlines.hh.

References impl.

574  {
575  impl->linear_combine(*y.impl, c1, c2);
576 }
virtual void linear_combine(const Linear_Expression_Interface &y, Variable v)=0
void Parma_Polyhedra_Library::Linear_Expression::linear_combine ( const Linear_Expression y,
dimension_type  i 
)
inlineprivate

Linearly combines *this with y so that the coefficient of v is 0.

Parameters
yThe expression that will be combined with *this object;
iThe index of the coefficient that has to become $0$.

Computes a linear combination of *this and y having the i-th coefficient equal to $0$. Then it assigns the resulting expression to *this.

*this and y must have the same space dimension.

Definition at line 566 of file Linear_Expression_inlines.hh.

References impl.

566  {
567  impl->linear_combine(*y.impl, i);
568 }
virtual void linear_combine(const Linear_Expression_Interface &y, Variable v)=0
void Parma_Polyhedra_Library::Linear_Expression::linear_combine ( const Linear_Expression y,
Coefficient_traits::const_reference  c1,
Coefficient_traits::const_reference  c2,
dimension_type  start,
dimension_type  end 
)
inlineprivate

Equivalent to (*this)[i] = (*this)[i] * c1 + y[i] * c2, for each i in [start, end). It assumes that c1 and c2 are nonzero.

Definition at line 597 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::linear_combine().

601  {
602  impl->linear_combine(*y.impl, c1, c2, start, end);
603 }
virtual void linear_combine(const Linear_Expression_Interface &y, Variable v)=0
void Parma_Polyhedra_Library::Linear_Expression::linear_combine_lax ( const Linear_Expression y,
Coefficient_traits::const_reference  c1,
Coefficient_traits::const_reference  c2 
)
inline

Equivalent to *this = *this * c1 + y * c2. c1 and c2 may be 0.

Definition at line 580 of file Linear_Expression_inlines.hh.

References impl.

Referenced by Parma_Polyhedra_Library::Grid::reduce_pc_with_pc().

582  {
583  impl->linear_combine_lax(*y.impl, c1, c2);
584 }
virtual void linear_combine_lax(const Linear_Expression_Interface &y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2)=0
void Parma_Polyhedra_Library::Linear_Expression::linear_combine_lax ( const Linear_Expression y,
Coefficient_traits::const_reference  c1,
Coefficient_traits::const_reference  c2,
dimension_type  start,
dimension_type  end 
)
inlineprivate

Equivalent to (*this)[i] = (*this)[i] * c1 + y[i] * c2, for each i in [start, end). c1 and c2 may be zero.

Definition at line 606 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::linear_combine_lax().

610  {
611  impl->linear_combine_lax(*y.impl, c1, c2, start, end);
612 }
virtual void linear_combine_lax(const Linear_Expression_Interface &y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2)=0
void Parma_Polyhedra_Library::Linear_Expression::m_swap ( Linear_Expression y)
inline

Swaps *this with y.

Definition at line 194 of file Linear_Expression_inlines.hh.

References impl, Parma_Polyhedra_Library::swap(), and swap().

Referenced by Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter::m_swap(), and swap().

194  {
195  using std::swap;
196  swap(impl, y.impl);
197 }
void swap(CO_Tree &x, CO_Tree &y)
void swap(Linear_Expression &x, Linear_Expression &y)
Swaps x with y.
PPL::dimension_type Parma_Polyhedra_Library::Linear_Expression::max_space_dimension ( )
static
void Parma_Polyhedra_Library::Linear_Expression::mul_assign ( Coefficient_traits::const_reference  n,
dimension_type  start,
dimension_type  end 
)
inlineprivate

Equivalent to (*this)[i] *= n, for each i in [start, end).

Definition at line 460 of file Linear_Expression_inlines.hh.

Referenced by Parma_Polyhedra_Library::Grid::reduce_parameter_with_line().

461  {
462  impl->mul_assign(c, start, end);
463 }
virtual void mul_assign(Coefficient_traits::const_reference n, dimension_type start, dimension_type end)=0
Equivalent to (*this)[i] *= n, for each i in [start, end).
Coefficient c
Definition: PIP_Tree.cc:64
void Parma_Polyhedra_Library::Linear_Expression::negate ( dimension_type  first,
dimension_type  last 
)
inlineprivate

Negates the elements from index first (included) to index last (excluded).

Definition at line 471 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::negate().

Referenced by operator-(), and Parma_Polyhedra_Library::Grid::simplify().

471  {
472  impl->negate(first, last);
473 }
virtual void negate(dimension_type first, dimension_type last)=0
Negates the elements from index first (included) to index last (excluded).
void Parma_Polyhedra_Library::Linear_Expression::normalize ( )
inline

Normalizes the modulo of the coefficients and of the inhomogeneous term so that they are mutually prime.

Computes the Greatest Common Divisor (GCD) among the coefficients and the inhomogeneous term and normalizes them by the GCD itself.

Definition at line 200 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::normalize().

Referenced by Parma_Polyhedra_Library::Generator_System::add_corresponding_closure_points(), Parma_Polyhedra_Library::Polyhedron::BFT00_poly_hull_assign_if_exact(), Parma_Polyhedra_Library::Generator::closure_point(), Parma_Polyhedra_Library::Polyhedron::drop_some_non_integer_points(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_image(), Parma_Polyhedra_Library::Grid_Generator::grid_point(), Parma_Polyhedra_Library::Grid_Generator::is_equivalent_to(), Parma_Polyhedra_Library::Constraint::is_equivalent_to(), Parma_Polyhedra_Library::Generator::is_equivalent_to(), Parma_Polyhedra_Library::Polyhedron::modify_according_to_evolution(), Parma_Polyhedra_Library::Generator::point(), Parma_Polyhedra_Library::Polyhedron::positive_time_elapse_assign_impl(), Parma_Polyhedra_Library::Grid_Generator::strong_normalize(), Parma_Polyhedra_Library::Generator::strong_normalize(), Parma_Polyhedra_Library::Constraint::strong_normalize(), Parma_Polyhedra_Library::Polyhedron::strongly_minimize_generators(), Parma_Polyhedra_Library::Polyhedron::time_elapse_assign(), and Parma_Polyhedra_Library::Polyhedron::topological_closure_assign().

200  {
201  impl->normalize();
202 }
dimension_type Parma_Polyhedra_Library::Linear_Expression::num_zeroes ( dimension_type  start,
dimension_type  end 
) const
inlineprivate

Returns the number of zero coefficient in [start, end).

Definition at line 442 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::num_zeroes().

442  {
443  return impl->num_zeroes(start, end);
444 }
virtual dimension_type num_zeroes(dimension_type start, dimension_type end) const =0
Returns the number of zero coefficient in [start, end).
bool Parma_Polyhedra_Library::Linear_Expression::OK ( ) const

Checks if all the invariants are satisfied.

Definition at line 177 of file Linear_Expression.cc.

References OK().

Referenced by OK().

177  {
178  return impl->OK();
179 }
Linear_Expression & Parma_Polyhedra_Library::Linear_Expression::operator= ( const Linear_Expression e)
inline

Assignment operator.

Definition at line 32 of file Linear_Expression_inlines.hh.

References swap().

32  {
33  Linear_Expression tmp = e;
34  swap(*this, tmp);
35  return *this;
36 }
void swap(Linear_Expression &x, Linear_Expression &y)
Swaps x with y.
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
void Parma_Polyhedra_Library::Linear_Expression::permute_space_dimensions ( const std::vector< Variable > &  cycle)
inline

Permutes the space dimensions of the expression.

Parameters
cycleA vector representing a cycle of the permutation according to which the space dimensions must be rearranged.

The cycle vector represents a cycle of a permutation of space dimensions. For example, the permutation $ \{ x_1 \mapsto x_2, x_2 \mapsto x_3, x_3 \mapsto x_1 \}$ can be represented by the vector containing $ x_1, x_2, x_3 $.

Definition at line 220 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::permute_space_dimensions().

Referenced by Parma_Polyhedra_Library::Congruence::permute_space_dimensions().

220  {
222 }
virtual void permute_space_dimensions(const std::vector< Variable > &cycle)=0
Permutes the space dimensions of the expression.
void Parma_Polyhedra_Library::Linear_Expression::print ( ) const

Prints *this to std::cerr using operator<<.

void Parma_Polyhedra_Library::Linear_Expression::remove_space_dimensions ( const Variables_Set vars)
inline

Removes all the specified dimensions from the expression.

The space dimension of the variable with the highest space dimension in vars must be at most the space dimension of this.

Definition at line 215 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::remove_space_dimensions().

Referenced by Parma_Polyhedra_Library::Constraint::remove_space_dimensions().

215  {
217 }
virtual void remove_space_dimensions(const Variables_Set &vars)=0
Removes all the specified dimensions from the expression.
Representation Parma_Polyhedra_Library::Linear_Expression::representation ( ) const
inline
void Parma_Polyhedra_Library::Linear_Expression::scalar_product_assign ( Coefficient result,
const Linear_Expression y 
) const
inlineprivate

Sets results to the sum of (*this)[i]*y[i], for each i.

Definition at line 494 of file Linear_Expression_inlines.hh.

Referenced by Parma_Polyhedra_Library::Scalar_Products::assign(), Parma_Polyhedra_Library::Scalar_Products::homogeneous_assign(), and Parma_Polyhedra_Library::Scalar_Products::reduced_assign().

494  {
495  scalar_product_assign(result, y, 0, space_dimension() + 1);
496 }
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
void scalar_product_assign(Coefficient &result, const Linear_Expression &y) const
Sets results to the sum of (*this)[i]*y[i], for each i.
void Parma_Polyhedra_Library::Linear_Expression::scalar_product_assign ( Coefficient result,
const Linear_Expression y,
dimension_type  start,
dimension_type  end 
) const
inlineprivate

Sets results to the sum of (*this)[i]*y[i], for each i in [start,end).

Definition at line 500 of file Linear_Expression_inlines.hh.

References impl.

501  {
502  impl->scalar_product_assign(result, *(y.impl), start, end);
503 }
virtual void scalar_product_assign(Coefficient &result, const Linear_Expression_Interface &y, dimension_type start, dimension_type end) const =0
Sets results to the sum of (*this)[i]*y[i], for each i in [start,end).
int Parma_Polyhedra_Library::Linear_Expression::scalar_product_sign ( const Linear_Expression y) const
inlineprivate

Computes the sign of the sum of (*this)[i]*y[i], for each i.

Definition at line 507 of file Linear_Expression_inlines.hh.

507  {
508  return scalar_product_sign(y, 0, space_dimension() + 1);
509 }
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
int scalar_product_sign(const Linear_Expression &y) const
Computes the sign of the sum of (*this)[i]*y[i], for each i.
int Parma_Polyhedra_Library::Linear_Expression::scalar_product_sign ( const Linear_Expression y,
dimension_type  start,
dimension_type  end 
) const
inlineprivate

Computes the sign of the sum of (*this)[i]*y[i], for each i in [start,end).

Definition at line 513 of file Linear_Expression_inlines.hh.

References impl.

514  {
515  return impl->scalar_product_sign(*(y.impl), start, end);
516 }
virtual int scalar_product_sign(const Linear_Expression_Interface &y, dimension_type start, dimension_type end) const =0
void Parma_Polyhedra_Library::Linear_Expression::set ( dimension_type  i,
Coefficient_traits::const_reference  n 
)
inlineprivate

Sets the i-th coefficient to n.

Definition at line 420 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::set().

Referenced by Parma_Polyhedra_Library::Grid::conversion(), Parma_Polyhedra_Library::Grid::Grid(), and Parma_Polyhedra_Library::Grid_Generator::is_equivalent_to().

421  {
422  impl->set(i, n);
423 }
virtual void set(dimension_type i, Coefficient_traits::const_reference n)=0
Sets the i-th coefficient to n.
void Parma_Polyhedra_Library::Linear_Expression::set ( Variable  v,
Coefficient_traits::const_reference  n 
)
inlineprivate

Sets the coefficient of v to n.

Definition at line 431 of file Linear_Expression_inlines.hh.

References impl, Parma_Polyhedra_Library::Linear_Expression_Interface::set(), and Parma_Polyhedra_Library::Variable::space_dimension().

432  {
433  impl->set(v.space_dimension(), n);
434 }
virtual void set(dimension_type i, Coefficient_traits::const_reference n)=0
Sets the i-th coefficient to n.
void Parma_Polyhedra_Library::Linear_Expression::set_representation ( Representation  r)

Converts *this to the specified representation.

Definition at line 166 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::swap().

Referenced by Parma_Polyhedra_Library::Congruence::set_representation(), Parma_Polyhedra_Library::Constraint::set_representation(), Parma_Polyhedra_Library::Grid_Generator::set_representation(), and Parma_Polyhedra_Library::Generator::set_representation().

166  {
167  if (representation() == r) {
168  return;
169  }
170  Linear_Expression tmp(*this, r);
171  swap(*this, tmp);
172 }
Representation representation() const
Returns the current representation of *this.
void swap(Linear_Expression &x, Linear_Expression &y)
Swaps x with y.
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
void Parma_Polyhedra_Library::Linear_Expression::set_space_dimension ( dimension_type  n)
inline

Sets the dimension of the vector space enclosing *this to n .

Definition at line 54 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::set_space_dimension().

Referenced by Parma_Polyhedra_Library::Congruence_System::add_unit_rows_and_space_dimensions(), Parma_Polyhedra_Library::Linear_System< Row >::add_universe_rows_and_space_dimensions(), Parma_Polyhedra_Library::Termination_Helpers::all_affine_ranking_functions_PR(), Parma_Polyhedra_Library::Termination_Helpers::all_affine_ranking_functions_PR_original(), Parma_Polyhedra_Library::BD_Shape< T >::BFT00_upper_bound_assign_if_exact(), Parma_Polyhedra_Library::Constraint::Constraint(), Parma_Polyhedra_Library::Grid::conversion(), Parma_Polyhedra_Library::Implementation::Termination::fill_constraint_system_PR(), Parma_Polyhedra_Library::Implementation::Termination::fill_constraint_system_PR_original(), Parma_Polyhedra_Library::Implementation::Termination::fill_constraint_systems_MS(), Parma_Polyhedra_Library::Generator::Generator(), Parma_Polyhedra_Library::Grid::Grid(), Parma_Polyhedra_Library::Grid_Generator::Grid_Generator(), Parma_Polyhedra_Library::Grid::is_universe(), Linear_Expression(), Parma_Polyhedra_Library::Grid::map_space_dimensions(), Parma_Polyhedra_Library::Polyhedron::map_space_dimensions(), Parma_Polyhedra_Library::Polyhedron::minimize(), Parma_Polyhedra_Library::Termination_Helpers::one_affine_ranking_function_PR(), Parma_Polyhedra_Library::Constraint::operator>(), Parma_Polyhedra_Library::Constraint::operator>=(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), Parma_Polyhedra_Library::Grid_Generator::set_space_dimension(), Parma_Polyhedra_Library::Congruence::set_space_dimension(), Parma_Polyhedra_Library::Constraint::set_space_dimension_no_ok(), Parma_Polyhedra_Library::Generator::set_space_dimension_no_ok(), Parma_Polyhedra_Library::Generator::set_topology(), and Parma_Polyhedra_Library::Constraint::set_topology().

54  {
56 }
virtual void set_space_dimension(dimension_type n)=0
Sets the dimension of the vector space enclosing *this to n .
void Parma_Polyhedra_Library::Linear_Expression::shift_space_dimensions ( Variable  v,
dimension_type  n 
)
inline
void Parma_Polyhedra_Library::Linear_Expression::sign_normalize ( )
inline

Ensures that the first nonzero homogeneous coefficient is positive, by negating the row if necessary.

Definition at line 466 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::sign_normalize().

dimension_type Parma_Polyhedra_Library::Linear_Expression::space_dimension ( ) const
inline

Returns the dimension of the vector space enclosing *this.

Definition at line 49 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::space_dimension().

Referenced by Parma_Polyhedra_Library::Grid_Generator_System::affine_image(), Parma_Polyhedra_Library::Generator_System::affine_image(), Parma_Polyhedra_Library::Box< ITV >::affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::affine_image(), Parma_Polyhedra_Library::Grid::affine_image(), Parma_Polyhedra_Library::Polyhedron::affine_image(), Parma_Polyhedra_Library::Congruence::affine_preimage(), Parma_Polyhedra_Library::Constraint_System::affine_preimage(), Parma_Polyhedra_Library::Congruence_System::affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::Grid::affine_preimage(), Parma_Polyhedra_Library::Polyhedron::affine_preimage(), Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter::Artificial_Parameter(), Parma_Polyhedra_Library::Box< ITV >::bounded_affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::Grid::bounded_affine_image(), Parma_Polyhedra_Library::Polyhedron::bounded_affine_image(), Parma_Polyhedra_Library::Box< ITV >::bounded_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounded_affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::bounded_affine_preimage(), Parma_Polyhedra_Library::Grid::bounded_affine_preimage(), Parma_Polyhedra_Library::Polyhedron::bounded_affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::bounds(), Parma_Polyhedra_Library::Box< ITV >::bounds(), Parma_Polyhedra_Library::Grid::bounds(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounds(), Parma_Polyhedra_Library::Polyhedron::bounds(), Parma_Polyhedra_Library::Grid::bounds_no_check(), Parma_Polyhedra_Library::Constraint::Constraint(), Parma_Polyhedra_Library::Congruence::create(), Parma_Polyhedra_Library::Constraint::epsilon_coefficient(), Parma_Polyhedra_Library::Generator::epsilon_coefficient(), Parma_Polyhedra_Library::Box< ITV >::frequency(), Parma_Polyhedra_Library::BD_Shape< T >::frequency(), Parma_Polyhedra_Library::Polyhedron::frequency(), Parma_Polyhedra_Library::Octagonal_Shape< T >::frequency(), Parma_Polyhedra_Library::Grid::frequency(), Parma_Polyhedra_Library::Grid::frequency_no_check(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::Grid::generalized_affine_image(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_image(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Grid::generalized_affine_preimage(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_preimage(), Parma_Polyhedra_Library::Generator::Generator(), Parma_Polyhedra_Library::Grid_Generator::grid_line(), Parma_Polyhedra_Library::Grid_Generator::grid_point(), Parma_Polyhedra_Library::Scalar_Products::homogeneous_assign(), Parma_Polyhedra_Library::Generator::is_matching_closure_point(), Parma_Polyhedra_Library::Linear_Form< C >::Linear_Form(), Parma_Polyhedra_Library::BD_Shape< T >::max_min(), Parma_Polyhedra_Library::Box< ITV >::max_min(), Parma_Polyhedra_Library::Octagonal_Shape< T >::max_min(), Parma_Polyhedra_Library::Polyhedron::max_min(), Parma_Polyhedra_Library::MIP_Problem::MIP_Problem(), Parma_Polyhedra_Library::Polyhedron::modify_according_to_evolution(), Parma_Polyhedra_Library::Grid_Generator::OK(), operator+(), operator-(), Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter::operator==(), Parma_Polyhedra_Library::Constraint::operator==(), Parma_Polyhedra_Library::Constraint::operator>=(), Parma_Polyhedra_Library::Grid_Generator::parameter(), Parma_Polyhedra_Library::Grid::reduce_line_with_line(), Parma_Polyhedra_Library::Scalar_Products::reduced_assign(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine(), Parma_Polyhedra_Library::BD_Shape< T >::refine(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Constraint::set_epsilon_coefficient(), Parma_Polyhedra_Library::Generator::set_epsilon_coefficient(), Parma_Polyhedra_Library::MIP_Problem::set_objective_function(), Parma_Polyhedra_Library::Constraint::set_space_dimension_no_ok(), Parma_Polyhedra_Library::Generator::set_space_dimension_no_ok(), Parma_Polyhedra_Library::Generator::set_topology(), Parma_Polyhedra_Library::Constraint::set_topology(), Parma_Polyhedra_Library::Congruence::space_dimension(), Parma_Polyhedra_Library::Box< ITV >::throw_dimension_incompatible(), Parma_Polyhedra_Library::Octagonal_Shape< T >::throw_dimension_incompatible(), Parma_Polyhedra_Library::BD_Shape< T >::throw_dimension_incompatible(), Parma_Polyhedra_Library::Grid::throw_dimension_incompatible(), and Parma_Polyhedra_Library::Polyhedron::throw_dimension_incompatible().

49  {
50  return impl->space_dimension();
51 }
virtual dimension_type space_dimension() const =0
Returns the dimension of the vector space enclosing *this.
void Parma_Polyhedra_Library::Linear_Expression::swap_space_dimensions ( Variable  v1,
Variable  v2 
)
inline
memory_size_type Parma_Polyhedra_Library::Linear_Expression::total_memory_in_bytes ( ) const
inline

Returns a lower bound to the total size in bytes of the memory occupied by *this.

Definition at line 112 of file Linear_Expression_inlines.hh.

References external_memory_in_bytes().

112  {
113  return external_memory_in_bytes() + sizeof(*this);
114 }
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
const Linear_Expression & Parma_Polyhedra_Library::Linear_Expression::zero ( )
inlinestatic

Returns the (zero-dimension space) constant 0.

Definition at line 101 of file Linear_Expression_inlines.hh.

References zero_p.

Referenced by Parma_Polyhedra_Library::Generator::closure_point(), Parma_Polyhedra_Library::Grid_Generator::grid_point(), Parma_Polyhedra_Library::Congruence::initialize(), Parma_Polyhedra_Library::Constraint::initialize(), and Parma_Polyhedra_Library::Generator::point().

101  {
102  PPL_ASSERT(zero_p != 0);
103  return *zero_p;
104 }
static const Linear_Expression * zero_p
Holds (between class initialization and finalization) a pointer to the (zero-dimension space) constan...

Friends And Related Function Documentation

Linear_Expression & add_mul_assign ( Linear_Expression e,
Coefficient_traits::const_reference  n,
Variable  v 
)
related

Returns the linear expression e + n * v and assigns it to e.

void add_mul_assign ( Linear_Expression e1,
Coefficient_traits::const_reference  factor,
const Linear_Expression e2 
)
related

Sums e2 multiplied by factor into e1.

Definition at line 401 of file Linear_Expression_inlines.hh.

403  {
404  e1.impl->add_mul_assign(factor, *e2.impl);
405 }
Linear_Expression & add_mul_assign ( Linear_Expression e,
Coefficient_traits::const_reference  n,
const Variable  v 
)
related

Definition at line 384 of file Linear_Expression_inlines.hh.

References Parma_Polyhedra_Library::Linear_Expression_Interface::add_mul_assign(), and impl.

386  {
387  e.impl->add_mul_assign(n, v);
388  return e;
389 }
Linear_Expression& add_mul_assign ( Linear_Expression e,
Coefficient_traits::const_reference  n,
Variable  v 
)
friend

Referenced by Linear_Expression().

void add_mul_assign ( Linear_Expression e1,
Coefficient_traits::const_reference  factor,
const Linear_Expression e2 
)
friend

Definition at line 401 of file Linear_Expression_inlines.hh.

403  {
404  e1.impl->add_mul_assign(factor, *e2.impl);
405 }
template<typename T >
friend class BD_Shape
friend

Definition at line 840 of file Linear_Expression_defs.hh.

friend class BD_Shape_Helpers
friend

Definition at line 836 of file Linear_Expression_defs.hh.

friend class BHRZ03_Certificate
friend

Definition at line 831 of file Linear_Expression_defs.hh.

template<typename T >
friend class Box
friend

Definition at line 846 of file Linear_Expression_defs.hh.

friend class Box_Helpers
friend

Definition at line 834 of file Linear_Expression_defs.hh.

int compare ( const Linear_Expression x,
const Linear_Expression y 
)
related

The basic comparison function.

Returns
-1 or -2 if x is less than y, 0 if they are equal and 1 or 2 is y is greater. The absolute value of the result is 1 if the difference is only in the inhomogeneous terms, 2 otherwise

The order is a lexicographic. It starts comparing the variables' coefficient, starting from Variable(0), and at the end it compares the inhomogeneous terms.

Definition at line 587 of file Linear_Expression_inlines.hh.

587  {
588  return x.impl->compare(*y.impl);
589 }
int compare ( const Linear_Expression x,
const Linear_Expression y 
)
friend

Definition at line 587 of file Linear_Expression_inlines.hh.

587  {
588  return x.impl->compare(*y.impl);
589 }
friend class Congruence
friend

Definition at line 823 of file Linear_Expression_defs.hh.

friend class Congruence_System
friend

Definition at line 835 of file Linear_Expression_defs.hh.

friend class Constraint
friend

Definition at line 828 of file Linear_Expression_defs.hh.

friend class Constraint_System
friend

Definition at line 829 of file Linear_Expression_defs.hh.

template<typename T >
friend class Expression_Adapter
friend

Definition at line 848 of file Linear_Expression_defs.hh.

template<typename T >
friend class Expression_Hide_Inhomo
friend

Definition at line 850 of file Linear_Expression_defs.hh.

template<typename T >
friend class Expression_Hide_Last
friend

Definition at line 852 of file Linear_Expression_defs.hh.

friend class Generator
friend

Definition at line 827 of file Linear_Expression_defs.hh.

friend class Grid
friend

Definition at line 822 of file Linear_Expression_defs.hh.

friend class Grid_Generator
friend

Definition at line 826 of file Linear_Expression_defs.hh.

template<typename Row >
friend class Linear_Expression_Impl
friend

Definition at line 815 of file Linear_Expression_defs.hh.

template<typename T >
friend class Linear_System
friend

Definition at line 844 of file Linear_Expression_defs.hh.

friend class MIP_Problem
friend

Definition at line 833 of file Linear_Expression_defs.hh.

void neg_assign ( Linear_Expression e)
related

Assigns to e its own negation.

void neg_assign ( Linear_Expression e)
related

Definition at line 378 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::negate().

378  {
379  e.impl->negate();
380 }
template<typename T >
friend class Octagonal_Shape
friend

Definition at line 842 of file Linear_Expression_defs.hh.

friend class Octagonal_Shape_Helper
friend

Definition at line 837 of file Linear_Expression_defs.hh.

Linear_Expression operator* ( Coefficient_traits::const_reference  n,
const Linear_Expression e 
)
related

Returns the linear expression n * e.

Linear_Expression operator* ( const Linear_Expression e,
Coefficient_traits::const_reference  n 
)
related

Returns the linear expression e * n.

Linear_Expression operator* ( const Linear_Expression e,
Coefficient_traits::const_reference  n 
)
related

Definition at line 173 of file Linear_Expression_inlines.hh.

173  {
174  Linear_Expression x = e;
175  x *= n;
176  return x;
177 }
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
Linear_Expression operator* ( Coefficient_traits::const_reference  n,
const Linear_Expression e 
)
related

Definition at line 329 of file Linear_Expression_inlines.hh.

330  {
331  return e * n;
332 }
Linear_Expression operator* ( Coefficient_traits::const_reference  n,
const Linear_Expression e 
)
friend
Linear_Expression operator* ( const Linear_Expression e,
Coefficient_traits::const_reference  n 
)
friend
Linear_Expression & operator*= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
)
related

Returns the linear expression n * e and assigns it to e.

Linear_Expression & operator*= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
)
related

Definition at line 364 of file Linear_Expression_inlines.hh.

References impl.

364  {
365  *e.impl *= n;
366  return e;
367 }
Linear_Expression& operator*= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
)
friend
Linear_Expression operator+ ( const Linear_Expression e1,
const Linear_Expression e2 
)
related

Returns the linear expression e1 + e2.

Linear_Expression operator+ ( Variable  v,
Variable  w 
)
related

Returns the linear expression v + w.

Linear_Expression operator+ ( Variable  v,
const Linear_Expression e 
)
related

Returns the linear expression v + e.

Linear_Expression operator+ ( const Linear_Expression e,
Variable  v 
)
related

Returns the linear expression e + v.

Linear_Expression operator+ ( Coefficient_traits::const_reference  n,
const Linear_Expression e 
)
related

Returns the linear expression n + e.

Linear_Expression operator+ ( const Linear_Expression e,
Coefficient_traits::const_reference  n 
)
related

Returns the linear expression e + n.

Linear_Expression operator+ ( const Linear_Expression e)
related

Returns the linear expression e.

Linear_Expression operator+ ( const Linear_Expression e)
related

Definition at line 118 of file Linear_Expression_inlines.hh.

118  {
119  return e;
120 }
Linear_Expression operator+ ( const Linear_Expression e,
Coefficient_traits::const_reference  n 
)
related

Definition at line 124 of file Linear_Expression_inlines.hh.

124  {
125  Linear_Expression x = e;
126  x += n;
127  return x;
128 }
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
Linear_Expression operator+ ( const Linear_Expression e,
const Variable  v 
)
related

Definition at line 132 of file Linear_Expression_inlines.hh.

132  {
133  Linear_Expression x = e;
134  x += v;
135  return x;
136 }
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
Linear_Expression operator+ ( const Linear_Expression e1,
const Linear_Expression e2 
)
related

Definition at line 226 of file Linear_Expression_inlines.hh.

References space_dimension().

226  {
227  if (e1.space_dimension() >= e2.space_dimension()) {
228  Linear_Expression e = e1;
229  e += e2;
230  return e;
231  }
232  else {
233  Linear_Expression e = e2;
234  e += e1;
235  return e;
236  }
237 }
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
Linear_Expression operator+ ( const Variable  v,
const Linear_Expression e 
)
related

Definition at line 241 of file Linear_Expression_inlines.hh.

241  {
242  return e + v;
243 }
Linear_Expression operator+ ( Coefficient_traits::const_reference  n,
const Linear_Expression e 
)
related

Definition at line 247 of file Linear_Expression_inlines.hh.

248  {
249  return e + n;
250 }
Linear_Expression operator+ ( const Variable  v,
const Variable  w 
)
related

Definition at line 254 of file Linear_Expression_inlines.hh.

References max_space_dimension(), and Parma_Polyhedra_Library::Variable::space_dimension().

254  {
255  const dimension_type v_space_dim = v.space_dimension();
256  const dimension_type w_space_dim = w.space_dimension();
257  const dimension_type space_dim = std::max(v_space_dim, w_space_dim);
258  if (space_dim > Linear_Expression::max_space_dimension()) {
259  throw std::length_error("Linear_Expression "
260  "PPL::operator+(v, w):\n"
261  "v or w exceed the maximum allowed "
262  "space dimension.");
263  }
264  if (v_space_dim >= w_space_dim) {
265  Linear_Expression e(v);
266  e += w;
267  return e;
268  }
269  else {
270  Linear_Expression e(w);
271  e += v;
272  return e;
273  }
274 }
size_t dimension_type
An unsigned integral type for representing space dimensions.
static dimension_type max_space_dimension()
Returns the maximum space dimension a Linear_Expression can handle.
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
Linear_Expression operator+ ( const Linear_Expression e1,
const Linear_Expression e2 
)
friend
Linear_Expression operator+ ( Coefficient_traits::const_reference  n,
const Linear_Expression e 
)
friend
Linear_Expression operator+ ( const Linear_Expression e,
Coefficient_traits::const_reference  n 
)
friend
Linear_Expression operator+ ( Variable  v,
const Linear_Expression e 
)
friend
Linear_Expression operator+ ( Variable  v,
Variable  w 
)
friend
Linear_Expression & operator+= ( Linear_Expression e1,
const Linear_Expression e2 
)
related

Returns the linear expression e1 + e2 and assigns it to e1.

Linear_Expression & operator+= ( Linear_Expression e,
Variable  v 
)
related

Returns the linear expression e + v and assigns it to e.

Exceptions
std::length_errorThrown if the space dimension of v exceeds Linear_Expression::max_space_dimension().
Linear_Expression & operator+= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
)
related

Returns the linear expression e + n and assigns it to e.

Linear_Expression & operator+= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
)
related

Definition at line 181 of file Linear_Expression_inlines.hh.

References impl.

181  {
182  *e.impl += n;
183  return e;
184 }
Linear_Expression & operator+= ( Linear_Expression e1,
const Linear_Expression e2 
)
related

Definition at line 336 of file Linear_Expression_inlines.hh.

References impl.

336  {
337  *e1.impl += *e2.impl;
338  return e1;
339 }
Linear_Expression & operator+= ( Linear_Expression e,
const Variable  v 
)
related

Definition at line 343 of file Linear_Expression_inlines.hh.

References impl.

343  {
344  *e.impl += v;
345  return e;
346 }
Linear_Expression& operator+= ( Linear_Expression e1,
const Linear_Expression e2 
)
friend
Linear_Expression& operator+= ( Linear_Expression e,
Variable  v 
)
friend
Linear_Expression& operator+= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
)
friend
Linear_Expression operator- ( const Linear_Expression e)
related

Returns the linear expression - e.

Linear_Expression operator- ( const Linear_Expression e1,
const Linear_Expression e2 
)
related

Returns the linear expression e1 - e2.

Linear_Expression operator- ( Variable  v,
Variable  w 
)
related

Returns the linear expression v - w.

Linear_Expression operator- ( Variable  v,
const Linear_Expression e 
)
related

Returns the linear expression v - e.

Linear_Expression operator- ( const Linear_Expression e,
Variable  v 
)
related

Returns the linear expression e - v.

Linear_Expression operator- ( Coefficient_traits::const_reference  n,
const Linear_Expression e 
)
related

Returns the linear expression n - e.

Linear_Expression operator- ( const Linear_Expression e,
Coefficient_traits::const_reference  n 
)
related

Returns the linear expression e - n.

Linear_Expression operator- ( const Linear_Expression e,
Coefficient_traits::const_reference  n 
)
related

Definition at line 140 of file Linear_Expression_inlines.hh.

140  {
141  Linear_Expression x = e;
142  x -= n;
143  return x;
144 }
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
Linear_Expression operator- ( const Variable  v,
const Variable  w 
)
related

Definition at line 148 of file Linear_Expression_inlines.hh.

References max_space_dimension(), and Parma_Polyhedra_Library::Variable::space_dimension().

148  {
149  const dimension_type v_space_dim = v.space_dimension();
150  const dimension_type w_space_dim = w.space_dimension();
151  const dimension_type space_dim = std::max(v_space_dim, w_space_dim);
152  if (space_dim > Linear_Expression::max_space_dimension()) {
153  throw std::length_error("Linear_Expression "
154  "PPL::operator+(v, w):\n"
155  "v or w exceed the maximum allowed "
156  "space dimension.");
157  }
158  if (v_space_dim >= w_space_dim) {
159  Linear_Expression e(v);
160  e -= w;
161  return e;
162  }
163  else {
164  Linear_Expression e(w.space_dimension(), true);
165  e -= w;
166  e += v;
167  return e;
168  }
169 }
size_t dimension_type
An unsigned integral type for representing space dimensions.
static dimension_type max_space_dimension()
Returns the maximum space dimension a Linear_Expression can handle.
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
Linear_Expression operator- ( const Linear_Expression e)
related

Definition at line 278 of file Linear_Expression_inlines.hh.

References Parma_Polyhedra_Library::neg_assign().

278  {
279  Linear_Expression r(e);
280  neg_assign(r);
281  return r;
282 }
friend void neg_assign(Linear_Expression &e)
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
Linear_Expression operator- ( const Linear_Expression e1,
const Linear_Expression e2 
)
related

Definition at line 286 of file Linear_Expression_inlines.hh.

References Parma_Polyhedra_Library::neg_assign(), and space_dimension().

286  {
287  if (e1.space_dimension() >= e2.space_dimension()) {
288  Linear_Expression e = e1;
289  e -= e2;
290  return e;
291  }
292  else {
293  Linear_Expression e = e2;
294  neg_assign(e);
295  e += e1;
296  return e;
297  }
298 }
friend void neg_assign(Linear_Expression &e)
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
Linear_Expression operator- ( const Variable  v,
const Linear_Expression e 
)
related

Definition at line 302 of file Linear_Expression_inlines.hh.

References negate(), Parma_Polyhedra_Library::Variable::space_dimension(), and space_dimension().

302  {
303  Linear_Expression result(e, std::max(v.space_dimension(), e.space_dimension()));
304  result.negate(0, e.space_dimension() + 1);
305  result += v;
306  return result;
307 }
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
Linear_Expression operator- ( const Linear_Expression e,
const Variable  v 
)
related

Definition at line 311 of file Linear_Expression_inlines.hh.

References Parma_Polyhedra_Library::Variable::space_dimension(), and space_dimension().

311  {
312  Linear_Expression result(e, std::max(v.space_dimension(), e.space_dimension()));
313  result -= v;
314  return result;
315 }
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
Linear_Expression operator- ( Coefficient_traits::const_reference  n,
const Linear_Expression e 
)
related

Definition at line 319 of file Linear_Expression_inlines.hh.

References Parma_Polyhedra_Library::neg_assign().

320  {
321  Linear_Expression result(e);
322  neg_assign(result);
323  result += n;
324  return result;
325 }
friend void neg_assign(Linear_Expression &e)
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
Linear_Expression operator- ( const Linear_Expression e)
friend
Linear_Expression operator- ( const Linear_Expression e1,
const Linear_Expression e2 
)
friend
Linear_Expression operator- ( Variable  v,
Variable  w 
)
friend
Linear_Expression operator- ( Coefficient_traits::const_reference  n,
const Linear_Expression e 
)
friend
Linear_Expression operator- ( const Linear_Expression e,
Coefficient_traits::const_reference  n 
)
friend
Linear_Expression operator- ( Variable  v,
const Linear_Expression e 
)
friend
Linear_Expression operator- ( const Linear_Expression e,
Variable  v 
)
friend
Linear_Expression & operator-= ( Linear_Expression e1,
const Linear_Expression e2 
)
related

Returns the linear expression e1 - e2 and assigns it to e1.

Linear_Expression & operator-= ( Linear_Expression e,
Variable  v 
)
related

Returns the linear expression e - v and assigns it to e.

Exceptions
std::length_errorThrown if the space dimension of v exceeds Linear_Expression::max_space_dimension().
Linear_Expression & operator-= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
)
related

Returns the linear expression e - n and assigns it to e.

Linear_Expression & operator-= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
)
related

Definition at line 188 of file Linear_Expression_inlines.hh.

References impl.

188  {
189  *e.impl -= n;
190  return e;
191 }
Linear_Expression & operator-= ( Linear_Expression e1,
const Linear_Expression e2 
)
related

Definition at line 350 of file Linear_Expression_inlines.hh.

References impl.

350  {
351  *e1.impl -= *e2.impl;
352  return e1;
353 }
Linear_Expression & operator-= ( Linear_Expression e,
const Variable  v 
)
related

Definition at line 357 of file Linear_Expression_inlines.hh.

References impl.

357  {
358  *e.impl -= v;
359  return e;
360 }
Linear_Expression& operator-= ( Linear_Expression e1,
const Linear_Expression e2 
)
friend
Linear_Expression& operator-= ( Linear_Expression e,
Variable  v 
)
friend
Linear_Expression& operator-= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
)
friend
Linear_Expression & operator/= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
)
related

Returns the linear expression n / e and assigns it to e.

Linear_Expression & operator/= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
)
related

Definition at line 371 of file Linear_Expression_inlines.hh.

References impl.

371  {
372  *e.impl /= n;
373  return e;
374 }
Linear_Expression& operator/= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
)
friend
std::ostream & operator<< ( std::ostream &  s,
const Linear_Expression e 
)
related

Output operator.

std::ostream & operator<< ( std::ostream &  s,
const Linear_Expression e 
)
related

Definition at line 822 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::print().

822  {
823  e.impl->print(s);
824  return s;
825 }
std::ostream& Parma_Polyhedra_Library::IO_Operators::operator<< ( std::ostream &  s,
const Linear_Expression e 
)
friend
friend class PIP_Problem
friend

Definition at line 830 of file Linear_Expression_defs.hh.

friend class PIP_Tree_Node
friend

Definition at line 825 of file Linear_Expression_defs.hh.

friend class Polyhedron
friend

Definition at line 824 of file Linear_Expression_defs.hh.

friend class Scalar_Products
friend

Definition at line 832 of file Linear_Expression_defs.hh.

void sub_mul_assign ( Linear_Expression e1,
Coefficient_traits::const_reference  factor,
const Linear_Expression e2 
)
related

Subtracts e2 multiplied by factor from e1.

Definition at line 408 of file Linear_Expression_inlines.hh.

410  {
411  e1.impl->sub_mul_assign(factor, *e2.impl);
412 }
Linear_Expression & sub_mul_assign ( Linear_Expression e,
Coefficient_traits::const_reference  n,
Variable  v 
)
related

Returns the linear expression e - n * v and assigns it to e.

Linear_Expression & sub_mul_assign ( Linear_Expression e,
Coefficient_traits::const_reference  n,
const Variable  v 
)
related

Definition at line 393 of file Linear_Expression_inlines.hh.

References impl, and Parma_Polyhedra_Library::Linear_Expression_Interface::sub_mul_assign().

395  {
396  e.impl->sub_mul_assign(n, v);
397  return e;
398 }
Linear_Expression& sub_mul_assign ( Linear_Expression e,
Coefficient_traits::const_reference  n,
Variable  v 
)
friend
void sub_mul_assign ( Linear_Expression e1,
Coefficient_traits::const_reference  factor,
const Linear_Expression e2 
)
friend

Definition at line 408 of file Linear_Expression_inlines.hh.

410  {
411  e1.impl->sub_mul_assign(factor, *e2.impl);
412 }
void swap ( Linear_Expression x,
Linear_Expression y 
)
related

Definition at line 831 of file Linear_Expression_inlines.hh.

References m_swap().

831  {
832  x.m_swap(y);
833 }
friend class Termination_Helpers
friend

Definition at line 838 of file Linear_Expression_defs.hh.

Member Data Documentation

const Representation Parma_Polyhedra_Library::Linear_Expression::default_representation = SPARSE
static

Definition at line 291 of file Linear_Expression_defs.hh.

const PPL::Linear_Expression * Parma_Polyhedra_Library::Linear_Expression::zero_p = 0
staticprivate

Holds (between class initialization and finalization) a pointer to the (zero-dimension space) constant 0.

Definition at line 654 of file Linear_Expression_defs.hh.

Referenced by zero().


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