[PPL-devel] [GIT] ppl/ppl(master): Added drop_some_non_integer_points( const Variables_Set& vars,
Patricia Hill
p.m.hill at leeds.ac.uk
Sat Apr 10 21:40:48 CEST 2010
Module: ppl/ppl
Branch: master
Commit: b42b6e35ad512a633e2991d633bc95d28af1d9bf
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=b42b6e35ad512a633e2991d633bc95d28af1d9bf
Author: Patricia Hill <p.m.hill at leeds.ac.uk>
Date: Sat Apr 10 20:39:11 2010 +0100
Added drop_some_non_integer_points(const Variables_Set& vars,
Complexity_Class complexity
= ANY_COMPLEXITY)
---
...erface_generator_common_procedure_generators.m4 | 4 +-
src/Partially_Reduced_Product.defs.hh | 19 +++++++++++
src/Partially_Reduced_Product.inlines.hh | 11 ++++++
.../dropsomenonintegerpoints1.cc | 35 ++++++++++++++++++++
4 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/interfaces/ppl_interface_generator_common_procedure_generators.m4 b/interfaces/ppl_interface_generator_common_procedure_generators.m4
index e93d96b..ff0dda7 100644
--- a/interfaces/ppl_interface_generator_common_procedure_generators.m4
+++ b/interfaces/ppl_interface_generator_common_procedure_generators.m4
@@ -90,8 +90,8 @@ ppl_ at CLASS@_remove_higher_space_dimensions/2 *nofail +all,
ppl_ at CLASS@_expand_space_dimension/3 *nofail +all,
ppl_ at CLASS@_fold_space_dimensions/3 +all,
ppl_ at CLASS@_map_space_dimensions/2 +all,
-ppl_ at CLASS@_drop_some_non_integer_points/2 +simple,
-ppl_ at CLASS@_drop_some_non_integer_points_2/3 +simple,
+ppl_ at CLASS@_drop_some_non_integer_points/2 +all,
+ppl_ at CLASS@_drop_some_non_integer_points_2/3 +all,
ppl_ at CLASS@_ascii_dump/1 +all,
ppl_ at CLASS@_ at MEMBYTES@/2 +all,
dnl
diff --git a/src/Partially_Reduced_Product.defs.hh b/src/Partially_Reduced_Product.defs.hh
index bb6079f..7e2a97b 100644
--- a/src/Partially_Reduced_Product.defs.hh
+++ b/src/Partially_Reduced_Product.defs.hh
@@ -1371,6 +1371,25 @@ public:
void drop_some_non_integer_points(Complexity_Class complexity
= ANY_COMPLEXITY);
+ /*! \brief
+ Possibly tightens \p *this by dropping some points with non-integer
+ coordinates for the space dimensions corresponding to \p vars.
+
+ \param vars
+ Points with non-integer coordinates for these variables/space-dimensions
+ can be discarded.
+
+ \param complexity
+ The maximal complexity of any algorithms used.
+
+ \note
+ Currently there is no optimality guarantee, not even if
+ \p complexity is <CODE>ANY_COMPLEXITY</CODE>.
+ */
+ void drop_some_non_integer_points(const Variables_Set& vars,
+ Complexity_Class complexity
+ = ANY_COMPLEXITY);
+
//@} // Space Dimension Preserving Member Functions that May Modify [...]
//! \name Member Functions that May Modify the Dimension of the Vector Space
diff --git a/src/Partially_Reduced_Product.inlines.hh b/src/Partially_Reduced_Product.inlines.hh
index eacbddd..a4c0929 100644
--- a/src/Partially_Reduced_Product.inlines.hh
+++ b/src/Partially_Reduced_Product.inlines.hh
@@ -454,6 +454,17 @@ Partially_Reduced_Product<D1, D2, R>
}
template <typename D1, typename D2, typename R>
+inline void
+Partially_Reduced_Product<D1, D2, R>
+::drop_some_non_integer_points(const Variables_Set& vars,
+ Complexity_Class complexity) {
+ reduce();
+ d1.drop_some_non_integer_points(vars, complexity);
+ d2.drop_some_non_integer_points(vars, complexity);
+ clear_reduced_flag();
+}
+
+template <typename D1, typename D2, typename R>
inline Partially_Reduced_Product<D1, D2, R>&
Partially_Reduced_Product<D1, D2, R>
::operator=(const Partially_Reduced_Product& y) {
diff --git a/tests/Partially_Reduced_Product/dropsomenonintegerpoints1.cc b/tests/Partially_Reduced_Product/dropsomenonintegerpoints1.cc
index 729e682..3b9cf0c 100644
--- a/tests/Partially_Reduced_Product/dropsomenonintegerpoints1.cc
+++ b/tests/Partially_Reduced_Product/dropsomenonintegerpoints1.cc
@@ -88,9 +88,44 @@ test02() {
return ok;
}
+// drop_some_non_integer_points(vars, ANY_COMPLEXITY)
+bool
+test03() {
+ Variable A(0);
+ Variable B(1);
+ Variable C(2);
+
+ Variables_Set vars;
+ vars.insert(A);
+
+ Product prp1(3);
+ prp1.refine_with_constraint(A >= 0);
+ prp1.refine_with_constraint(B >= 0);
+ prp1.refine_with_constraint(A + B >= 3);
+ prp1.refine_with_constraint(2*A - B == 0);
+ prp1.refine_with_constraint(3*A + C == 0);
+ prp1.refine_with_congruence(3*A %= 0);
+
+ prp1.drop_some_non_integer_points(vars, ANY_COMPLEXITY);
+
+ Product known_prp(3);
+ known_prp.refine_with_constraint(3*A + C == 0);
+ known_prp.refine_with_constraint(2*A - B == 0);
+ known_prp.refine_with_constraint(A >= 1);
+ known_prp.refine_with_congruence(A %= 0);
+
+ bool ok = (prp1 == known_prp);
+
+ print_congruences(prp1, "*** prp1.time_elapse_assign(prp1) congruences ***");
+ print_constraints(prp1, "*** prp1.time_elapse_assign(prp1) constraints ***");
+
+ return ok;
+}
+
} // namespace
BEGIN_MAIN
DO_TEST_F8(test01);
DO_TEST(test02);
+ DO_TEST_F8(test03);
END_MAIN
More information about the PPL-devel
mailing list