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

The base class for linear expressions, constraints and generators. More...

#include <Linear_Row.defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::Linear_Row:

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

Collaboration graph
[legend]

List of all members.

Public Types

enum  Kind { LINE_OR_EQUALITY = 0, RAY_OR_POINT_OR_INEQUALITY = 1 }
 The possible kinds of Linear_Row objects. More...

Public Member Functions

 Linear_Row ()
 Pre-constructs a row: construction must be completed by construct().
 Linear_Row (dimension_type sz, Flags f)
 Tight constructor: resizing will require reallocation.
 Linear_Row (dimension_type sz, dimension_type capacity, Flags f)
 Sizing constructor with capacity.
 Linear_Row (const Linear_Row &y)
 Ordinary copy constructor.
 Linear_Row (const Linear_Row &y, dimension_type capacity)
 Copy constructor with specified capacity.
 Linear_Row (const Linear_Row &y, dimension_type sz, dimension_type capacity)
 Copy constructor with specified size and capacity.
 ~Linear_Row ()
 Destructor.
dimension_type space_dimension () const
 Returns the dimension of the vector space enclosing *this.
Coefficient_traits::const_reference inhomogeneous_term () const
 Returns the inhomogeneous term.
Coefficient_traits::const_reference coefficient (dimension_type n) const
 Returns the coefficient $a_n$.
void sign_normalize ()
 Normalizes the sign of the coefficients so that the first non-zero (homogeneous) coefficient of a line-or-equality is positive.
void strong_normalize ()
 Strong normalization: ensures that different Linear_Row objects represent different hyperplanes or hyperspaces.
bool check_strong_normalized () const
 Returns true if and only if the coefficients are strongly normalized.
void linear_combine (const Linear_Row &y, dimension_type k)
 Linearly combines *this with y so that *this[k] is 0.
bool all_homogeneous_terms_are_zero () const
 Returns true if and only if all the homogeneous terms of *this are $0$.
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)
 Uses the ASCII Linear_Row representation from s to recreate *this.
bool OK (dimension_type row_size, dimension_type row_capacity) const
 Checks if all the invariants are satisfied.
Post-constructors
void construct (dimension_type sz, Flags f)
 Constructs properly a default-constructed element.
void construct (dimension_type sz, dimension_type capacity, Flags f)
 Constructs properly a default-constructed element.
Flags inspection methods
const Flagsflags () const
 Returns a const reference to the flags of *this.
Flagsflags ()
 Returns a non-const reference to the flags of *this.
Topology topology () const
 Returns the topological kind of *this.
bool is_not_necessarily_closed () const
 Returns true if and only if the topology of *this row is not necessarily closed.
bool is_necessarily_closed () const
 Returns true if and only if the topology of *this row is necessarily closed.
bool is_line_or_equality () const
 Returns true if and only if *this row represents a line or an equality.
bool is_ray_or_point_or_inequality () const
 Returns true if and only if *this row represents a ray, a point or an inequality.
Flags coercion methods
void set_necessarily_closed ()
 Sets to NECESSARILY_CLOSED the topological kind of *this row.
void set_not_necessarily_closed ()
 Sets to NOT_NECESSARILY_CLOSED the topological kind of *this row.
void set_is_line_or_equality ()
 Sets to LINE_OR_EQUALITY the kind of *this row.
void set_is_ray_or_point_or_inequality ()
 Sets to RAY_OR_POINT_OR_INEQUALITY the kind of *this row.

Static Public Member Functions

static dimension_type max_space_dimension ()
 Returns the maximum space dimension a Linear_Row can handle.

Friends

class Parma_Polyhedra_Library::Linear_Expression
class Parma_Polyhedra_Library::Constraint
class Parma_Polyhedra_Library::Generator

Related Functions

(Note that these are not member functions.)

bool operator== (const Linear_Row &x, const Linear_Row &y)
 Returns true if and only if x and y are equal.
bool operator!= (const Linear_Row &x, const Linear_Row &y)
 Returns true if and only if x and y are different.
int compare (const Linear_Row &x, const Linear_Row &y)
 The basic comparison function.
void swap (Parma_Polyhedra_Library::Linear_Row &x, Parma_Polyhedra_Library::Linear_Row &y)
 Specializes std::swap.
void iter_swap (std::vector< Parma_Polyhedra_Library::Linear_Row >::iterator x, std::vector< Parma_Polyhedra_Library::Linear_Row >::iterator y)
 Specializes std::iter_swap.

Classes

class  Flags
 The type of the object to which the coefficients refer to, encoding both topology and kind. More...


Detailed Description

The base class for linear expressions, constraints and generators.

The class Linear_Row allows us to build objects of the form $[b, a_0, \ldots, a_{d-1}]_{(t, k)}$, i.e., a finite sequence of coefficients subscripted by a pair of flags, which are both stored in a Linear_Row::Flags object. The flag $t \in \{ \mathrm{c}, \mathrm{nnc} \}$ represents the topology and the flag $k \in \{\mathord{=}, \mathord{\geq} \}$ represents the kind of the Linear_Row object. Note that, even though all the four possible combinations of topology and kind values will result in a legal Linear_Row::Flags object, some of these pose additional constraints on the values of the Linear_Row's coefficients.

When $t = c$, we have the following cases ($d$ is the dimension of the vector space):

When $t = \mathrm{nnc}$, the last coefficient of the Linear_Row is associated to the slack variable $\epsilon$, so that we have the following cases ($d$ is again the dimension of the vector space, but this time we have $d+2$ coefficients):

So, a Linear_Row can be both a constraint and a generator: it can be an equality, a strict or non-strict inequality, a line, a ray, a point or a closure point.

The inhomogeneous term of a constraint can be zero or different from zero.

Points and closure points must have a positive inhomogeneous term (which is used as a common divisor for all the other coefficients), lines and rays must have the inhomogeneous term equal to zero. If needed, the coefficients of points and closure points are negated at creation time so that they satisfy this invariant. The invariant is maintained because, when combining a point or closure point with another generator, we only consider positive combinations.

The $\epsilon$ coefficient, when present, is negative for strict inequality constraints, positive for points and equal to zero in all the other cases. Note that the above description corresponds to the end-user, high-level view of a Linear_Row object. In the implementation, to allow for code reuse, it is sometimes useful to regard an $\mathrm{nnc}$-object on the vector space $\Rset^d$ as if it was a $\mathrm{c}$-object on the vector space $\Rset^{d+1}$, therefore interpreting the slack variable $\epsilon$ as an ordinary dimension of the vector space.

A Linear_Row object implementing a Linear_Expression is always of the form $[0, a_0, \ldots, a_{d-1}]_{(c,=)}$, which represents the linear expression $\sum_{i=0}^{d-1} a_i x_i$.

Definition at line 124 of file Linear_Row.defs.hh.


Member Enumeration Documentation

The possible kinds of Linear_Row objects.

Enumerator:
LINE_OR_EQUALITY 
RAY_OR_POINT_OR_INEQUALITY 

Definition at line 127 of file Linear_Row.defs.hh.

00127             {
00128     LINE_OR_EQUALITY = 0,
00129     RAY_OR_POINT_OR_INEQUALITY = 1
00130   };


Constructor & Destructor Documentation

Parma_Polyhedra_Library::Linear_Row::Linear_Row (  )  [inline]

Pre-constructs a row: construction must be completed by construct().

Definition at line 158 of file Linear_Row.inlines.hh.

00159   : Row() {
00160 }

Parma_Polyhedra_Library::Linear_Row::Linear_Row ( dimension_type  sz,
Flags  f 
) [inline]

Tight constructor: resizing will require reallocation.

Definition at line 180 of file Linear_Row.inlines.hh.

References construct().

00180                                                              {
00181   construct(sz, f);
00182 }

Parma_Polyhedra_Library::Linear_Row::Linear_Row ( dimension_type  sz,
dimension_type  capacity,
Flags  f 
) [inline]

Sizing constructor with capacity.

Definition at line 169 of file Linear_Row.inlines.hh.

References construct().

00170                                       {
00171   construct(sz, capacity, f);
00172 }

Parma_Polyhedra_Library::Linear_Row::Linear_Row ( const Linear_Row y  )  [inline]

Ordinary copy constructor.

Definition at line 185 of file Linear_Row.inlines.hh.

00186   : Row(y) {
00187 }

Parma_Polyhedra_Library::Linear_Row::Linear_Row ( const Linear_Row y,
dimension_type  capacity 
) [inline]

Copy constructor with specified capacity.

It is assumed that capacity is greater than or equal to y size.

Definition at line 190 of file Linear_Row.inlines.hh.

00192   : Row(y, capacity) {
00193 }

Parma_Polyhedra_Library::Linear_Row::Linear_Row ( const Linear_Row y,
dimension_type  sz,
dimension_type  capacity 
) [inline]

Copy constructor with specified size and capacity.

It is assumed that sz is greater than or equal to the size of y and, of course, that sz is less than or equal to capacity.

Definition at line 196 of file Linear_Row.inlines.hh.

00198   : Row(y, sz, capacity) {
00199 }

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

Destructor.

Definition at line 202 of file Linear_Row.inlines.hh.

00202                         {
00203 }


Member Function Documentation

void Parma_Polyhedra_Library::Linear_Row::construct ( dimension_type  sz,
Flags  f 
) [inline]

Constructs properly a default-constructed element.

Builds a row with type t, size sz and minimum capacity.

Reimplemented from Parma_Polyhedra_Library::Row.

Definition at line 175 of file Linear_Row.inlines.hh.

Referenced by Linear_Row().

00175                                                             {
00176   construct(sz, sz, f);
00177 }

void Parma_Polyhedra_Library::Linear_Row::construct ( dimension_type  sz,
dimension_type  capacity,
Flags  f 
) [inline]

Constructs properly a default-constructed element.

Parameters:
sz The size of the row that will be constructed;
capacity The minimum capacity of the row that will be constructed.
f Flags for the row that will be constructed.
The row that we are constructing has a minimum capacity, i.e., it can contain at least capacity elements, sz of which will be default-constructed now. The row flags are set to f.

Reimplemented from Parma_Polyhedra_Library::Row.

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

References Parma_Polyhedra_Library::Row::construct().

00164                                      {
00165   Row::construct(sz, capacity, f);
00166 }

const Linear_Row::Flags & Parma_Polyhedra_Library::Linear_Row::flags (  )  const [inline]

Linear_Row::Flags & Parma_Polyhedra_Library::Linear_Row::flags (  )  [inline]

Returns a non-const reference to the flags of *this.

Reimplemented from Parma_Polyhedra_Library::Row.

Definition at line 133 of file Linear_Row.inlines.hh.

References Parma_Polyhedra_Library::Row::flags().

00133                   {
00134   return static_cast<Flags&>(Row::flags());
00135 }

Topology Parma_Polyhedra_Library::Linear_Row::topology (  )  const [inline]

bool Parma_Polyhedra_Library::Linear_Row::is_not_necessarily_closed (  )  const

Returns true if and only if the topology of *this row is not necessarily closed.

bool Parma_Polyhedra_Library::Linear_Row::is_necessarily_closed (  )  const [inline]

bool Parma_Polyhedra_Library::Linear_Row::is_line_or_equality (  )  const [inline]

bool Parma_Polyhedra_Library::Linear_Row::is_ray_or_point_or_inequality (  )  const [inline]

void Parma_Polyhedra_Library::Linear_Row::set_necessarily_closed (  )  [inline]

Sets to NECESSARILY_CLOSED the topological kind of *this row.

Definition at line 231 of file Linear_Row.inlines.hh.

References flags(), and Parma_Polyhedra_Library::Linear_Row::Flags::set_necessarily_closed().

00231                                    {
00232   flags().set_necessarily_closed();
00233 }

void Parma_Polyhedra_Library::Linear_Row::set_not_necessarily_closed (  )  [inline]

Sets to NOT_NECESSARILY_CLOSED the topological kind of *this row.

Definition at line 236 of file Linear_Row.inlines.hh.

References flags(), and Parma_Polyhedra_Library::Linear_Row::Flags::set_not_necessarily_closed().

00236                                        {
00237   flags().set_not_necessarily_closed();
00238 }

void Parma_Polyhedra_Library::Linear_Row::set_is_line_or_equality (  )  [inline]

void Parma_Polyhedra_Library::Linear_Row::set_is_ray_or_point_or_inequality (  )  [inline]

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

Returns the maximum space dimension a Linear_Row can handle.

Reimplemented in Parma_Polyhedra_Library::Linear_Expression, Parma_Polyhedra_Library::Constraint, and Parma_Polyhedra_Library::Generator.

Definition at line 143 of file Linear_Row.inlines.hh.

References Parma_Polyhedra_Library::Row::max_size().

Referenced by Parma_Polyhedra_Library::Linear_Expression::max_space_dimension(), Parma_Polyhedra_Library::Generator::max_space_dimension(), and Parma_Polyhedra_Library::Constraint::max_space_dimension().

00143                                 {
00144   // The first coefficient holds the inhomogeneous term or the divisor.
00145   // In NNC rows, the last coefficient is for the epsilon dimension.
00146   return max_size() - 2;
00147 }

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

Returns the dimension of the vector space enclosing *this.

Reimplemented in Parma_Polyhedra_Library::Linear_Expression, Parma_Polyhedra_Library::Constraint, Parma_Polyhedra_Library::Generator, and Parma_Polyhedra_Library::Grid_Generator.

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

References is_necessarily_closed(), and Parma_Polyhedra_Library::Row::size().

Referenced by Parma_Polyhedra_Library::Generator::space_dimension(), and Parma_Polyhedra_Library::Constraint::space_dimension().

00150                                   {
00151   const dimension_type sz = size();
00152   return (sz == 0)
00153     ? 0
00154     : sz - (is_necessarily_closed() ? 1 : 2);
00155 }

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

Coefficient_traits::const_reference Parma_Polyhedra_Library::Linear_Row::coefficient ( dimension_type  n  )  const [inline]

Returns the coefficient $a_n$.

Definition at line 246 of file Linear_Row.inlines.hh.

Referenced by Parma_Polyhedra_Library::Linear_Expression::coefficient(), Parma_Polyhedra_Library::Generator::coefficient(), and Parma_Polyhedra_Library::Constraint::coefficient().

00246                                                     {
00247   return (*this)[k+1];
00248 }

void Parma_Polyhedra_Library::Linear_Row::sign_normalize (  ) 

Normalizes the sign of the coefficients so that the first non-zero (homogeneous) coefficient of a line-or-equality is positive.

Definition at line 33 of file Linear_Row.cc.

References is_line_or_equality(), Parma_Polyhedra_Library::neg_assign(), and Parma_Polyhedra_Library::Row::size().

Referenced by strong_normalize().

00033                               {
00034   if (is_line_or_equality()) {
00035     Linear_Row& x = *this;
00036     const dimension_type sz = x.size();
00037     // `first_non_zero' indicates the index of the first
00038     // coefficient of the row different from zero, disregarding
00039     // the very first coefficient (inhomogeneous term / divisor).
00040     dimension_type first_non_zero;
00041     for (first_non_zero = 1; first_non_zero < sz; ++first_non_zero)
00042       if (x[first_non_zero] != 0)
00043         break;
00044     if (first_non_zero < sz)
00045       // If the first non-zero coefficient of the row is negative,
00046       // we negate the entire row.
00047       if (x[first_non_zero] < 0) {
00048         for (dimension_type j = first_non_zero; j < sz; ++j)
00049           neg_assign(x[j]);
00050         // Also negate the first coefficient.
00051         neg_assign(x[0]);
00052       }
00053   }
00054 }

void Parma_Polyhedra_Library::Linear_Row::strong_normalize (  )  [inline]

bool Parma_Polyhedra_Library::Linear_Row::check_strong_normalized (  )  const

Returns true if and only if the coefficients are strongly normalized.

Definition at line 57 of file Linear_Row.cc.

References compare(), and strong_normalize().

Referenced by Parma_Polyhedra_Library::Linear_System::add_pending_row(), Parma_Polyhedra_Library::Linear_System::add_row(), Parma_Polyhedra_Library::Linear_System::insert(), and Parma_Polyhedra_Library::Linear_System::insert_pending().

00057                                              {
00058   Linear_Row tmp = *this;
00059   tmp.strong_normalize();
00060   return compare(*this, tmp) == 0;
00061 }

void Parma_Polyhedra_Library::Linear_Row::linear_combine ( const Linear_Row y,
dimension_type  k 
)

Linearly combines *this with y so that *this[k] is 0.

Parameters:
y The Linear_Row that will be combined with *this object;
k The position of *this that have to be $0$.
Computes a linear combination of *this and y having the element of index k equal to $0$. Then it assigns the resulting Linear_Row to *this and normalizes it.

Definition at line 103 of file Linear_Row.cc.

References Parma_Polyhedra_Library::normalize2(), Parma_Polyhedra_Library::Row::size(), strong_normalize(), Parma_Polyhedra_Library::sub_mul_assign(), and TEMP_INTEGER.

Referenced by Parma_Polyhedra_Library::Linear_System::back_substitute(), and Parma_Polyhedra_Library::Polyhedron::BHRZ03_evolving_points().

00103                                                                          {
00104   Linear_Row& x = *this;
00105   // We can combine only vector of the same dimension.
00106   assert(x.size() == y.size());
00107   assert(y[k] != 0 && x[k] != 0);
00108   // Let g be the GCD between `x[k]' and `y[k]'.
00109   // For each i the following computes
00110   //   x[i] = x[i]*y[k]/g - y[i]*x[k]/g.
00111   TEMP_INTEGER(normalized_x_k);
00112   TEMP_INTEGER(normalized_y_k);
00113   normalize2(x[k], y[k], normalized_x_k, normalized_y_k);
00114   for (dimension_type i = size(); i-- > 0; )
00115     if (i != k) {
00116       Coefficient& x_i = x[i];
00117       x_i *= normalized_y_k;
00118       sub_mul_assign(x_i, y[i], normalized_x_k);
00119     }
00120   x[k] = 0;
00121   x.strong_normalize();
00122 }

bool Parma_Polyhedra_Library::Linear_Row::all_homogeneous_terms_are_zero (  )  const

void Parma_Polyhedra_Library::Linear_Row::ascii_dump (  )  const

void Parma_Polyhedra_Library::Linear_Row::ascii_dump ( std::ostream &  s  )  const

Writes to s an ASCII representation of *this.

Reimplemented from Parma_Polyhedra_Library::Row.

Reimplemented in Parma_Polyhedra_Library::Constraint, Parma_Polyhedra_Library::Generator, and Parma_Polyhedra_Library::Grid_Generator.

Definition at line 180 of file Linear_Row.cc.

References Parma_Polyhedra_Library::Linear_Row::Flags::ascii_dump(), flags(), and Parma_Polyhedra_Library::Row::size().

00180                                              {
00181   const Row& x = *this;
00182   dimension_type x_size = x.size();
00183   for (dimension_type i = 0; i < x_size; ++i)
00184     s << x[i] << ' ';
00185   s << "f ";
00186   flags().ascii_dump(s);
00187   s << "\n";
00188 }

void Parma_Polyhedra_Library::Linear_Row::print (  )  const

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

Reimplemented from Parma_Polyhedra_Library::Row.

Reimplemented in Parma_Polyhedra_Library::Constraint, Parma_Polyhedra_Library::Generator, and Parma_Polyhedra_Library::Grid_Generator.

bool Parma_Polyhedra_Library::Linear_Row::ascii_load ( std::istream &  s  ) 

Uses the ASCII Linear_Row representation from s to recreate *this.

Returns true if successful, false otherwise. The ASCII representation is as output by ascii_dump.

Reimplemented from Parma_Polyhedra_Library::Row.

Reimplemented in Parma_Polyhedra_Library::Constraint, Parma_Polyhedra_Library::Generator, and Parma_Polyhedra_Library::Grid_Generator.

Definition at line 193 of file Linear_Row.cc.

References Parma_Polyhedra_Library::Linear_Row::Flags::ascii_load(), flags(), and Parma_Polyhedra_Library::Row::size().

Referenced by Parma_Polyhedra_Library::Generator::ascii_load(), and Parma_Polyhedra_Library::Constraint::ascii_load().

00193                                        {
00194   Row& x = *this;
00195   std::string str;
00196   const dimension_type x_size = x.size();
00197   for (dimension_type col = 0; col < x_size; ++col)
00198     if (!(s >> x[col]))
00199       return false;
00200   if (!(s >> str) || (str.compare("f") != 0))
00201     return false;
00202   return flags().ascii_load(s);
00203 }

bool Parma_Polyhedra_Library::Linear_Row::OK ( dimension_type  row_size,
dimension_type  row_capacity 
) const

Checks if all the invariants are satisfied.

Reimplemented from Parma_Polyhedra_Library::Row.

Definition at line 206 of file Linear_Row.cc.

References Parma_Polyhedra_Library::Row::OK().

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

00207                                                              {
00208   return Row::OK(row_size, row_capacity);
00209 }


Friends And Related Function Documentation

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

friend class Parma_Polyhedra_Library::Constraint [friend]

Reimplemented in Parma_Polyhedra_Library::Linear_Expression.

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

friend class Parma_Polyhedra_Library::Generator [friend]

Reimplemented in Parma_Polyhedra_Library::Linear_Expression.

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

bool operator== ( const Linear_Row x,
const Linear_Row y 
) [related]

Returns true if and only if x and y are equal.

Definition at line 258 of file Linear_Row.inlines.hh.

References flags().

00258                                                      {
00259   return x.flags() == y.flags()
00260     && static_cast<const Row&>(x) == static_cast<const Row&>(y);
00261 }

bool operator!= ( const Linear_Row x,
const Linear_Row y 
) [related]

Returns true if and only if x and y are different.

Definition at line 265 of file Linear_Row.inlines.hh.

00265                                                      {
00266   return !(x == y);
00267 }

int compare ( const Linear_Row x,
const Linear_Row y 
) [related]

The basic comparison function.

Returns:
The returned absolute value can be $0$, $1$ or $2$.
Parameters:
x A row of coefficients;
y Another row.
Compares x and y, where x and y may be of different size, in which case the "missing" coefficients are assumed to be zero. The comparison is such that:
  1. equalities are smaller than inequalities;
  2. lines are smaller than points and rays;
  3. the ordering is lexicographic;
  4. the positions compared are, in decreasing order of significance, 1, 2, ..., size(), 0;
  5. the result is negative, zero, or positive if x is smaller than, equal to, or greater than y, respectively;
  6. when x and y are different, the absolute value of the result is 1 if the difference is due to the coefficient in position 0; it is 2 otherwise.

When x and y represent the hyper-planes associated to two equality or inequality constraints, the coefficient at 0 is the known term. In this case, the return value can be characterized as follows:

  • -2, if x is smaller than y and they are not parallel;
  • -1, if x is smaller than y and they are parallel;
  • 0, if x and y are equal;
  • +1, if y is smaller than x and they are parallel;
  • +2, if y is smaller than x and they are not parallel.

Definition at line 65 of file Linear_Row.cc.

References Parma_Polyhedra_Library::cmp(), is_line_or_equality(), and Parma_Polyhedra_Library::Row::size().

Referenced by check_strong_normalized().

00065                                                      {
00066   const bool x_is_line_or_equality = x.is_line_or_equality();
00067   const bool y_is_line_or_equality = y.is_line_or_equality();
00068   if (x_is_line_or_equality != y_is_line_or_equality)
00069     // Equalities (lines) precede inequalities (ray/point).
00070     return y_is_line_or_equality ? 2 : -2;
00071 
00072   // Compare all the coefficients of the row starting from position 1.
00073   const dimension_type xsz = x.size();
00074   const dimension_type ysz = y.size();
00075   const dimension_type min_sz = std::min(xsz, ysz);
00076   dimension_type i;
00077   for (i = 1; i < min_sz; ++i)
00078     if (const int comp = cmp(x[i], y[i]))
00079       // There is at least a different coefficient.
00080       return (comp > 0) ? 2 : -2;
00081 
00082   // Handle the case where `x' and `y' are of different size.
00083   if (xsz != ysz) {
00084     for( ; i < xsz; ++i)
00085       if (const int sign = sgn(x[i]))
00086         return (sign > 0) ? 2 : -2;
00087     for( ; i < ysz; ++i)
00088       if (const int sign = sgn(y[i]))
00089         return (sign < 0) ? 2 : -2;
00090   }
00091 
00092   // If all the coefficients in `x' equal all the coefficients in `y'
00093   // (starting from position 1) we compare coefficients in position 0,
00094   // i.e., inhomogeneous terms.
00095   if (const int comp = cmp(x[0], y[0]))
00096     return (comp > 0) ? 1 : -1;
00097 
00098   // `x' and `y' are equal.
00099   return 0;
00100 }

void iter_swap ( std::vector< Parma_Polyhedra_Library::Linear_Row >::iterator  x,
std::vector< Parma_Polyhedra_Library::Linear_Row >::iterator  y 
) [related]

Specializes std::iter_swap.

Definition at line 283 of file Linear_Row.inlines.hh.

References swap().

00284                                                                   {
00285   swap(*x, *y);
00286 }


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

Generated on Wed Jul 16 22:55:45 2008 for PPL by  doxygen 1.5.6