Parma_Polyhedra_Library::Congruences_Reduction< D1, D2 > Class Template Reference
[C++ Language Interface]

This class provides the reduction method for the Congruences_Product domain. More...

#include <Partially_Reduced_Product.defs.hh>

List of all members.

Public Member Functions

 Congruences_Reduction ()
 Default constructor.
void product_reduce (D1 &d1, D2 &d2)
 The congruences reduction operator for detect emptiness or any equalities implied by each of the congruences defining one of the components and the bounds of the other component. It is assumed that the components are already constraints reduced.
 ~Congruences_Reduction ()
 Destructor.

Detailed Description

template<typename D1, typename D2>
class Parma_Polyhedra_Library::Congruences_Reduction< D1, D2 >

This class provides the reduction method for the Congruences_Product domain.

The reduction classes are used to instantiate the Partially_Reduced_Product domain.

This class uses the minimized congruences defining each of the components. For each of the congruences, it checks if the other component intersects none, one or more than one hyperplane defined by the congruence and adds equalities or emptiness as appropriate; in more detail: Letting the components be d1 and d2, then, for each congruence cg representing d1:

Definition at line 193 of file Partially_Reduced_Product.defs.hh.


Constructor & Destructor Documentation

template<typename D1 , typename D2 >
Parma_Polyhedra_Library::Congruences_Reduction< D1, D2 >::Congruences_Reduction (  )  [inline]

Default constructor.

Definition at line 781 of file Partially_Reduced_Product.inlines.hh.

00781                                                      {
00782 }

template<typename D1 , typename D2 >
Parma_Polyhedra_Library::Congruences_Reduction< D1, D2 >::~Congruences_Reduction (  )  [inline]

Destructor.

Definition at line 786 of file Partially_Reduced_Product.inlines.hh.

00786                                                       {
00787 }


Member Function Documentation

template<typename D1 , typename D2 >
void Parma_Polyhedra_Library::Congruences_Reduction< D1, D2 >::product_reduce ( D1 &  d1,
D2 &  d2 
) [inline]

The congruences reduction operator for detect emptiness or any equalities implied by each of the congruences defining one of the components and the bounds of the other component. It is assumed that the components are already constraints reduced.

The minimized congruence system defining the domain element d1 is used to check if d2 intersects none, one or more than one of the hyperplanes defined by the congruences: if it intersects none, then product is set empty; if it intersects one, then the equality defining this hyperplane is added to both components; otherwise, the product is unchanged. In each case, the donor domain must provide a congruence system in minimal form.

Parameters:
d1 A pointset domain element;
d2 A pointset domain element;

Definition at line 579 of file Partially_Reduced_Product.templates.hh.

References Parma_Polyhedra_Library::Congruence_System::begin(), Parma_Polyhedra_Library::Congruence_System::end(), Parma_Polyhedra_Library::Congruence::is_equality(), Parma_Polyhedra_Library::Smash_Reduction< D1, D2 >::product_reduce(), and Parma_Polyhedra_Library::shrink_to_congruence_no_check().

Referenced by Parma_Polyhedra_Library::Shape_Preserving_Reduction< D1, D2 >::product_reduce().

00579                                                               {
00580   if (d1.is_empty() || d2.is_empty()) {
00581     // If one of the components is empty, do the smash reduction and return.
00582     Parma_Polyhedra_Library::Smash_Reduction<D1, D2> sr;
00583     sr.product_reduce(d1, d2);
00584     return;
00585   }
00586   // Use the congruences representing d1 to shrink both components.
00587   const Congruence_System cgs1 = d1.minimized_congruences();
00588   for (Congruence_System::const_iterator i = cgs1.begin(),
00589          cgs_end = cgs1.end(); i != cgs_end; ++i) {
00590     const Congruence& cg1 = *i;
00591     if (cg1.is_equality())
00592       d2.refine_with_congruence(cg1);
00593     else
00594       if (!Parma_Polyhedra_Library::
00595           shrink_to_congruence_no_check(d1, d2, cg1))
00596         // The product is empty.
00597         return;
00598   }
00599   // Use the congruences representing d2 to shrink both components.
00600   const Congruence_System cgs2 = d2.minimized_congruences();
00601   for (Congruence_System::const_iterator i = cgs2.begin(),
00602          cgs_end = cgs2.end(); i != cgs_end; ++i) {
00603     const Congruence& cg2 = *i;
00604     if (cg2.is_equality())
00605       d1.refine_with_congruence(cg2);
00606     else
00607       if (!Parma_Polyhedra_Library::
00608           shrink_to_congruence_no_check(d2, d1, cg2))
00609         // The product is empty.
00610         return;
00611   }
00612 }


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