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. | |
| 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. | |
| ~Shape_Preserving_Reduction () | |
| Destructor. | |
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 equalitites the shapes of the domains are unaltered.
Definition at line 243 of file Partially_Reduced_Product.defs.hh.
| Parma_Polyhedra_Library::Shape_Preserving_Reduction< D1, D2 >::Shape_Preserving_Reduction | ( | ) | [inline] |
Default constructor.
Definition at line 791 of file Partially_Reduced_Product.inlines.hh.
| Parma_Polyhedra_Library::Shape_Preserving_Reduction< D1, D2 >::~Shape_Preserving_Reduction | ( | ) | [inline] |
| void Parma_Polyhedra_Library::Shape_Preserving_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.
| d1 | A pointset domain element; | |
| d2 | A pointset domain element; |
Definition at line 616 of file Partially_Reduced_Product.templates.hh.
References Parma_Polyhedra_Library::Constraint_System::begin(), Parma_Polyhedra_Library::Constraint_System::clear(), Parma_Polyhedra_Library::Constraint_System::end(), Parma_Polyhedra_Library::Constraint_System::insert(), Parma_Polyhedra_Library::Constraint::is_equality(), Parma_Polyhedra_Library::Checked::le, PPL_DIRTY_TEMP_COEFFICIENT, Parma_Polyhedra_Library::Constraints_Reduction< D1, D2 >::product_reduce(), and Parma_Polyhedra_Library::Congruences_Reduction< D1, D2 >::product_reduce().
00616 { 00617 // First do the congruences reduction. 00618 Parma_Polyhedra_Library::Congruences_Reduction<D1, D2> cgr; 00619 cgr.product_reduce(d1, d2); 00620 if (d1.is_empty()) 00621 return; 00622 00623 PPL_DIRTY_TEMP_COEFFICIENT(freq_n); 00624 PPL_DIRTY_TEMP_COEFFICIENT(freq_d); 00625 PPL_DIRTY_TEMP_COEFFICIENT(val_n); 00626 PPL_DIRTY_TEMP_COEFFICIENT(val_d); 00627 00628 // Use the constraints representing d2. 00629 Constraint_System cs = d2.minimized_constraints(); 00630 Constraint_System refining_cs; 00631 for (Constraint_System::const_iterator i = cs.begin(), 00632 cs_end = cs.end(); i != cs_end; ++i) { 00633 const Constraint& c = *i; 00634 if (c.is_equality()) 00635 continue; 00636 // Check the frequency and value of the linear expression for 00637 // the constraint `c'. 00638 Linear_Expression le(c); 00639 if (!d1.frequency(le, freq_n, freq_d, val_n, val_d)) 00640 // Nothing to do. 00641 continue; 00642 if (val_n == 0) 00643 // Nothing to do. 00644 continue; 00645 // Adjust the value of the inhomogeneous term to satisfy 00646 // the implied congruence. 00647 if (val_n < 0) { 00648 val_n = val_n*freq_d + val_d*freq_n; 00649 val_d *= freq_d; 00650 } 00651 le *= val_d; 00652 le -= val_n; 00653 refining_cs.insert(le >= 0); 00654 } 00655 d2.refine_with_constraints(refining_cs); 00656 00657 // Use the constraints representing d1. 00658 cs = d1.minimized_constraints(); 00659 refining_cs.clear(); 00660 for (Constraint_System::const_iterator i = cs.begin(), 00661 cs_end = cs.end(); i != cs_end; ++i) { 00662 const Constraint& c = *i; 00663 if (c.is_equality()) 00664 // Equalities aleady shared. 00665 continue; 00666 // Check the frequency and value of the linear expression for 00667 // the constraint `c'. 00668 Linear_Expression le(c); 00669 if (!d2.frequency(le, freq_n, freq_d, val_n, val_d)) 00670 // Nothing to do. 00671 continue; 00672 if (val_n == 0) 00673 // Nothing to do. 00674 continue; 00675 // Adjust the value of the inhomogeneous term to satisfy 00676 // the implied congruence. 00677 if (val_n < 0) { 00678 val_n = val_n*freq_d + val_d*freq_n; 00679 val_d *= freq_d; 00680 } 00681 le *= val_d; 00682 le -= val_n; 00683 refining_cs.insert(le >= 0); 00684 } 00685 d1.refine_with_constraints(refining_cs); 00686 00687 // The reduction may have introduced additional equalities 00688 // so these must be shared with the other component. 00689 Parma_Polyhedra_Library::Constraints_Reduction<D1, D2> cr; 00690 cr.product_reduce(d1, d2); 00691 }
1.6.3