Parma_Polyhedra_Library::Linear_Expression Class Reference
[C++ Language Interface]

A linear expression. More...

#include <Linear_Expression.defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::Linear_Expression:
Inheritance graph
[legend]
Collaboration diagram for Parma_Polyhedra_Library::Linear_Expression:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Linear_Expression ()
 Default constructor: returns a copy of Linear_Expression::zero().
 Linear_Expression (const Linear_Expression &e)
 Ordinary copy constructor.
 ~Linear_Expression ()
 Destructor.
 Linear_Expression (Coefficient_traits::const_reference n)
 Builds the linear expression corresponding to the inhomogeneous term n.
 Linear_Expression (Variable v)
 Builds the linear expression corresponding to the variable v.
 Linear_Expression (const Constraint &c)
 Builds the linear expression corresponding to constraint c.
 Linear_Expression (const Generator &g)
 Builds the linear expression corresponding to generator g (for points and closure points, the divisor is not copied).
 Linear_Expression (const Grid_Generator &g)
 Builds the linear expression corresponding to grid generator g (for points, parameters and lines the divisor is not copied).
 Linear_Expression (const Congruence &cg)
 Builds the linear expression corresponding to congruence cg.
dimension_type space_dimension () const
 Returns the dimension of the vector space enclosing *this.
Coefficient_traits::const_reference coefficient (Variable v) const
 Returns the coefficient of v in *this.
Coefficient_traits::const_reference inhomogeneous_term () const
 Returns the inhomogeneous term of *this.
bool is_zero () const
 Returns true if and only if *this is $0$.
bool all_homogeneous_terms_are_zero () const
 Returns true if and only if all the homogeneous terms of *this are $0$.
memory_size_type total_memory_in_bytes () const
 Returns a lower bound to the total size in bytes of the memory occupied by *this.
memory_size_type external_memory_in_bytes () const
 Returns the size in bytes of the memory managed by *this.
void ascii_dump () const
 Writes to std::cerr an ASCII representation of *this.
void ascii_dump (std::ostream &s) const
 Writes to s an ASCII representation of *this.
void print () const
 Prints *this to std::cerr using operator<<.
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.
bool OK () const
 Checks if all the invariants are satisfied.
void swap (Linear_Expression &y)
 Swaps *this with y.

Static Public Member Functions

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

Private Member Functions

 Linear_Expression (const Linear_Expression &e, dimension_type sz)
 Copy constructor with a specified space dimension.
 Linear_Expression (dimension_type sz, bool)
 Implementation sizing constructor.
 Linear_Expression (Variable v, Variable w)
 Builds the linear expression corresponding to the difference of v and w.

Static Private Attributes

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

Friends

class Parma_Polyhedra_Library::Scalar_Products
class Parma_Polyhedra_Library::Constraint
class Parma_Polyhedra_Library::Generator
class Parma_Polyhedra_Library::Grid_Generator
class Parma_Polyhedra_Library::Congruence
class Parma_Polyhedra_Library::Polyhedron
class Parma_Polyhedra_Library::Grid
class Parma_Polyhedra_Library::Constraint_System
class Parma_Polyhedra_Library::Generator_System
class Parma_Polyhedra_Library::Congruence_System
class Parma_Polyhedra_Library::Grid_Generator_System
Linear_Expression operator+ (const Linear_Expression &e1, const Linear_Expression &e2)
 Returns the linear expression e1 + e2.
Linear_Expression operator+ (Coefficient_traits::const_reference n, const Linear_Expression &e)
 Returns the linear expression n + e.
Linear_Expression operator+ (const Linear_Expression &e, Coefficient_traits::const_reference n)
 Returns the linear expression e + n.
Linear_Expression operator+ (Variable v, const Linear_Expression &e)
 Returns the linear expression v + e.
Linear_Expression operator+ (Variable v, Variable w)
 Returns the linear expression v + w.
Linear_Expression operator- (const Linear_Expression &e)
 Returns the linear expression - e.
Linear_Expression operator- (const Linear_Expression &e1, const Linear_Expression &e2)
 Returns the linear expression e1 - e2.
Linear_Expression operator- (Variable v, Variable w)
 Returns the linear expression v - w.
Linear_Expression operator- (Coefficient_traits::const_reference n, const Linear_Expression &e)
 Returns the linear expression n - e.
Linear_Expression operator- (const Linear_Expression &e, Coefficient_traits::const_reference n)
 Returns the linear expression e - n.
Linear_Expression operator- (Variable v, const Linear_Expression &e)
 Returns the linear expression v - e.
Linear_Expression operator- (const Linear_Expression &e, Variable v)
 Returns the linear expression e - v.
Linear_Expression operator* (Coefficient_traits::const_reference n, const Linear_Expression &e)
 Returns the linear expression n * e.
Linear_Expression operator* (const Linear_Expression &e, Coefficient_traits::const_reference n)
 Returns the linear expression e * n.
Linear_Expressionoperator+= (Linear_Expression &e1, const Linear_Expression &e2)
 Returns the linear expression e1 + e2 and assigns it to e1.
Linear_Expressionoperator+= (Linear_Expression &e, Variable v)
 Returns the linear expression e + v and assigns it to e.
Linear_Expressionoperator+= (Linear_Expression &e, Coefficient_traits::const_reference n)
 Returns the linear expression e + n and assigns it to e.
Linear_Expressionoperator-= (Linear_Expression &e1, const Linear_Expression &e2)
 Returns the linear expression e1 - e2 and assigns it to e1.
Linear_Expressionoperator-= (Linear_Expression &e, Variable v)
 Returns the linear expression e - v and assigns it to e.
Linear_Expressionoperator-= (Linear_Expression &e, Coefficient_traits::const_reference n)
 Returns the linear expression e - n and assigns it to e.
Linear_Expressionoperator*= (Linear_Expression &e, Coefficient_traits::const_reference n)
 Returns the linear expression n * e and assigns it to e.
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.
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.
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 &e, Variable v)
 Returns the linear expression e + v.
Linear_Expression operator+ (const Linear_Expression &e)
 Returns the linear expression e.
std::ostream & operator<< (std::ostream &s, const Linear_Expression &e)
 Output operator.
void swap (Parma_Polyhedra_Library::Linear_Expression &x, Parma_Polyhedra_Library::Linear_Expression &y)
 Specializes std::swap.

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:
  Linear_Expression e1 = 4*x;
  Linear_Expression e2 = 2*y;
  Linear_Expression e3 = z;
  Linear_Expression e = Linear_Expression(14);
  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 249 of file Linear_Expression.defs.hh.


Constructor & Destructor Documentation

Parma_Polyhedra_Library::Linear_Expression::Linear_Expression (  )  [inline]

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

Definition at line 39 of file Linear_Expression.inlines.hh.

Referenced by initialize().

00040   : Linear_Row(1, Linear_Row::Flags()) {
00041 }

Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( const Linear_Expression e  )  [inline]

Ordinary copy constructor.

Definition at line 49 of file Linear_Expression.inlines.hh.

00050   : Linear_Row(e) {
00051 }

Parma_Polyhedra_Library::Linear_Expression::~Linear_Expression (  )  [inline]

Destructor.

Definition at line 54 of file Linear_Expression.inlines.hh.

00054                                       {
00055 }

Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( Coefficient_traits::const_reference  n  )  [inline, explicit]

Builds the linear expression corresponding to the inhomogeneous term n.

Definition at line 64 of file Linear_Expression.inlines.hh.

00065   : Linear_Row(1, Linear_Row::Flags()) {
00066   (*this)[0] = n;
00067 }

Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( Variable  v  ) 

Builds the linear expression corresponding to the variable v.

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

Definition at line 82 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::Variable::space_dimension().

00083   : Linear_Row(v.space_dimension() <= max_space_dimension()
00084                ? v.space_dimension() + 1
00085                : (throw std::length_error("PPL::Linear_Expression::"
00086                                           "Linear_Expression(v):\n"
00087                                           "v exceeds the maximum allowed "
00088                                           "space dimension."),
00089                   v.space_dimension() + 1)
00090                , Linear_Row::Flags()) {
00091   ++((*this)[v.space_dimension()]);
00092 }

Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( const Constraint c  )  [explicit]

Builds the linear expression corresponding to constraint c.

Given the constraint $c = \bigl(\sum_{i=0}^{n-1} a_i x_i + b \relsym 0\bigr)$, where $\mathord{\relsym} \in \{ =, \geq, > \}$, this builds the linear expression $\sum_{i=0}^{n-1} a_i x_i + b$. If c is an inequality (resp., equality) constraint, then the built linear expression is unique up to a positive (resp., non-zero) factor.

Definition at line 37 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::Row::size().

00038   : Linear_Row(c.space_dimension() + 1, Linear_Row::Flags()) {
00039   Linear_Expression& e = *this;
00040   for (dimension_type i = size(); i-- > 0; )
00041     e[i] = c[i];
00042 }

Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( const Generator g  )  [explicit]

Builds the linear expression corresponding to generator g (for points and closure points, the divisor is not copied).

Given the generator $g = (\frac{a_0}{d}, \ldots, \frac{a_{n-1}}{d})^\transpose$ (where, for lines and rays, we have $d = 1$), this builds the linear expression $\sum_{i=0}^{n-1} a_i x_i$. The inhomogeneous term of the linear expression will always be 0. If g is a ray, point or closure point (resp., a line), then the linear expression is unique up to a positive (resp., non-zero) factor.

Definition at line 44 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::Row::size().

00045   : Linear_Row(g.space_dimension() + 1, Linear_Row::Flags()) {
00046   Linear_Expression& e = *this;
00047   // Do not copy the divisor of `g'.
00048   for (dimension_type i = size(); --i > 0; )
00049     e[i] = g[i];
00050 }

Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( const Grid_Generator g  )  [explicit]

Builds the linear expression corresponding to grid generator g (for points, parameters and lines the divisor is not copied).

Given the grid generator $g = (\frac{a_0}{d}, \ldots, \frac{a_{n-1}}{d})^\transpose$ this builds the linear expression $\sum_{i=0}^{n-1} a_i x_i$. The inhomogeneous term of the linear expression is always 0.

Definition at line 52 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::Row::size().

00053   : Linear_Row(g.space_dimension() + 1, Linear_Row::Flags()) {
00054   Linear_Expression& e = *this;
00055   // Do not copy the divisor of `g'.
00056   for (dimension_type i = size(); --i > 0; )
00057     e[i] = g[i];
00058 }

Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( const Congruence cg  )  [explicit]

Builds the linear expression corresponding to congruence cg.

Given the congruence $cg = \bigl(\sum_{i=0}^{n-1} a_i x_i + b = 0 \pmod{m}\bigr)$, this builds the linear expression $\sum_{i=0}^{n-1} a_i x_i + b$.

Definition at line 75 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::Row::size().

00076   : Linear_Row(cg.space_dimension() + 1, Linear_Row::Flags()) {
00077   Linear_Expression& e = *this;
00078   for (dimension_type i = size(); i-- > 0; )
00079     e[i] = cg[i];
00080 }

Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( const Linear_Expression e,
dimension_type  sz 
) [inline, private]

Copy constructor with a specified space dimension.

Definition at line 58 of file Linear_Expression.inlines.hh.

00060   : Linear_Row(e, sz, sz) {
00061 }

Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( dimension_type  sz,
bool   
) [inline, 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 44 of file Linear_Expression.inlines.hh.

00045   : Linear_Row(sz, Linear_Row::Flags()) {
00046 }

Parma_Polyhedra_Library::Linear_Expression::Linear_Expression ( Variable  v,
Variable  w 
) [private]

Builds the linear expression corresponding to the difference of v and w.

Exceptions:
std::length_error Thrown if the space dimension of v or the one of w exceed Linear_Expression::max_space_dimension().

Definition at line 94 of file Linear_Expression.cc.

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

00095   : Linear_Row() {
00096   const dimension_type v_space_dim = v.space_dimension();
00097   const dimension_type w_space_dim = w.space_dimension();
00098   const dimension_type space_dim = std::max(v_space_dim, w_space_dim);
00099   if (space_dim > max_space_dimension())
00100     throw std::length_error("PPL::Linear_Expression::"
00101                             "Linear_Expression(v, w):\n"
00102                             "v or w exceed the maximum allowed "
00103                             "space dimension.");
00104   construct(space_dim+1, Linear_Row::Flags());
00105   if (v_space_dim != w_space_dim) {
00106     ++((*this)[v_space_dim]);
00107     --((*this)[w_space_dim]);
00108   }
00109 }


Member Function Documentation

bool Parma_Polyhedra_Library::Linear_Expression::all_homogeneous_terms_are_zero (  )  const [inline]

Returns true if and only if all the homogeneous terms of *this are $0$.

Reimplemented from Parma_Polyhedra_Library::Linear_Row.

Definition at line 92 of file Linear_Expression.inlines.hh.

Referenced by Parma_Polyhedra_Library::Polyhedron::BHRZ03_combining_constraints(), and Parma_Polyhedra_Library::Grid::Grid().

00092                                                         {
00093   return Linear_Row::all_homogeneous_terms_are_zero();
00094 }

void Parma_Polyhedra_Library::Linear_Expression::ascii_dump ( std::ostream &  s  )  const [inline]

Writes to s an ASCII representation of *this.

Reimplemented from Parma_Polyhedra_Library::Linear_Row.

Reimplemented in Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter.

Definition at line 168 of file Linear_Expression.inlines.hh.

References ascii_dump().

00168                                                  {
00169   Linear_Row::ascii_dump(s);
00170 }

void Parma_Polyhedra_Library::Linear_Expression::ascii_dump (  )  const

Writes to std::cerr an ASCII representation of *this.

Reimplemented from Parma_Polyhedra_Library::Linear_Row.

Reimplemented in Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter.

Referenced by Parma_Polyhedra_Library::MIP_Problem::ascii_dump(), and ascii_dump().

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.

Reimplemented from Parma_Polyhedra_Library::Linear_Row.

Reimplemented in Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter.

Definition at line 173 of file Linear_Expression.inlines.hh.

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

00173                                            {
00174   return Linear_Row::ascii_load(s);
00175 }

Coefficient_traits::const_reference Parma_Polyhedra_Library::Linear_Expression::coefficient ( Variable  v  )  const [inline]

Returns the coefficient of v in *this.

Definition at line 75 of file Linear_Expression.inlines.hh.

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

Referenced by Parma_Polyhedra_Library::Polyhedron::affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_image(), Parma_Polyhedra_Library::Box< ITV >::affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::affine_image(), Parma_Polyhedra_Library::Polyhedron::affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter::Artificial_Parameter(), Parma_Polyhedra_Library::Polyhedron::bounded_affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::Box< ITV >::bounded_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::Polyhedron::bounded_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounded_affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::bounded_affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::bounded_affine_preimage(), 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::MIP_Problem::evaluate_objective_function(), Parma_Polyhedra_Library::Octagonal_Shape< T >::frequency(), Parma_Polyhedra_Library::Box< ITV >::frequency(), Parma_Polyhedra_Library::BD_Shape< T >::frequency(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::Grid::generalized_affine_image(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Grid::generalized_affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Grid::Grid(), Parma_Polyhedra_Library::Octagonal_Shape< T >::max_min(), Parma_Polyhedra_Library::Box< ITV >::max_min(), Parma_Polyhedra_Library::BD_Shape< T >::max_min(), Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter::operator==(), Parma_Polyhedra_Library::MIP_Problem::process_pending_constraints(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine(), Parma_Polyhedra_Library::BD_Shape< T >::refine(), Parma_Polyhedra_Library::MIP_Problem::second_phase(), and Parma_Polyhedra_Library::Grid::simplify_using_context_assign().

00075                                                {
00076   if (v.space_dimension() > space_dimension())
00077     return Coefficient_zero();
00078   return Linear_Row::coefficient(v.id());
00079 }

memory_size_type Parma_Polyhedra_Library::Linear_Expression::external_memory_in_bytes (  )  const [inline]

Returns the size in bytes of the memory managed by *this.

Reimplemented from Parma_Polyhedra_Library::Row.

Reimplemented in Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter.

Definition at line 103 of file Linear_Expression.inlines.hh.

Referenced by Parma_Polyhedra_Library::MIP_Problem::external_memory_in_bytes().

00103                                                   {
00104   return Linear_Row::external_memory_in_bytes();
00105 }

void Parma_Polyhedra_Library::Linear_Expression::finalize (  )  [static]

Finalizes the class.

Definition at line 69 of file Linear_Expression.cc.

References zero_p.

00069                                {
00070   PPL_ASSERT(zero_p != 0);
00071   delete zero_p;
00072   zero_p = 0;
00073 }

Coefficient_traits::const_reference Parma_Polyhedra_Library::Linear_Expression::inhomogeneous_term (  )  const [inline]

Returns the inhomogeneous term of *this.

Reimplemented from Parma_Polyhedra_Library::Linear_Row.

Definition at line 82 of file Linear_Expression.inlines.hh.

Referenced by Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_image(), Parma_Polyhedra_Library::Box< ITV >::affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter::Artificial_Parameter(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::MIP_Problem::evaluate_objective_function(), Parma_Polyhedra_Library::Polyhedron::frequency(), Parma_Polyhedra_Library::Octagonal_Shape< T >::frequency(), Parma_Polyhedra_Library::Box< ITV >::frequency(), Parma_Polyhedra_Library::BD_Shape< T >::frequency(), Parma_Polyhedra_Library::Grid::frequency_no_check(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Polyhedron::max_min(), Parma_Polyhedra_Library::Octagonal_Shape< T >::max_min(), Parma_Polyhedra_Library::Grid::max_min(), Parma_Polyhedra_Library::Box< ITV >::max_min(), Parma_Polyhedra_Library::BD_Shape< T >::max_min(), Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter::operator==(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine(), Parma_Polyhedra_Library::BD_Shape< T >::refine(), Parma_Polyhedra_Library::MIP_Problem::second_phase(), and Parma_Polyhedra_Library::Grid::simplify_using_context_assign().

00082                                             {
00083   return Linear_Row::inhomogeneous_term();
00084 }

void Parma_Polyhedra_Library::Linear_Expression::initialize (  )  [static]

Initializes the class.

Definition at line 63 of file Linear_Expression.cc.

References Parma_Polyhedra_Library::Coefficient_zero(), Linear_Expression(), and zero_p.

00063                                  {
00064   PPL_ASSERT(zero_p == 0);
00065   zero_p = new Linear_Expression(Coefficient_zero());
00066 }

bool Parma_Polyhedra_Library::Linear_Expression::is_zero (  )  const [inline]

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

Reimplemented from Parma_Polyhedra_Library::Linear_Row.

Definition at line 87 of file Linear_Expression.inlines.hh.

00087                                  {
00088   return Linear_Row::is_zero();
00089 }

dimension_type Parma_Polyhedra_Library::Linear_Expression::max_space_dimension (  )  [inline, static]

Returns the maximum space dimension a Linear_Expression can handle.

Reimplemented from Parma_Polyhedra_Library::Linear_Row.

Definition at line 34 of file Linear_Expression.inlines.hh.

Referenced by Linear_Expression().

00034                                        {
00035   return Linear_Row::max_space_dimension();
00036 }

bool Parma_Polyhedra_Library::Linear_Expression::OK (  )  const

Checks if all the invariants are satisfied.

Reimplemented from Parma_Polyhedra_Library::Linear_Row.

Reimplemented in Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter.

Definition at line 397 of file Linear_Expression.cc.

Referenced by Parma_Polyhedra_Library::MIP_Problem::OK().

00397                                {
00398   return Linear_Row::OK();
00399 }

void Parma_Polyhedra_Library::Linear_Expression::print (  )  const

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

Reimplemented from Parma_Polyhedra_Library::Linear_Row.

Reimplemented in Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter.

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

Returns the dimension of the vector space enclosing *this.

Reimplemented from Parma_Polyhedra_Library::Linear_Row.

Definition at line 70 of file Linear_Expression.inlines.hh.

References Parma_Polyhedra_Library::Row::size().

Referenced by Parma_Polyhedra_Library::Polyhedron::affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_image(), Parma_Polyhedra_Library::Grid::affine_image(), 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::BD_Shape< T >::affine_image(), Parma_Polyhedra_Library::Polyhedron::affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::Grid::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::BD_Shape< T >::affine_preimage(), Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter::Artificial_Parameter(), Parma_Polyhedra_Library::Polyhedron::bounded_affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::Grid::bounded_affine_image(), Parma_Polyhedra_Library::Box< ITV >::bounded_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::bounded_affine_image(), Parma_Polyhedra_Library::Polyhedron::bounded_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounded_affine_preimage(), Parma_Polyhedra_Library::Grid::bounded_affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::bounded_affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::bounded_affine_preimage(), Parma_Polyhedra_Library::Polyhedron::bounds(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounds(), Parma_Polyhedra_Library::Grid::bounds(), Parma_Polyhedra_Library::Box< ITV >::bounds(), Parma_Polyhedra_Library::BD_Shape< T >::bounds(), Parma_Polyhedra_Library::Grid::bounds_no_check(), coefficient(), Parma_Polyhedra_Library::Congruence::create(), Parma_Polyhedra_Library::MIP_Problem::evaluate_objective_function(), Parma_Polyhedra_Library::Polyhedron::frequency(), Parma_Polyhedra_Library::Octagonal_Shape< T >::frequency(), Parma_Polyhedra_Library::Grid::frequency(), Parma_Polyhedra_Library::Box< ITV >::frequency(), Parma_Polyhedra_Library::BD_Shape< T >::frequency(), Parma_Polyhedra_Library::Grid::frequency_no_check(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_image(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::Grid::generalized_affine_image(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_image(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_image(), Parma_Polyhedra_Library::Polyhedron::generalized_affine_preimage(), Parma_Polyhedra_Library::Octagonal_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Grid::generalized_affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::generalized_affine_preimage(), Parma_Polyhedra_Library::BD_Shape< T >::generalized_affine_preimage(), Parma_Polyhedra_Library::Polyhedron::max_min(), Parma_Polyhedra_Library::Octagonal_Shape< T >::max_min(), Parma_Polyhedra_Library::Box< ITV >::max_min(), Parma_Polyhedra_Library::BD_Shape< T >::max_min(), Parma_Polyhedra_Library::MIP_Problem::MIP_Problem(), Parma_Polyhedra_Library::MIP_Problem::OK(), operator<<(), Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter::operator==(), Parma_Polyhedra_Library::MIP_Problem::process_pending_constraints(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine(), Parma_Polyhedra_Library::BD_Shape< T >::refine(), Parma_Polyhedra_Library::MIP_Problem::second_phase(), Parma_Polyhedra_Library::MIP_Problem::set_objective_function(), Parma_Polyhedra_Library::Grid::simplify_using_context_assign(), Parma_Polyhedra_Library::Polyhedron::throw_dimension_incompatible(), Parma_Polyhedra_Library::Octagonal_Shape< T >::throw_dimension_incompatible(), Parma_Polyhedra_Library::Grid::throw_dimension_incompatible(), Parma_Polyhedra_Library::Box< ITV >::throw_dimension_incompatible(), and Parma_Polyhedra_Library::BD_Shape< T >::throw_dimension_incompatible().

00070                                          {
00071   return size() - 1;
00072 }

void Parma_Polyhedra_Library::Linear_Expression::swap ( Linear_Expression y  )  [inline]

Swaps *this with y.

Definition at line 163 of file Linear_Expression.inlines.hh.

Referenced by swap().

00163                                             {
00164   Linear_Row::swap(y);
00165 }

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.

Reimplemented from Parma_Polyhedra_Library::Row.

Reimplemented in Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter.

Definition at line 108 of file Linear_Expression.inlines.hh.

00108                                                {
00109   return Linear_Row::total_memory_in_bytes();
00110 }

const Linear_Expression & Parma_Polyhedra_Library::Linear_Expression::zero (  )  [inline, static]

Returns the (zero-dimension space) constant 0.

Definition at line 97 of file Linear_Expression.inlines.hh.

References zero_p.

Referenced by Parma_Polyhedra_Library::Constraint::initialize(), and Parma_Polyhedra_Library::Congruence::initialize().

00097                         {
00098   PPL_ASSERT(zero_p != 0);
00099   return *zero_p;
00100 }


Friends And Related Function Documentation

PPL::Linear_Expression & add_mul_assign ( Linear_Expression e,
Coefficient_traits::const_reference  n,
Variable  v 
) [friend]

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

Definition at line 360 of file Linear_Expression.cc.

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

00362                                       {
00363   const dimension_type v_space_dim = v.space_dimension();
00364   if (v_space_dim > Linear_Expression::max_space_dimension())
00365     throw std::length_error("Linear_Expression& "
00366                             "PPL::add_mul_assign(e, n, v):\n"
00367                             "v exceeds the maximum allowed space dimension.");
00368   const dimension_type e_size = e.size();
00369   if (e_size <= v_space_dim) {
00370     Linear_Expression new_e(e, v_space_dim+1);
00371     e.swap(new_e);
00372   }
00373   e[v_space_dim] += n;
00374   return e;
00375 }

Linear_Expression operator* ( const Linear_Expression e,
Coefficient_traits::const_reference  n 
) [friend]

Returns the linear expression e * n.

Definition at line 144 of file Linear_Expression.inlines.hh.

00144                                                                            {
00145   return n * e;
00146 }

PPL::Linear_Expression operator* ( Coefficient_traits::const_reference  n,
const Linear_Expression e 
) [friend]

Returns the linear expression n * e.

Definition at line 273 of file Linear_Expression.cc.

00274                                            {
00275   Linear_Expression r(e);
00276   for (dimension_type i = e.size(); i-- > 0; )
00277     r[i] *= n;
00278   return r;
00279 }

PPL::Linear_Expression & operator*= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
) [friend]

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

Definition at line 351 of file Linear_Expression.cc.

00351                                                                          {
00352   dimension_type e_size = e.size();
00353   for (dimension_type i = e_size; i-- > 0; )
00354     e[i] *= n;
00355   return e;
00356 }

Linear_Expression operator+ ( const Linear_Expression e  )  [related]

Returns the linear expression e.

Definition at line 114 of file Linear_Expression.inlines.hh.

00114                                       {
00115   return e;
00116 }

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

Returns the linear expression e + v.

Definition at line 126 of file Linear_Expression.inlines.hh.

00126                                                         {
00127   return v + e;
00128 }

PPL::Linear_Expression operator+ ( Variable  v,
Variable  w 
) [friend]

Returns the linear expression v + w.

Definition at line 170 of file Linear_Expression.cc.

00170                                                  {
00171   const dimension_type v_space_dim = v.space_dimension();
00172   const dimension_type w_space_dim = w.space_dimension();
00173   const dimension_type space_dim = std::max(v_space_dim, w_space_dim);
00174   if (space_dim > Linear_Expression::max_space_dimension())
00175     throw std::length_error("Linear_Expression "
00176                             "PPL::operator+(v, w):\n"
00177                             "v or w exceed the maximum allowed "
00178                             "space dimension.");
00179   Linear_Expression r(space_dim+1, true);
00180   ++r[v_space_dim];
00181   ++r[w_space_dim];
00182   return r;
00183 }

PPL::Linear_Expression operator+ ( Variable  v,
const Linear_Expression e 
) [friend]

Returns the linear expression v + e.

Definition at line 146 of file Linear_Expression.cc.

00146                                                            {
00147   const dimension_type v_space_dim = v.space_dimension();
00148   if (v_space_dim > Linear_Expression::max_space_dimension())
00149     throw std::length_error("Linear_Expression "
00150                             "PPL::operator+(v, e):\n"
00151                             "v exceeds the maximum allowed "
00152                             "space dimension.");
00153   const dimension_type space_dim = std::max(v_space_dim, e.space_dimension());
00154   Linear_Expression r(e, space_dim+1);
00155   ++r[v_space_dim];
00156   return r;
00157 }

Linear_Expression operator+ ( const Linear_Expression e,
Coefficient_traits::const_reference  n 
) [friend]

Returns the linear expression e + n.

Definition at line 120 of file Linear_Expression.inlines.hh.

00120                                                                            {
00121   return n + e;
00122 }

PPL::Linear_Expression operator+ ( Coefficient_traits::const_reference  n,
const Linear_Expression e 
) [friend]

Returns the linear expression n + e.

Definition at line 161 of file Linear_Expression.cc.

00162                                            {
00163   Linear_Expression r(e);
00164   r[0] += n;
00165   return r;
00166 }

PPL::Linear_Expression operator+ ( const Linear_Expression e1,
const Linear_Expression e2 
) [friend]

Returns the linear expression e1 + e2.

Definition at line 113 of file Linear_Expression.cc.

00113                                                                        {
00114   dimension_type e1_size = e1.size();
00115   dimension_type e2_size = e2.size();
00116   dimension_type min_size;
00117   dimension_type max_size;
00118   const Linear_Expression* p_e_max;
00119   if (e1_size > e2_size) {
00120     min_size = e2_size;
00121     max_size = e1_size;
00122     p_e_max = &e1;
00123   }
00124   else {
00125     min_size = e1_size;
00126     max_size = e2_size;
00127     p_e_max = &e2;
00128   }
00129 
00130   Linear_Expression r(max_size, false);
00131   dimension_type i = max_size;
00132   while (i > min_size) {
00133     --i;
00134     r[i] = (*p_e_max)[i];
00135   }
00136   while (i > 0) {
00137     --i;
00138     r[i] = e1[i] + e2[i];
00139   }
00140 
00141   return r;
00142 }

Linear_Expression & operator+= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
) [friend]

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

Definition at line 150 of file Linear_Expression.inlines.hh.

00150                                                                       {
00151   e[0] += n;
00152   return e;
00153 }

PPL::Linear_Expression & operator+= ( Linear_Expression e,
Variable  v 
) [friend]

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

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

Definition at line 300 of file Linear_Expression.cc.

00300                                                       {
00301   const dimension_type v_space_dim = v.space_dimension();
00302   if (v_space_dim > Linear_Expression::max_space_dimension())
00303     throw std::length_error("Linear_Expression& "
00304                             "PPL::operator+=(e, v):\n"
00305                             "v exceeds the maximum allowed space dimension.");
00306   const dimension_type e_size = e.size();
00307   if (e_size <= v_space_dim) {
00308     Linear_Expression new_e(e, v_space_dim+1);
00309     e.swap(new_e);
00310   }
00311   ++e[v_space_dim];
00312   return e;
00313 }

PPL::Linear_Expression & operator+= ( Linear_Expression e1,
const Linear_Expression e2 
) [friend]

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

Definition at line 283 of file Linear_Expression.cc.

00283                                                                   {
00284   dimension_type e1_size = e1.size();
00285   dimension_type e2_size = e2.size();
00286   if (e1_size >= e2_size)
00287     for (dimension_type i = e2_size; i-- > 0; )
00288       e1[i] += e2[i];
00289   else {
00290     Linear_Expression new_e(e2);
00291     for (dimension_type i = e1_size; i-- > 0; )
00292       new_e[i] += e1[i];
00293     e1.swap(new_e);
00294   }
00295   return e1;
00296 }

PPL::Linear_Expression operator- ( const Linear_Expression e,
Variable  v 
) [friend]

Returns the linear expression e - v.

Definition at line 247 of file Linear_Expression.cc.

00247                                                            {
00248   const dimension_type v_space_dim = v.space_dimension();
00249   if (v_space_dim > Linear_Expression::max_space_dimension())
00250     throw std::length_error("Linear_Expression "
00251                             "PPL::operator-(e, v):\n"
00252                             "v exceeds the maximum allowed "
00253                             "space dimension.");
00254   const dimension_type space_dim = std::max(v_space_dim, e.space_dimension());
00255   Linear_Expression r(e, space_dim+1);
00256   --r[v_space_dim];
00257   return r;
00258 }

PPL::Linear_Expression operator- ( Variable  v,
const Linear_Expression e 
) [friend]

Returns the linear expression v - e.

Definition at line 229 of file Linear_Expression.cc.

00229                                                            {
00230   const dimension_type v_space_dim = v.space_dimension();
00231   if (v_space_dim > Linear_Expression::max_space_dimension())
00232     throw std::length_error("Linear_Expression "
00233                             "PPL::operator-(v, e):\n"
00234                             "v exceeds the maximum allowed "
00235                             "space dimension.");
00236   const dimension_type e_space_dim = e.space_dimension();
00237   const dimension_type space_dim = std::max(v_space_dim, e_space_dim);
00238   Linear_Expression r(e, space_dim+1);
00239   for (dimension_type i = e.size(); i-- > 0; )
00240     neg_assign(r[i]);
00241   ++r[v_space_dim];
00242   return r;
00243 }

Linear_Expression operator- ( const Linear_Expression e,
Coefficient_traits::const_reference  n 
) [friend]

Returns the linear expression e - n.

Definition at line 132 of file Linear_Expression.inlines.hh.

00132                                                                            {
00133   return -n + e;
00134 }

PPL::Linear_Expression operator- ( Coefficient_traits::const_reference  n,
const Linear_Expression e 
) [friend]

Returns the linear expression n - e.

Definition at line 262 of file Linear_Expression.cc.

00263                                            {
00264   Linear_Expression r(e);
00265   for (dimension_type i = e.size(); i-- > 0; )
00266     neg_assign(r[i]);
00267   r[0] += n;
00268   return r;
00269 }

Linear_Expression operator- ( Variable  v,
Variable  w 
) [friend]

Returns the linear expression v - w.

Definition at line 138 of file Linear_Expression.inlines.hh.

00138                                               {
00139   return Linear_Expression(v, w);
00140 }

PPL::Linear_Expression operator- ( const Linear_Expression e1,
const Linear_Expression e2 
) [friend]

Returns the linear expression e1 - e2.

Definition at line 196 of file Linear_Expression.cc.

00196                                                                        {
00197   dimension_type e1_size = e1.size();
00198   dimension_type e2_size = e2.size();
00199   if (e1_size > e2_size) {
00200     Linear_Expression r(e1_size, false);
00201     dimension_type i = e1_size;
00202     while (i > e2_size) {
00203       --i;
00204       r[i] = e1[i];
00205     }
00206     while (i > 0) {
00207       --i;
00208       r[i] = e1[i] - e2[i];
00209     }
00210     return r;
00211   }
00212   else {
00213     Linear_Expression r(e2_size, false);
00214     dimension_type i = e2_size;
00215     while (i > e1_size) {
00216       --i;
00217       r[i] = -e2[i];
00218     }
00219     while (i > 0) {
00220       --i;
00221       r[i] = e1[i] - e2[i];
00222     }
00223     return r;
00224   }
00225 }

PPL::Linear_Expression operator- ( const Linear_Expression e  )  [friend]

Returns the linear expression - e.

Definition at line 187 of file Linear_Expression.cc.

00187                                          {
00188   Linear_Expression r(e);
00189   for (dimension_type i = e.size(); i-- > 0; )
00190     neg_assign(r[i]);
00191   return r;
00192 }

Linear_Expression & operator-= ( Linear_Expression e,
Coefficient_traits::const_reference  n 
) [friend]

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

Definition at line 157 of file Linear_Expression.inlines.hh.

00157                                                                       {
00158   e[0] -= n;
00159   return e;
00160 }

PPL::Linear_Expression & operator-= ( Linear_Expression e,
Variable  v 
) [friend]

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

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

Definition at line 334 of file Linear_Expression.cc.

00334                                                       {
00335   const dimension_type v_space_dim = v.space_dimension();
00336   if (v_space_dim > Linear_Expression::max_space_dimension())
00337     throw std::length_error("Linear_Expression& "
00338                             "PPL::operator-=(e, v):\n"
00339                             "v exceeds the maximum allowed space dimension.");
00340   const dimension_type e_size = e.size();
00341   if (e_size <= v_space_dim) {
00342     Linear_Expression new_e(e, v_space_dim+1);
00343     e.swap(new_e);
00344   }
00345   --e[v_space_dim];
00346   return e;
00347 }

PPL::Linear_Expression & operator-= ( Linear_Expression e1,
const Linear_Expression e2 
) [friend]

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

Definition at line 317 of file Linear_Expression.cc.

00317                                                                   {
00318   dimension_type e1_size = e1.size();
00319   dimension_type e2_size = e2.size();
00320   if (e1_size >= e2_size)
00321     for (dimension_type i = e2_size; i-- > 0; )
00322       e1[i] -= e2[i];
00323   else {
00324     Linear_Expression new_e(e1, e2_size);
00325     for (dimension_type i = e2_size; i-- > 0; )
00326       new_e[i] -= e2[i];
00327     e1.swap(new_e);
00328   }
00329   return e1;
00330 }

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

Output operator.

Definition at line 403 of file Linear_Expression.cc.

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

00403                                                                      {
00404   const dimension_type num_variables = e.space_dimension();
00405   PPL_DIRTY_TEMP_COEFFICIENT(ev);
00406   bool first = true;
00407   for (dimension_type v = 0; v < num_variables; ++v) {
00408     ev = e[v+1];
00409     if (ev != 0) {
00410       if (!first) {
00411         if (ev > 0)
00412           s << " + ";
00413         else {
00414           s << " - ";
00415           neg_assign(ev);
00416         }
00417       }
00418       else
00419         first = false;
00420       if (ev == -1)
00421         s << "-";
00422       else if (ev != 1)
00423         s << ev << "*";
00424       s << PPL::Variable(v);
00425     }
00426   }
00427   // Inhomogeneous term.
00428   PPL_DIRTY_TEMP_COEFFICIENT(it);
00429   it = e[0];
00430   if (it != 0) {
00431     if (!first) {
00432       if (it > 0)
00433         s << " + ";
00434       else {
00435         s << " - ";
00436         neg_assign(it);
00437       }
00438     }
00439     else
00440       first = false;
00441     s << it;
00442   }
00443 
00444   if (first)
00445     // The null linear expression.
00446     s << Coefficient_zero();
00447   return s;
00448 }

friend class Parma_Polyhedra_Library::Congruence [friend]

Definition at line 386 of file Linear_Expression.defs.hh.

Definition at line 401 of file Linear_Expression.defs.hh.

friend class Parma_Polyhedra_Library::Constraint [friend]

Reimplemented from Parma_Polyhedra_Library::Linear_Row.

Definition at line 382 of file Linear_Expression.defs.hh.

Definition at line 393 of file Linear_Expression.defs.hh.

friend class Parma_Polyhedra_Library::Generator [friend]

Reimplemented from Parma_Polyhedra_Library::Linear_Row.

Definition at line 383 of file Linear_Expression.defs.hh.

Definition at line 397 of file Linear_Expression.defs.hh.

friend class Parma_Polyhedra_Library::Grid [friend]

Definition at line 389 of file Linear_Expression.defs.hh.

Definition at line 385 of file Linear_Expression.defs.hh.

Definition at line 405 of file Linear_Expression.defs.hh.

std::ostream& Parma_Polyhedra_Library::IO_Operators::operator<< ( std::ostream &  s,
const Linear_Expression e 
) [friend]
friend class Parma_Polyhedra_Library::Polyhedron [friend]

Definition at line 388 of file Linear_Expression.defs.hh.

Definition at line 381 of file Linear_Expression.defs.hh.

PPL::Linear_Expression & sub_mul_assign ( Linear_Expression e,
Coefficient_traits::const_reference  n,
Variable  v 
) [friend]

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

Definition at line 379 of file Linear_Expression.cc.

00381                                       {
00382   const dimension_type v_space_dim = v.space_dimension();
00383   if (v_space_dim > Linear_Expression::max_space_dimension())
00384     throw std::length_error("Linear_Expression& "
00385                             "PPL::sub_mul_assign(e, n, v):\n"
00386                             "v exceeds the maximum allowed space dimension.");
00387   const dimension_type e_size = e.size();
00388   if (e_size <= v_space_dim) {
00389     Linear_Expression new_e(e, v_space_dim+1);
00390     e.swap(new_e);
00391   }
00392   e[v_space_dim] -= n;
00393   return e;
00394 }

Specializes std::swap.

Definition at line 184 of file Linear_Expression.inlines.hh.

References swap().

00185                                                   {
00186   x.swap(y);
00187 }


Member Data Documentation

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

Definition at line 379 of file Linear_Expression.defs.hh.

Referenced by finalize(), initialize(), and zero().


The documentation for this class was generated from the following files:
Generated on Sun Feb 27 16:20:24 2011 for PPL by  doxygen 1.6.3