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

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

#include <Partially_Reduced_Product_defs.hh>

Public Member Functions

 Shape_Preserving_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...
 
 ~Shape_Preserving_Reduction ()
 Destructor. More...
 

Detailed Description

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

This class provides the reduction method for the Shape_Preserving_Product domain.

The reduction classes are used to instantiate the Partially_Reduced_Product domain.

This reduction method includes the congruences reduction. This class uses the minimized constraints defining each of the components. For each of the constraints, it checks the frequency and value for the same linear expression in the other component. If the constraint does not satisfy the implied congruence, the inhomogeneous term is adjusted so that it does. Note that, unless the congruences reduction adds equalities, the shapes of the domains are unaltered.

Definition at line 249 of file Partially_Reduced_Product_defs.hh.

Constructor & Destructor Documentation

template<typename D1 , typename D2 >
Parma_Polyhedra_Library::Shape_Preserving_Reduction< D1, D2 >::Shape_Preserving_Reduction ( )
inline

Default constructor.

Definition at line 801 of file Partially_Reduced_Product_inlines.hh.

801  {
802 }
template<typename D1 , typename D2 >
Parma_Polyhedra_Library::Shape_Preserving_Reduction< D1, D2 >::~Shape_Preserving_Reduction ( )
inline

Destructor.

Definition at line 806 of file Partially_Reduced_Product_inlines.hh.

806  {
807 }

Member Function Documentation

template<typename D1 , typename D2 >
void Parma_Polyhedra_Library::Shape_Preserving_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 677 of file Partially_Reduced_Product_templates.hh.

References Parma_Polyhedra_Library::Constraint_System::begin(), c, Parma_Polyhedra_Library::Constraint_System::clear(), Parma_Polyhedra_Library::Constraint_System::end(), Parma_Polyhedra_Library::Constraint::expression(), Parma_Polyhedra_Library::Constraint_System::insert(), Parma_Polyhedra_Library::Constraint::is_equality(), Parma_Polyhedra_Library::Boundary_NS::le(), PPL_DIRTY_TEMP_COEFFICIENT, Parma_Polyhedra_Library::Constraints_Reduction< D1, D2 >::product_reduce(), and Parma_Polyhedra_Library::Congruences_Reduction< D1, D2 >::product_reduce().

677  {
678  // First do the congruences reduction.
680  cgr.product_reduce(d1, d2);
681  if (d1.is_empty()) {
682  return;
683  }
684 
689 
690  // Use the constraints representing d2.
691  Constraint_System cs = d2.minimized_constraints();
692  Constraint_System refining_cs;
693  for (Constraint_System::const_iterator i = cs.begin(),
694  cs_end = cs.end(); i != cs_end; ++i) {
695  const Constraint& c = *i;
696  if (c.is_equality()) {
697  continue;
698  }
699  // Check the frequency and value of the linear expression for
700  // the constraint `c'.
701  Linear_Expression le(c.expression());
702  if (!d1.frequency(le, freq_n, freq_d, val_n, val_d)) {
703  // Nothing to do.
704  continue;
705  }
706  if (val_n == 0) {
707  // Nothing to do.
708  continue;
709  }
710  // Adjust the value of the inhomogeneous term to satisfy
711  // the implied congruence.
712  if (val_n < 0) {
713  val_n = val_n*freq_d + val_d*freq_n;
714  val_d *= freq_d;
715  }
716  le *= val_d;
717  le -= val_n;
718  refining_cs.insert(le >= 0);
719  }
720  d2.refine_with_constraints(refining_cs);
721 
722  // Use the constraints representing d1.
723  cs = d1.minimized_constraints();
724  refining_cs.clear();
725  for (Constraint_System::const_iterator i = cs.begin(),
726  cs_end = cs.end(); i != cs_end; ++i) {
727  const Constraint& c = *i;
728  if (c.is_equality()) {
729  // Equalities already shared.
730  continue;
731  }
732  // Check the frequency and value of the linear expression for
733  // the constraint `c'.
734  Linear_Expression le(c.expression());
735  if (!d2.frequency(le, freq_n, freq_d, val_n, val_d)) {
736  // Nothing to do.
737  continue;
738  }
739  if (val_n == 0) {
740  // Nothing to do.
741  continue;
742  }
743  // Adjust the value of the inhomogeneous term to satisfy
744  // the implied congruence.
745  if (val_n < 0) {
746  val_n = val_n*freq_d + val_d*freq_n;
747  val_d *= freq_d;
748  }
749  le *= val_d;
750  le -= val_n;
751  refining_cs.insert(le >= 0);
752  }
753  d1.refine_with_constraints(refining_cs);
754 
755  // The reduction may have introduced additional equalities
756  // so these must be shared with the other component.
758  cr.product_reduce(d1, d2);
759 }
void product_reduce(D1 &d1, D2 &d2)
The congruences reduction operator for detect emptiness or any equalities implied by each of the cong...
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
Declare a local variable named id, of type Coefficient, and containing an unknown initial value...
void product_reduce(D1 &d1, D2 &d2)
The constraints reduction operator for sharing constraints between the domains.
This class provides the reduction method for the Constraints_Product domain.
This class provides the reduction method for the Congruences_Product domain.
Coefficient c
Definition: PIP_Tree.cc:64
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Constraint_System_const_iterator const_iterator

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