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 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 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 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,.


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 Parma_Polyhedra_Library::Grid_Generator_System::affine_image(), Parma_Polyhedra_Library::Generator_System::affine_image(), Parma_Polyhedra_Library::Polyhedron::conversion(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Congruence_System::satisfies_all_congruences(), and 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 }

static 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.

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 Grid_Generator g,
const Congruence cg 
) [static]

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

Definition at line 43 of file Scalar_Products.cc.

References Parma_Polyhedra_Library::add_mul_assign(), Parma_Polyhedra_Library::Row::size(), and Parma_Polyhedra_Library::Grid_Generator::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() - 1 /* parameter divisor */; i-- > 0; )
00050     // The following line optimizes the computation of z += x[i] *
00051     // y[i].
00052     add_mul_assign(z, x[i], y[i]);
00053 }

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 56 of file Scalar_Products.cc.

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

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

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 }

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 69 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().

00071                                                           {
00072   // The reduced scalar product is only defined
00073   // if the topology of `x' is NNC and `y' has enough coefficients.
00074   assert(!x.is_necessarily_closed());
00075   assert(x.size() - 1 <= y.size());
00076   z = 0;
00077   for (dimension_type i = x.size() - 1; i-- > 0; )
00078     // The following line optimizes the computation of z += x[i] * y[i].
00079     add_mul_assign(z, x[i], y[i]);
00080 }

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 83 of file Scalar_Products.cc.

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

00085                                                           {
00086   // The reduced scalar product is only defined if the topology of `x'
00087   // is NNC and `y' has enough coefficients.
00088   assert(x.size() <= y.size());
00089   z = 0;
00090   for (dimension_type i = x.size() - 1; i-- > 0; )
00091     // The following line optimizes z += x[i] * y[i].
00092     add_mul_assign(z, x[i], y[i]);
00093 }

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 69 of file Scalar_Products.inlines.hh.

References reduced_sign().

00069                                                                      {
00070   return reduced_sign(static_cast<const Linear_Row&>(c),
00071                       static_cast<const Linear_Row&>(g));
00072 }

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 75 of file Scalar_Products.inlines.hh.

References reduced_sign().

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

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 96 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().

00098                                                               {
00099   // Scalar product is only defined  if `x' and `y' are
00100   // dimension-compatible.
00101   assert(x.size() <= y.size());
00102   z = 0;
00103     // Note the pre-decrement of `i': last iteration should be for `i == 1'.
00104   for (dimension_type i = x.size(); --i > 0; )
00105     // The following line optimizes the computation of z += x[i] * y[i].
00106     add_mul_assign(z, x[i], y[i]);
00107 }

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 81 of file Scalar_Products.inlines.hh.

References homogeneous_assign().

00083                                                         {
00084   homogeneous_assign(z,
00085                      static_cast<const Linear_Row&>(e),
00086                      static_cast<const Linear_Row&>(g));
00087 }

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 110 of file Scalar_Products.cc.

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

00112                                                               {
00113   // Scalar product is only defined if `x' and `y' are
00114   // dimension-compatible.
00115   assert(x.size() <= y.size());
00116   z = 0;
00117   // Note the pre-decrement of `i': last iteration should be for `i == 1'.
00118   for (dimension_type i = x.size() - 1; --i > 0; )
00119     // The following line optimizes the computation of z += x[i] * y[i].
00120     add_mul_assign(z, x[i], y[i]);
00121 }

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 90 of file Scalar_Products.inlines.hh.

References homogeneous_assign().

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

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 99 of file Scalar_Products.inlines.hh.

References homogeneous_sign().

00100                                                       {
00101   return homogeneous_sign(static_cast<const Linear_Row&>(e),
00102                           static_cast<const Linear_Row&>(g));
00103 }

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 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 }


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

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