24 #ifndef PPL_Linear_Expression_defs_hh
25 #define PPL_Linear_Expression_defs_hh 1
63 operator+(
const Linear_Expression& e1,
const Linear_Expression& e2);
73 operator+(Variable v,
const Linear_Expression& e);
78 operator+(
const Linear_Expression& e, Variable v);
83 operator+(Coefficient_traits::const_reference n,
const Linear_Expression& e);
88 operator+(
const Linear_Expression& e, Coefficient_traits::const_reference n);
103 operator-(
const Linear_Expression& e1,
const Linear_Expression& e2);
113 operator-(Variable v,
const Linear_Expression& e);
118 operator-(
const Linear_Expression& e, Variable v);
123 operator-(Coefficient_traits::const_reference n,
const Linear_Expression& e);
128 operator-(
const Linear_Expression& e, Coefficient_traits::const_reference n);
133 operator*(Coefficient_traits::const_reference n,
const Linear_Expression& e);
138 operator*(
const Linear_Expression& e, Coefficient_traits::const_reference n);
143 operator+=(Linear_Expression& e1,
const Linear_Expression& e2);
152 operator+=(Linear_Expression& e, Variable v);
157 operator+=(Linear_Expression& e, Coefficient_traits::const_reference n);
162 operator-=(Linear_Expression& e1,
const Linear_Expression& e2);
171 operator-=(Linear_Expression& e, Variable v);
176 operator-=(Linear_Expression& e, Coefficient_traits::const_reference n);
181 operator*=(Linear_Expression& e, Coefficient_traits::const_reference n);
186 operator/=(Linear_Expression& e, Coefficient_traits::const_reference n);
197 Coefficient_traits::const_reference n, Variable v);
202 Coefficient_traits::const_reference factor,
203 const Linear_Expression& e2);
208 Coefficient_traits::const_reference factor,
209 const Linear_Expression& e2);
215 Coefficient_traits::const_reference n, Variable v);
217 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
229 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
230 int compare(
const Linear_Expression& x,
const Linear_Expression& y);
232 namespace IO_Operators {
236 std::ostream&
operator<<(std::ostream& s,
const Linear_Expression& e);
315 template <
typename LE_Adapter>
326 template <
typename LE_Adapter>
341 template <
typename LE_Adapter>
354 template <
typename LE_Adapter>
512 Coefficient_traits::const_reference n);
540 Coefficient_traits::const_reference c1,
541 Coefficient_traits::const_reference c2);
546 Coefficient_traits::const_reference c1,
547 Coefficient_traits::const_reference c2);
682 Coefficient_traits::const_reference
get(
Variable v)
const;
688 void set(
Variable v, Coefficient_traits::const_reference n);
730 Coefficient_traits::const_reference c1,
731 Coefficient_traits::const_reference c2,
737 Coefficient_traits::const_reference c1,
738 Coefficient_traits::const_reference c2,
742 void mul_assign(Coefficient_traits::const_reference n,
790 Coefficient_traits::const_reference c1,
791 Coefficient_traits::const_reference c2,
814 template <
typename Row>
839 template <
typename T>
841 template <
typename T>
843 template <
typename T>
845 template <
typename T>
847 template <
typename T>
849 template <
typename T>
851 template <
typename T>
910 Coefficient_traits::const_reference n,
Variable v);
913 Coefficient_traits::const_reference n,
Variable v);
917 Coefficient_traits::const_reference factor,
921 Coefficient_traits::const_reference factor,
947 #endif // !defined(PPL_Linear_Expression_defs_hh)
Enable_If< Is_Singleton< T >::value, Interval< B, Info > >::type operator*(const Interval< B, Info > &x, const T &y)
Linear_Expression raw_type
bool operator==(const const_iterator &i) const
Compares *this with i.
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...
A linear equality or inequality.
const_iterator begin() const
void swap(CO_Tree &x, CO_Tree &y)
void set_space_dimension(dimension_type n)
Sets the dimension of the vector space enclosing *this to n .
The base class for systems of constraints and generators.
A finite sequence of coefficients.
size_t dimension_type
An unsigned integral type for representing space dimensions.
An std::set of variables' indexes.
An adapter for Linear_Expression objects.
void set(dimension_type i, Coefficient_traits::const_reference n)
Sets the i-th coefficient to n.
A line, ray, point or closure point.
Variable variable() const
Returns the variable of the coefficient pointed to by *this.
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
Coefficient_traits::const_reference inhomogeneous_term() const
Returns the inhomogeneous term of *this.
const Coefficient value_type
friend Linear_Expression operator+(const Linear_Expression &e1, const Linear_Expression &e2)
friend Linear_Expression & operator+=(Linear_Expression &e1, const Linear_Expression &e2)
const Linear_Expression & const_reference
void add_mul_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
Linear_Expression & operator=(const Linear_Expression &e)
Assignment operator.
std::ostream & operator<<(std::ostream &s, const Ask_Tell< D > &x)
A finite sparse sequence of coefficients.
dimension_type last_nonzero() const
friend Linear_Expression & operator/=(Linear_Expression &e, Coefficient_traits::const_reference n)
Linear_Expression_Interface::const_iterator_interface * itr
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
bool OK() const
Checks if all the invariants are satisfied.
void set_coefficient(Variable v, Coefficient_traits::const_reference n)
Sets the coefficient of v in *this to n.
void set_inhomogeneous_term(Coefficient_traits::const_reference n)
Sets the inhomogeneous term of *this to n.
Linear_Expression_Interface * impl
const_iterator & operator--()
Navigates to the previous nonzero coefficient.
A Parametric Integer (linear) Programming problem.
void get_row(Dense_Row &r) const
Sets r to a copy of the row that implements *this.
static void finalize()
Finalizes the class.
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...
bool is_equal_to(const Linear_Expression &x) const
Coefficient_traits::const_reference coefficient(Variable v) const
Returns the coefficient of v in *this.
friend Linear_Expression & operator*=(Linear_Expression &e, Coefficient_traits::const_reference n)
A dimension of the vector space.
friend Linear_Expression operator*(Coefficient_traits::const_reference n, const Linear_Expression &e)
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 coeffi...
The base class for convex polyhedra.
void negate(dimension_type first, dimension_type last)
Negates the elements from index first (included) to index last (excluded).
static dimension_type max_space_dimension()
Returns the maximum space dimension a Linear_Expression can handle.
#define PPL_OUTPUT_DECLARATIONS
void permute_space_dimensions(const std::vector< Variable > &cycle)
Permutes the space dimensions of the expression.
bool all_zeroes(const Variables_Set &vars) const
Returns true if the coefficient of each variable in vars[i] is .
static void initialize()
Initializes the class.
friend Linear_Expression & sub_mul_assign(Linear_Expression &e, Coefficient_traits::const_reference n, Variable v)
void set_representation(Representation r)
Converts *this to the specified representation.
memory_size_type total_memory_in_bytes() const
Returns a lower bound to the total size in bytes of the memory occupied by *this. ...
A class holding a constant called value that evaluates to true if and only if Base is the same type a...
const_iterator & operator=(const const_iterator &i)
Assigns i to *this .
A Mixed Integer (linear) Programming problem.
void m_swap(const_iterator &i)
Swaps i with *this.
friend int compare(const Linear_Expression &x, const Linear_Expression &y)
~Linear_Expression()
Destructor.
A not necessarily closed, iso-oriented hyperrectangle.
const_iterator & operator++()
Navigates to the next nonzero coefficient.
PPL_COEFFICIENT_TYPE Coefficient
An alias for easily naming the type of PPL coefficients.
void swap_space_dimensions(Variable v1, Variable v2)
Swaps the coefficients of the variables v1 and v2 .
bool all_homogeneous_terms_are_zero() const
Returns true if and only if all the homogeneous terms of *this are .
friend void neg_assign(Linear_Expression &e)
int compare(const Linear_Expression &x, const Linear_Expression &y)
void linear_combine_lax(const Linear_Expression &y, Coefficient_traits::const_reference c1, Coefficient_traits::const_reference c2)
void remove_space_dimensions(const Variables_Set &vars)
Removes all the specified dimensions from the expression.
const_iterator()
Constructs an invalid const_iterator.
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.
void neg_assign(GMP_Integer &x)
The convergence certificate for the BHRZ03 widening operator.
The entire library is confined to this namespace.
Representation representation() const
Returns the current representation of *this.
Enable_If< Is_Singleton< T >::value, Interval< B, Info > >::type operator+(const Interval< B, Info > &x, const T &y)
friend Linear_Expression & operator-=(Linear_Expression &e1, const Linear_Expression &e2)
static const Representation default_representation
An adapter for Linear_Expression that hides the inhomogeneous term.
A bounded difference shape.
static const Linear_Expression * zero_p
Holds (between class initialization and finalization) a pointer to the (zero-dimension space) constan...
int scalar_product_sign(const Linear_Expression &y) const
Computes the sign of the sum of (*this)[i]*y[i], for each i.
bool is_zero() const
Returns true if and only if *this is .
const_iterator end() const
Adapters' base type (for template meta-programming).
void sub_mul_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
Coefficient_traits::const_reference reference
Sparse representation: only the nonzero coefficient are stored. If there are many nonzero coefficient...
void exact_div_assign(Coefficient_traits::const_reference c, dimension_type start, dimension_type end)
Enable_If< Is_Singleton< T >::value, Interval< B, Info > >::type operator-(const Interval< B, Info > &x, const T &y)
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
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).
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 linear_combine(const Linear_Expression &y, Variable v)
dimension_type first_nonzero(dimension_type first, dimension_type last) const
static const Linear_Expression & zero()
Returns the (zero-dimension space) constant 0.
std::bidirectional_iterator_tag iterator_category
std::ptrdiff_t difference_type
A class that provides a type member called type equivalent to T if and only if b is true...
A node of the PIP solution tree.
dimension_type num_zeroes(dimension_type start, dimension_type end) const
Returns the number of zero coefficient in [start, end).
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
friend Linear_Expression operator-(const Linear_Expression &e)
reference operator*() const
Returns the current element.
void m_swap(Linear_Expression &y)
Swaps *this with y.
const_iterator lower_bound(Variable v) const
An adapter for Linear_Expression that maybe hides the last coefficient.
friend Linear_Expression & add_mul_assign(Linear_Expression &e, Coefficient_traits::const_reference n, Variable v)
A grid line, parameter or grid point.
Linear_Expression(Representation r=default_representation)
Default constructor: returns a copy of Linear_Expression::zero().
A class implementing various scalar product functions.
bool operator!=(const const_iterator &i) const
Compares *this with i .
void shift_space_dimensions(Variable v, dimension_type n)