24 #ifndef PPL_Linear_Expression_Impl_inlines_hh
25 #define PPL_Linear_Expression_Impl_inlines_hh 1
32 template <
typename Row>
35 return Row::max_size() - 1;
38 template <
typename Row>
45 template <
typename Row>
49 : row(space_dim + 1) {
53 template <
typename Row>
58 template <
typename Row>
69 template <
typename Row>
72 return row.size() - 1;
75 template <
typename Row>
82 template <
typename Row>
83 inline Coefficient_traits::const_reference
88 return row.get(v.
id() + 1);
91 template <
typename Row>
106 template <
typename Row>
107 inline Coefficient_traits::const_reference
112 template <
typename Row>
125 template <
typename Row>
132 template <
typename Row>
140 template <
typename Row>
143 return row.external_memory_in_bytes();
146 template <
typename Row>
152 template <
typename Row>
155 typename Row::iterator itr = row.insert(0);
164 template <
typename Row>
167 typename Row::iterator itr = row.insert(0);
176 template <
typename Row>
186 return row.num_stored_elements() == 0;
192 return row.lower_bound(1) == row.end();
199 return row.lower_bound(start) == row.lower_bound(end);
206 PPL_ASSERT(start <= end);
208 - std::distance(row.lower_bound(start), row.lower_bound(end));
214 if (row.num_stored_elements() == 0) {
226 PPL_ASSERT(first <= last);
227 PPL_ASSERT(last <= row.size());
230 if (i != row.end() && i.index() < last) {
242 PPL_ASSERT(first <= last);
243 PPL_ASSERT(last <= row.size());
281 namespace IO_Operators {
283 template <
typename Row>
285 operator<<(std::ostream& s, const Linear_Expression_Impl<Row>& e) {
294 #endif // !defined(PPL_Linear_Expression_Impl_inlines_hh)
virtual Linear_Expression_Impl & operator+=(Coefficient_traits::const_reference n)
dimension_type index() const
Returns the index of the element pointed to by *this.
virtual dimension_type first_nonzero(dimension_type first, dimension_type last) const
size_t dimension_type
An unsigned integral type for representing space dimensions.
virtual Coefficient_traits::const_reference inhomogeneous_term() const
Returns the inhomogeneous term of *this.
virtual void set_inhomogeneous_term(Coefficient_traits::const_reference n)
Sets the inhomogeneous term of *this to n.
virtual void swap_space_dimensions(Variable v1, Variable v2)
Swaps the coefficients of the variables v1 and v2 .
virtual bool OK() const
Checks if all the invariants are satisfied.
static dimension_type max_space_dimension()
Returns the maximum space dimension a Linear_Expression_Impl can handle.
virtual void set_coefficient(Variable v, Coefficient_traits::const_reference n)
Sets the coefficient of v in *this to n.
virtual Linear_Expression_Impl & operator-=(Coefficient_traits::const_reference n)
dimension_type id() const
Returns the index of the Cartesian axis associated to the variable.
virtual dimension_type num_zeroes(dimension_type start, dimension_type end) const
Returns the number of zero coefficient in [start, end).
void skip_zeroes_backward()
A dimension of the vector space.
virtual memory_size_type total_memory_in_bytes() const
Returns a lower bound to the total size in bytes of the memory occupied by *this. ...
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
virtual memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
virtual bool is_zero() const
Returns true if and only if *this is .
virtual void set_space_dimension(dimension_type n)
Sets the dimension of the vector space enclosing *this to n .
Enable_If< Is_Native< T >::value, memory_size_type >::type external_memory_in_bytes(const T &)
For native types, returns the size in bytes of the memory managed by the type of the (unused) paramet...
void skip_zeroes_forward()
Linear_Expression_Impl()
Default constructor: returns a copy of Linear_Expression_Impl::zero().
virtual ~Linear_Expression_Impl()
Destructor.
virtual void shift_space_dimensions(Variable v, dimension_type n)
Coefficient_traits::const_reference Coefficient_zero()
Returns a const reference to a Coefficient with value 0.
The entire library is confined to this namespace.
A const iterator on the tree elements, ordered by key.
virtual dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
virtual Coefficient_traits::const_reference coefficient(Variable v) const
Returns the coefficient of v in *this.
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...
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
virtual bool all_zeroes(const Variables_Set &vars) const
Returns true if the coefficient of each variable in vars[i] is .
virtual bool all_homogeneous_terms_are_zero() const
Returns true if and only if all the homogeneous terms of *this are .
virtual Representation representation() const
Returns the current representation of this linear expression.
virtual dimension_type last_nonzero() const