PPL  1.2
Parma_Polyhedra_Library::Congruences_Reduction< D1, D2 > Class Template Reference

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

#include <Partially_Reduced_Product_defs.hh>

Public Member Functions

 Congruences_Reduction ()
 Default constructor. More...
 
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. More...
 
 ~Congruences_Reduction ()
 Destructor. More...
 

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:

  • if more than one hyperplane defined by cg intersects d2, then d1 and d2 are unchanged;
  • if exactly one hyperplane intersects d2, then d1 and d2 are refined with the corresponding equality ;
  • otherwise, d1 and d2 are set to empty. Unless d1 and d2 are already empty, the process is repeated where the roles of d1 and d2 are reversed. If d1 or d2 is empty, then the emptiness is propagated.

Definition at line 199 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 791 of file Partially_Reduced_Product_inlines.hh.

791  {
792 }
template<typename D1 , typename D2 >
Parma_Polyhedra_Library::Congruences_Reduction< D1, D2 >::~Congruences_Reduction ( )
inline

Destructor.

Definition at line 796 of file Partially_Reduced_Product_inlines.hh.

796  {
797 }

Member Function Documentation

template<typename D1 , typename D2 >
void Parma_Polyhedra_Library::Congruences_Reduction< D1, D2 >::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.

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
d1A pointset domain element;
d2A pointset domain element;

Definition at line 634 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().

634  {
635  if (d1.is_empty() || d2.is_empty()) {
636  // If one of the components is empty, do the smash reduction and return.
638  sr.product_reduce(d1, d2);
639  return;
640  }
641  // Use the congruences representing d1 to shrink both components.
642  const Congruence_System cgs1 = d1.minimized_congruences();
643  for (Congruence_System::const_iterator i = cgs1.begin(),
644  cgs_end = cgs1.end(); i != cgs_end; ++i) {
645  const Congruence& cg1 = *i;
646  if (cg1.is_equality()) {
647  d2.refine_with_congruence(cg1);
648  }
649  else {
651  shrink_to_congruence_no_check(d1, d2, cg1)) {
652  // The product is empty.
653  return;
654  }
655  }
656  }
657  // Use the congruences representing d2 to shrink both components.
658  const Congruence_System cgs2 = d2.minimized_congruences();
659  for (Congruence_System::const_iterator i = cgs2.begin(),
660  cgs_end = cgs2.end(); i != cgs_end; ++i) {
661  const Congruence& cg2 = *i;
662  if (cg2.is_equality()) {
663  d1.refine_with_congruence(cg2);
664  }
665  else {
667  shrink_to_congruence_no_check(d2, d1, cg2)) {
668  // The product is empty.
669  return;
670  }
671  }
672  }
673 }
bool shrink_to_congruence_no_check(D1 &d1, D2 &d2, const Congruence &cg)
The entire library is confined to this namespace.
Definition: version.hh:61
void product_reduce(D1 &d1, D2 &d2)
The smash reduction operator for propagating emptiness between the domain elements d1 and d2...
This class provides the reduction method for the Smash_Product domain.

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