A class implementing various scalar product functions. More...
#include <Scalar_Products.defs.hh>
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 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 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 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 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 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 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 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,. | |
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 45 of file Scalar_Products.defs.hh.
| 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 82 of file Scalar_Products.cc.
References Parma_Polyhedra_Library::add_mul_assign(), Parma_Polyhedra_Library::Grid_Generator::size(), and Parma_Polyhedra_Library::Row::size().
00083 { 00084 // Scalar product is only defined if `x' and `y' are 00085 // dimension-compatible. 00086 PPL_ASSERT(x.size() <= y.size()); 00087 z = 0; 00088 for (dimension_type i = x.size() - 1; i-- > 0; ) 00089 // The following line optimizes the computation of z += x[i] * 00090 // y[i]. 00091 add_mul_assign(z, x[i], y[i]); 00092 }
| 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 56 of file Scalar_Products.cc.
References Parma_Polyhedra_Library::add_mul_assign(), Parma_Polyhedra_Library::Row::size(), and Parma_Polyhedra_Library::Grid_Generator::size().
00057 { 00058 // Scalar product is only defined if `x' and `y' are 00059 // dimension-compatible. 00060 PPL_ASSERT(x.size() <= y.size()); 00061 z = 0; 00062 for (dimension_type i = x.size() - 1 /* parameter divisor */; 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 }
| 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 69 of file Scalar_Products.cc.
References Parma_Polyhedra_Library::add_mul_assign(), Parma_Polyhedra_Library::Grid_Generator::size(), and Parma_Polyhedra_Library::Row::size().
00071 { 00072 // Scalar product is only defined if `x' and `y' are 00073 // dimension-compatible. 00074 PPL_ASSERT(x.size() <= y.size()); 00075 z = 0; 00076 for (dimension_type i = x.size(); i-- > 0; ) 00077 // The following line optimizes the computation of z += x[i] * y[i]. 00078 add_mul_assign(z, x[i], y[i]); 00079 }
| 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 Generator & | g | |||
| ) | [static] |
Computes the scalar product of c and g and assigns it to z.
Definition at line 44 of file Scalar_Products.cc.
References Parma_Polyhedra_Library::add_mul_assign(), and Parma_Polyhedra_Library::Row::size().
00045 { 00046 // Scalar product is only defined if `x' and `y' are 00047 // dimension-compatible. 00048 PPL_ASSERT(x.size() <= y.size()); 00049 z = 0; 00050 for (dimension_type i = x.size(); i-- > 0; ) 00051 // The following line optimizes the computation of z += x[i] * y[i]. 00052 add_mul_assign(z, x[i], y[i]); 00053 }
| 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 32 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::Polyhedron::relation_with(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Congruence_System::satisfies_all_congruences(), sign(), and Parma_Polyhedra_Library::Grid::simplify_using_context_assign().
00033 { 00034 // Scalar product is only defined if `x' and `y' are 00035 // dimension-compatible. 00036 PPL_ASSERT(x.size() <= y.size()); 00037 z = 0; 00038 for (dimension_type i = x.size(); i-- > 0; ) 00039 // The following line optimizes the computation of z += x[i] * y[i]. 00040 add_mul_assign(z, x[i], y[i]); 00041 }
| 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 98 of file Scalar_Products.inlines.hh.
References homogeneous_assign().
00100 { 00101 homogeneous_assign(z, 00102 static_cast<const Linear_Row&>(e), 00103 static_cast<const Linear_Row&>(g)); 00104 }
| 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 136 of file Scalar_Products.cc.
References Parma_Polyhedra_Library::add_mul_assign(), Parma_Polyhedra_Library::Row::size(), and Parma_Polyhedra_Library::Grid_Generator::size().
00138 { 00139 // Scalar product is only defined if `x' and `y' are 00140 // dimension-compatible. 00141 PPL_ASSERT(x.size() <= y.size()); 00142 z = 0; 00143 // Note the pre-decrement of `i': last iteration should be for `i == 1'. 00144 for (dimension_type i = x.size() - 1; --i > 0; ) 00145 // The following line optimizes the computation of z += x[i] * y[i]. 00146 add_mul_assign(z, x[i], y[i]); 00147 }
| 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 150 of file Scalar_Products.cc.
References Parma_Polyhedra_Library::add_mul_assign(), Parma_Polyhedra_Library::Row::size(), and Parma_Polyhedra_Library::Grid_Generator::size().
00152 { 00153 // Scalar product is only defined if `x' and `y' are 00154 // dimension-compatible. 00155 PPL_ASSERT(x.size() - 1 <= y.size()); 00156 z = 0; 00157 // Note the pre-decrement of `i': last iteration should be for `i == 1'. 00158 for (dimension_type i = x.size() - 1; --i > 0; ) 00159 // The following line optimizes the computation of z += x[i] * y[i]. 00160 add_mul_assign(z, x[i], y[i]); 00161 }
| 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 89 of file Scalar_Products.inlines.hh.
References homogeneous_assign().
00091 { 00092 homogeneous_assign(z, 00093 static_cast<const Linear_Row&>(e), 00094 static_cast<const Linear_Row&>(g)); 00095 }
| 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 122 of file Scalar_Products.cc.
References Parma_Polyhedra_Library::add_mul_assign(), and Parma_Polyhedra_Library::Row::size().
Referenced by Parma_Polyhedra_Library::Polyhedron::frequency(), Parma_Polyhedra_Library::Grid::frequency_no_check(), homogeneous_assign(), homogeneous_sign(), Parma_Polyhedra_Library::Polyhedron::max_min(), and Parma_Polyhedra_Library::Grid::max_min().
00124 { 00125 // Scalar product is only defined if `x' and `y' are 00126 // dimension-compatible. 00127 PPL_ASSERT(x.size() <= y.size()); 00128 z = 0; 00129 // Note the pre-decrement of `i': last iteration should be for `i == 1'. 00130 for (dimension_type i = x.size(); --i > 0; ) 00131 // The following line optimizes the computation of z += x[i] * y[i]. 00132 add_mul_assign(z, x[i], y[i]); 00133 }
| 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 121 of file Scalar_Products.inlines.hh.
References homogeneous_assign(), and PPL_DIRTY_TEMP_COEFFICIENT.
00122 { 00123 PPL_DIRTY_TEMP_COEFFICIENT(z); 00124 homogeneous_assign(z, g, c); 00125 return sgn(z); 00126 }
| 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 114 of file Scalar_Products.inlines.hh.
References homogeneous_sign().
00115 { 00116 return homogeneous_sign(static_cast<const Linear_Row&>(e), 00117 static_cast<const Linear_Row&>(g)); 00118 }
| 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 107 of file Scalar_Products.inlines.hh.
References homogeneous_sign().
00108 { 00109 return homogeneous_sign(static_cast<const Linear_Row&>(e), 00110 static_cast<const Linear_Row&>(g)); 00111 }
| 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 51 of file Scalar_Products.inlines.hh.
References homogeneous_assign(), and PPL_DIRTY_TEMP_COEFFICIENT.
Referenced by Parma_Polyhedra_Library::Polyhedron::bounds(), Parma_Polyhedra_Library::Grid::bounds_no_check(), and homogeneous_sign().
00051 { 00052 PPL_DIRTY_TEMP_COEFFICIENT(z); 00053 homogeneous_assign(z, x, y); 00054 return sgn(z); 00055 }
| 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
coefficient of g is ignored, and assigns the result to z.
Definition at line 109 of file Scalar_Products.cc.
References Parma_Polyhedra_Library::add_mul_assign(), Parma_Polyhedra_Library::Row::size(), and Parma_Polyhedra_Library::Grid_Generator::size().
00111 { 00112 // The reduced scalar product is only defined if the topology of `x' 00113 // is NNC and `y' has enough coefficients. 00114 PPL_ASSERT(x.size() <= y.size()); 00115 z = 0; 00116 for (dimension_type i = x.size() - 1; i-- > 0; ) 00117 // The following line optimizes z += x[i] * y[i]. 00118 add_mul_assign(z, x[i], y[i]); 00119 }
| 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
coefficient of g is ignored, and assigns the result to z.
| 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
coefficient of c is ignored, and assigns the result to z.
| 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
coefficient of x is ignored, and assigns the result to z.
Definition at line 95 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().
00097 { 00098 // The reduced scalar product is only defined 00099 // if the topology of `x' is NNC and `y' has enough coefficients. 00100 PPL_ASSERT(!x.is_necessarily_closed()); 00101 PPL_ASSERT(x.size() - 1 <= y.size()); 00102 z = 0; 00103 for (dimension_type i = x.size() - 1; i-- > 0; ) 00104 // The following line optimizes the computation of z += x[i] * y[i]. 00105 add_mul_assign(z, x[i], y[i]); 00106 }
| 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
coefficient of g is ignored.
Definition at line 83 of file Scalar_Products.inlines.hh.
References reduced_sign().
00083 { 00084 return reduced_sign(static_cast<const Linear_Row&>(g), 00085 static_cast<const Linear_Row&>(c)); 00086 }
| 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
coefficient of c is ignored.
Definition at line 77 of file Scalar_Products.inlines.hh.
References reduced_sign().
00077 { 00078 return reduced_sign(static_cast<const Linear_Row&>(c), 00079 static_cast<const Linear_Row&>(g)); 00080 }
| 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
coefficient of x is ignored.
Definition at line 44 of file Scalar_Products.inlines.hh.
References PPL_DIRTY_TEMP_COEFFICIENT, and reduced_assign().
Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(), 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().
00044 { 00045 PPL_DIRTY_TEMP_COEFFICIENT(z); 00046 reduced_assign(z, x, y); 00047 return sgn(z); 00048 }
| 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 70 of file Scalar_Products.inlines.hh.
References assign(), and PPL_DIRTY_TEMP_COEFFICIENT.
00070 { 00071 PPL_DIRTY_TEMP_COEFFICIENT(z); 00072 assign(z, c, g); 00073 return sgn(z); 00074 }
| 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 64 of file Scalar_Products.inlines.hh.
References sign().
00064 { 00065 return sign(static_cast<const Linear_Row&>(g), 00066 static_cast<const Linear_Row&>(c)); 00067 }
| 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 58 of file Scalar_Products.inlines.hh.
References sign().
00058 { 00059 return sign(static_cast<const Linear_Row&>(c), 00060 static_cast<const Linear_Row&>(g)); 00061 }
| int Parma_Polyhedra_Library::Scalar_Products::sign | ( | const Linear_Row & | x, | |
| const Linear_Row & | y | |||
| ) | [inline, static] |
Returns the sign of the scalar product between x and y.
Definition at line 37 of file Scalar_Products.inlines.hh.
References assign(), and PPL_DIRTY_TEMP_COEFFICIENT.
Referenced by Parma_Polyhedra_Library::Polyhedron::BHRZ03_combining_constraints(), Parma_Polyhedra_Library::Polyhedron::is_included_in(), Parma_Polyhedra_Library::MIP_Problem::is_satisfied(), Parma_Polyhedra_Library::MIP_Problem::is_saturated(), Parma_Polyhedra_Library::Polyhedron::OK(), Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Sign::operator()(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Generator_System::relation_with(), Parma_Polyhedra_Library::Polyhedron::select_H79_constraints(), sign(), Parma_Polyhedra_Library::Polyhedron::simplify_using_context_assign(), Parma_Polyhedra_Library::Polyhedron::update_sat_c(), and Parma_Polyhedra_Library::Polyhedron::update_sat_g().
00037 { 00038 PPL_DIRTY_TEMP_COEFFICIENT(z); 00039 assign(z, x, y); 00040 return sgn(z); 00041 }
1.6.3