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

A class implementing various scalar product functions. More...

#include <Scalar_Products.defs.hh>

List of all members.

Static Public Member Functions

static void assign (Coefficient &z, const Linear_Row &x, const Linear_Row &y)
 Computes the scalar product of x and y and assigns it to z.
static void assign (Coefficient &z, const Constraint &c, const Generator &g)
 Computes the scalar product of c and g and assigns it to z.
static void assign (Coefficient &z, const Generator &g, const Constraint &c)
 Computes the scalar product of g and c and assigns it to z.
static void assign (Coefficient &z, const Constraint &c, const Grid_Generator &g)
 Computes the scalar product of c and g and assigns it to z.
static void assign (Coefficient &z, const Grid_Generator &g, const Congruence &cg)
 Computes the scalar product of g and cg and assigns it to z.
static void assign (Coefficient &z, const Congruence &cg, const Grid_Generator &g)
 Computes the scalar product of cg and g and assigns it to z.
static int sign (const Linear_Row &x, const Linear_Row &y)
 Returns the sign of the scalar product between x and y.
static int sign (const Constraint &c, const Generator &g)
 Returns the sign of the scalar product between c and g.
static int sign (const Generator &g, const Constraint &c)
 Returns the sign of the scalar product between g and c.
static int sign (const Constraint &c, const Grid_Generator &g)
 Returns the sign of the scalar product between c and g.
static void reduced_assign (Coefficient &z, const Linear_Row &x, const Linear_Row &y)
 Computes the reduced scalar product of x and y, where the $\epsilon$ coefficient of x is ignored, and assigns the result to z.
static void reduced_assign (Coefficient &z, const Constraint &c, const Generator &g)
 Computes the reduced scalar product of c and g, where the $\epsilon$ coefficient of c is ignored, and assigns the result to z.
static void reduced_assign (Coefficient &z, const Generator &g, const Constraint &c)
 Computes the reduced scalar product of g and c, where the $\epsilon$ coefficient of g is ignored, and assigns the result to z.
static void reduced_assign (Coefficient &z, const Grid_Generator &g, const Congruence &cg)
 Computes the reduced scalar product of g and cg, where the $\epsilon$ coefficient of g is ignored, and assigns the result to z.
static int reduced_sign (const Linear_Row &x, const Linear_Row &y)
 Returns the sign of the reduced scalar product of x and y, where the $\epsilon$ coefficient of x is ignored.
static int reduced_sign (const Constraint &c, const Generator &g)
 Returns the sign of the reduced scalar product of c and g, where the $\epsilon$ coefficient of c is ignored.
static int reduced_sign (const Generator &g, const Constraint &c)
 Returns the sign of the reduced scalar product of g and c, where the $\epsilon$ coefficient of g is ignored.
static void homogeneous_assign (Coefficient &z, const Linear_Row &x, const Linear_Row &y)
 Computes the homogeneous scalar product of x and y, where the inhomogeneous terms are ignored, and assigns the result to z.
static void homogeneous_assign (Coefficient &z, const Linear_Expression &e, const Generator &g)
 Computes the homogeneous scalar product of e and g, where the inhomogeneous terms are ignored, and assigns the result to z.
static void homogeneous_assign (Coefficient &z, const Grid_Generator &g, const Constraint &c)
 Computes the homogeneous scalar product of g and c, where the inhomogeneous terms are ignored, and assigns the result to z.
static void homogeneous_assign (Coefficient &z, const Grid_Generator &g, const Congruence &cg)
 Computes the homogeneous scalar product of g and cg, where the inhomogeneous terms are ignored, and assigns the result to z.
static void homogeneous_assign (Coefficient &z, const Linear_Expression &e, const Grid_Generator &g)
 Computes the homogeneous scalar product of e and g, where the inhomogeneous terms are ignored, and assigns the result to z.
static int homogeneous_sign (const Linear_Row &x, const Linear_Row &y)
 Returns the sign of the homogeneous scalar product of x and y, where the inhomogeneous terms are ignored.
static int homogeneous_sign (const Linear_Expression &e, const Generator &g)
 Returns the sign of the homogeneous scalar product of e and g, where the inhomogeneous terms are ignored.
static int homogeneous_sign (const Linear_Expression &e, const Grid_Generator &g)
 Returns the sign of the homogeneous scalar product of e and g, where the inhomogeneous terms are ignored,.
static int homogeneous_sign (const Grid_Generator &g, const Constraint &c)
 Returns the sign of the homogeneous scalar product of g and c, where the inhomogeneous terms are ignored,.


Detailed Description

A class implementing various scalar product functions.

When computing the scalar product of (Linear_Row or Constraint or Generator) objects x and y, it is assumed that the space dimension of the first object x is less than or equal to the space dimension of the second object y.

Definition at line 44 of file Scalar_Products.defs.hh.


Member Function Documentation

void Parma_Polyhedra_Library::Scalar_Products::assign ( Coefficient z,
const Linear_Row x,
const Linear_Row y 
) [static]

Computes the scalar product of x and y and assigns it to z.

Definition at line 31 of file Scalar_Products.cc.

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

Referenced by sign().

00032                                                                        {
00033   // Scalar product is only defined  if `x' and `y' are
00034   // dimension-compatible.
00035   assert(x.size() <= y.size());
00036   z = 0;
00037   for (dimension_type i = x.size(); i-- > 0; )
00038     // The following line optimizes the computation of z += x[i] * y[i].
00039     add_mul_assign(z, x[i], y[i]);
00040 }

void Parma_Polyhedra_Library::Scalar_Products::assign ( Coefficient z,
const Constraint c,
const Generator g 
) [static]

Computes the scalar product of c and g and assigns it to z.

Definition at line 43 of file Scalar_Products.cc.

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

00044                                                                       {
00045   // Scalar product is only defined if `x' and `y' are
00046   // dimension-compatible.
00047   assert(x.size() <= y.size());
00048   z = 0;
00049   for (dimension_type i = x.size(); i-- > 0; )
00050     // The following line optimizes the computation of z += x[i] * y[i].
00051     add_mul_assign(z, x[i], y[i]);
00052 }

static void Parma_Polyhedra_Library::Scalar_Products::assign ( Coefficient z,
const Generator g,
const Constraint c 
) [static]

Computes the scalar product of g and c and assigns it to z.

void Parma_Polyhedra_Library::Scalar_Products::assign ( Coefficient z,
const Constraint c,
const Grid_Generator g 
) [static]

Computes the scalar product of c and g and assigns it to z.

Definition at line 68 of file Scalar_Products.cc.

References Parma_Polyhedra_Library::add_mul_assign(), Parma_Polyhedra_Library::Grid_Generator::size(), and Parma_Polyhedra_Library::Row::size().

00070                                                       {
00071   // Scalar product is only defined if `x' and `y' are
00072   // dimension-compatible.
00073   assert(x.size() <= y.size());
00074   z = 0;
00075   for (dimension_type i = x.size(); i-- > 0; )
00076     // The following line optimizes the computation of z += x[i] * y[i].
00077     add_mul_assign(z, x[i], y[i]);
00078 }

void Parma_Polyhedra_Library::Scalar_Products::assign ( Coefficient z,
const Grid_Generator g,
const Congruence cg 
) [static]

Computes the scalar product of g and cg and assigns it to z.

Definition at line 55 of file Scalar_Products.cc.

References Parma_Polyhedra_Library::add_mul_assign(), Parma_Polyhedra_Library::Row::size(), and Parma_Polyhedra_Library::Grid_Generator::size().

00056                                                                            {
00057   // Scalar product is only defined if `x' and `y' are
00058   // dimension-compatible.
00059   assert(x.size() <= y.size());
00060   z = 0;
00061   for (dimension_type i = x.size() - 1 /* parameter divisor */; i-- > 0; )
00062     // The following line optimizes the computation of z += x[i] *
00063     // y[i].
00064     add_mul_assign(z, x[i], y[i]);
00065 }

void Parma_Polyhedra_Library::Scalar_Products::assign ( Coefficient z,
const Congruence cg,
const Grid_Generator g 
) [static]

Computes the scalar product of cg and g and assigns it to z.

Definition at line 81 of file Scalar_Products.cc.

References Parma_Polyhedra_Library::add_mul_assign(), Parma_Polyhedra_Library::Grid_Generator::size(), and Parma_Polyhedra_Library::Row::size().

00082                                                                            {
00083   // Scalar product is only defined if `x' and `y' are
00084   // dimension-compatible.
00085   assert(x.size() <= y.size());
00086   z = 0;
00087   for (dimension_type i = x.size() - 1; i-- > 0; )
00088     // The following line optimizes the computation of z += x[i] *
00089     // y[i].
00090     add_mul_assign(z, x[i], y[i]);
00091 }

int Parma_Polyhedra_Library::Scalar_Products::sign ( const Linear_Row x,
const Linear_Row y 
) [inline, static]

int Parma_Polyhedra_Library::Scalar_Products::sign ( const Constraint c,
const Generator g 
) [inline, static]

Returns the sign of the scalar product between c and g.

Definition at line 57 of file Scalar_Products.inlines.hh.

References sign().

00057                                                              {
00058   return sign(static_cast<const Linear_Row&>(c),
00059               static_cast<const Linear_Row&>(g));
00060 }

int Parma_Polyhedra_Library::Scalar_Products::sign ( const Generator g,
const Constraint c 
) [inline, static]

Returns the sign of the scalar product between g and c.

Definition at line 63 of file Scalar_Products.inlines.hh.

References sign().

00063                                                              {
00064   return sign(static_cast<const Linear_Row&>(g),
00065               static_cast<const Linear_Row&>(c));
00066 }

int Parma_Polyhedra_Library::Scalar_Products::sign ( const Constraint c,
const Grid_Generator g 
) [inline, static]

Returns the sign of the scalar product between c and g.

Definition at line 69 of file Scalar_Products.inlines.hh.

References assign(), and TEMP_INTEGER.

00069                                                                   {
00070   TEMP_INTEGER(z);
00071   assign(z, c, g);
00072   return sgn(z);
00073 }

void Parma_Polyhedra_Library::Scalar_Products::reduced_assign ( Coefficient z,
const Linear_Row x,
const Linear_Row y 
) [static]

Computes the reduced scalar product of x and y, where the $\epsilon$ coefficient of x is ignored, and assigns the result to z.

Definition at line 94 of file Scalar_Products.cc.

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

Referenced by reduced_sign().

00096                                                           {
00097   // The reduced scalar product is only defined
00098   // if the topology of `x' is NNC and `y' has enough coefficients.
00099   assert(!x.is_necessarily_closed());
00100   assert(x.size() - 1 <= y.size());
00101   z = 0;
00102   for (dimension_type i = x.size() - 1; i-- > 0; )
00103     // The following line optimizes the computation of z += x[i] * y[i].
00104     add_mul_assign(z, x[i], y[i]);
00105 }

static void Parma_Polyhedra_Library::Scalar_Products::reduced_assign ( Coefficient z,
const Constraint c,
const Generator g 
) [static]

Computes the reduced scalar product of c and g, where the $\epsilon$ coefficient of c is ignored, and assigns the result to z.

static void Parma_Polyhedra_Library::Scalar_Products::reduced_assign ( Coefficient z,
const Generator g,
const Constraint c 
) [static]

Computes the reduced scalar product of g and c, where the $\epsilon$ coefficient of g is ignored, and assigns the result to z.

void Parma_Polyhedra_Library::Scalar_Products::reduced_assign ( Coefficient z,
const Grid_Generator g,
const Congruence cg 
) [static]

Computes the reduced scalar product of g and cg, where the $\epsilon$ coefficient of g is ignored, and assigns the result to z.

Definition at line 108 of file Scalar_Products.cc.

References Parma_Polyhedra_Library::add_mul_assign(), Parma_Polyhedra_Library::Row::size(), and Parma_Polyhedra_Library::Grid_Generator::size().

00110                                                           {
00111   // The reduced scalar product is only defined if the topology of `x'
00112   // is NNC and `y' has enough coefficients.
00113   assert(x.size() <= y.size());
00114   z = 0;
00115   for (dimension_type i = x.size() - 1; i-- > 0; )
00116     // The following line optimizes z += x[i] * y[i].
00117     add_mul_assign(z, x[i], y[i]);
00118 }

int Parma_Polyhedra_Library::Scalar_Products::reduced_sign ( const Linear_Row x,
const Linear_Row y 
) [inline, static]

Returns the sign of the reduced scalar product of x and y, where the $\epsilon$ coefficient of x is ignored.

Definition at line 43 of file Scalar_Products.inlines.hh.

References reduced_assign(), and TEMP_INTEGER.

Referenced by Parma_Polyhedra_Library::Polyhedron::is_included_in(), Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Sign::operator()(), reduced_sign(), and Parma_Polyhedra_Library::Generator_System::relation_with().

00043                                                                       {
00044   TEMP_INTEGER(z);
00045   reduced_assign(z, x, y);
00046   return sgn(z);
00047 }

int Parma_Polyhedra_Library::Scalar_Products::reduced_sign ( const Constraint c,
const Generator g 
) [inline, static]

Returns the sign of the reduced scalar product of c and g, where the $\epsilon$ coefficient of c is ignored.

Definition at line 76 of file Scalar_Products.inlines.hh.

References reduced_sign().

00076                                                                      {
00077   return reduced_sign(static_cast<const Linear_Row&>(c),
00078                       static_cast<const Linear_Row&>(g));
00079 }

int Parma_Polyhedra_Library::Scalar_Products::reduced_sign ( const Generator g,
const Constraint c 
) [inline, static]

Returns the sign of the reduced scalar product of g and c, where the $\epsilon$ coefficient of g is ignored.

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

References reduced_sign().

00082                                                                      {
00083   return reduced_sign(static_cast<const Linear_Row&>(g),
00084                       static_cast<const Linear_Row&>(c));
00085 }

void Parma_Polyhedra_Library::Scalar_Products::homogeneous_assign ( Coefficient z,
const Linear_Row x,
const Linear_Row y 
) [static]

Computes the homogeneous scalar product of x and y, where the inhomogeneous terms are ignored, and assigns the result to z.

Definition at line 121 of file Scalar_Products.cc.

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

Referenced by homogeneous_assign(), homogeneous_sign(), Parma_Polyhedra_Library::Polyhedron::max_min(), and Parma_Polyhedra_Library::Grid::max_min().

00123                                                               {
00124   // Scalar product is only defined  if `x' and `y' are
00125   // dimension-compatible.
00126   assert(x.size() <= y.size());
00127   z = 0;
00128     // Note the pre-decrement of `i': last iteration should be for `i == 1'.
00129   for (dimension_type i = x.size(); --i > 0; )
00130     // The following line optimizes the computation of z += x[i] * y[i].
00131     add_mul_assign(z, x[i], y[i]);
00132 }

void Parma_Polyhedra_Library::Scalar_Products::homogeneous_assign ( Coefficient z,
const Linear_Expression e,
const Generator g 
) [inline, static]

Computes the homogeneous scalar product of e and g, where the inhomogeneous terms are ignored, and assigns the result to z.

Definition at line 88 of file Scalar_Products.inlines.hh.

References homogeneous_assign().

00090                                                         {
00091   homogeneous_assign(z,
00092                      static_cast<const Linear_Row&>(e),
00093                      static_cast<const Linear_Row&>(g));
00094 }

void Parma_Polyhedra_Library::Scalar_Products::homogeneous_assign ( Coefficient z,
const Grid_Generator g,
const Constraint c 
) [static]

Computes the homogeneous scalar product of g and c, where the inhomogeneous terms are ignored, and assigns the result to z.

Definition at line 149 of file Scalar_Products.cc.

References Parma_Polyhedra_Library::add_mul_assign(), Parma_Polyhedra_Library::Row::size(), and Parma_Polyhedra_Library::Grid_Generator::size().

00151                                                               {
00152   // Scalar product is only defined if `x' and `y' are
00153   // dimension-compatible.
00154   assert(x.size() - 1 <= y.size());
00155   z = 0;
00156   // Note the pre-decrement of `i': last iteration should be for `i == 1'.
00157   for (dimension_type i = x.size() - 1; --i > 0; )
00158     // The following line optimizes the computation of z += x[i] * y[i].
00159     add_mul_assign(z, x[i], y[i]);
00160 }

void Parma_Polyhedra_Library::Scalar_Products::homogeneous_assign ( Coefficient z,
const Grid_Generator g,
const Congruence cg 
) [static]

Computes the homogeneous scalar product of g and cg, where the inhomogeneous terms are ignored, and assigns the result to z.

Definition at line 135 of file Scalar_Products.cc.

References Parma_Polyhedra_Library::add_mul_assign(), Parma_Polyhedra_Library::Row::size(), and Parma_Polyhedra_Library::Grid_Generator::size().

00137                                                               {
00138   // Scalar product is only defined if `x' and `y' are
00139   // dimension-compatible.
00140   assert(x.size() <= y.size());
00141   z = 0;
00142   // Note the pre-decrement of `i': last iteration should be for `i == 1'.
00143   for (dimension_type i = x.size() - 1; --i > 0; )
00144     // The following line optimizes the computation of z += x[i] * y[i].
00145     add_mul_assign(z, x[i], y[i]);
00146 }

void Parma_Polyhedra_Library::Scalar_Products::homogeneous_assign ( Coefficient z,
const Linear_Expression e,
const Grid_Generator g 
) [inline, static]

Computes the homogeneous scalar product of e and g, where the inhomogeneous terms are ignored, and assigns the result to z.

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

References homogeneous_assign().

00099                                                              {
00100   homogeneous_assign(z,
00101                      static_cast<const Linear_Row&>(e),
00102                      static_cast<const Linear_Row&>(g));
00103 }

int Parma_Polyhedra_Library::Scalar_Products::homogeneous_sign ( const Linear_Row x,
const Linear_Row y 
) [inline, static]

Returns the sign of the homogeneous scalar product of x and y, where the inhomogeneous terms are ignored.

Definition at line 50 of file Scalar_Products.inlines.hh.

References homogeneous_assign(), and TEMP_INTEGER.

Referenced by Parma_Polyhedra_Library::Polyhedron::bounds(), Parma_Polyhedra_Library::Grid::bounds(), and homogeneous_sign().

00050                                                                           {
00051   TEMP_INTEGER(z);
00052   homogeneous_assign(z, x, y);
00053   return sgn(z);
00054 }

int Parma_Polyhedra_Library::Scalar_Products::homogeneous_sign ( const Linear_Expression e,
const Generator g 
) [inline, static]

Returns the sign of the homogeneous scalar product of e and g, where the inhomogeneous terms are ignored.

Definition at line 106 of file Scalar_Products.inlines.hh.

References homogeneous_sign().

00107                                                       {
00108   return homogeneous_sign(static_cast<const Linear_Row&>(e),
00109                           static_cast<const Linear_Row&>(g));
00110 }

int Parma_Polyhedra_Library::Scalar_Products::homogeneous_sign ( const Linear_Expression e,
const Grid_Generator g 
) [inline, static]

Returns the sign of the homogeneous scalar product of e and g, where the inhomogeneous terms are ignored,.

Definition at line 113 of file Scalar_Products.inlines.hh.

References homogeneous_sign().

00114                                                            {
00115   return homogeneous_sign(static_cast<const Linear_Row&>(e),
00116                           static_cast<const Linear_Row&>(g));
00117 }

int Parma_Polyhedra_Library::Scalar_Products::homogeneous_sign ( const Grid_Generator g,
const Constraint c 
) [inline, static]

Returns the sign of the homogeneous scalar product of g and c, where the inhomogeneous terms are ignored,.

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

References homogeneous_assign(), and TEMP_INTEGER.

00121                                                        {
00122   TEMP_INTEGER(z);
00123   homogeneous_assign(z, g, c);
00124   return sgn(z);
00125 }


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

Generated on Sat Oct 11 10:41:09 2008 for PPL by  doxygen 1.5.6