[PPL-devel] [GIT] ppl/ppl(floating_point): Always use Box instead of map for interval abstract stores.

Fabio Bossi bossi at cs.unipr.it
Wed Sep 23 10:25:43 CEST 2009


Module: ppl/ppl
Branch: floating_point
Commit: 230e752faf022e041afa79aa1e7f1a4250a3e0bb
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=230e752faf022e041afa79aa1e7f1a4250a3e0bb

Author: Fabio Bossi <bossi at cs.unipr.it>
Date:   Wed Sep 23 12:24:25 2009 +0200

Always use Box instead of map for interval abstract stores.

---

 src/Octagonal_Shape.defs.hh      |    1 -
 src/Octagonal_Shape.templates.hh |    1 -
 src/Polyhedron.defs.hh           |    7 +++----
 src/Polyhedron.templates.hh      |   16 ++++++++--------
 4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/src/Octagonal_Shape.defs.hh b/src/Octagonal_Shape.defs.hh
index 81ddf92..42166af 100644
--- a/src/Octagonal_Shape.defs.hh
+++ b/src/Octagonal_Shape.defs.hh
@@ -47,7 +47,6 @@ site: http://www.cs.unipr.it/ppl/ . */
 #include "Interval.types.hh"
 #include "Linear_Form.types.hh"
 #include <vector>
-#include <map>
 #include <cstddef>
 #include <climits>
 #include <iosfwd>
diff --git a/src/Octagonal_Shape.templates.hh b/src/Octagonal_Shape.templates.hh
index 04906d6..628e791 100644
--- a/src/Octagonal_Shape.templates.hh
+++ b/src/Octagonal_Shape.templates.hh
@@ -33,7 +33,6 @@ site: http://www.cs.unipr.it/ppl/ . */
 #include "Box.defs.hh"
 #include "assert.hh"
 #include <vector>
-#include <map>
 #include <deque>
 #include <string>
 #include <iostream>
diff --git a/src/Polyhedron.defs.hh b/src/Polyhedron.defs.hh
index b402794..f2854b4 100644
--- a/src/Polyhedron.defs.hh
+++ b/src/Polyhedron.defs.hh
@@ -50,7 +50,6 @@ site: http://www.cs.unipr.it/ppl/ . */
 #include "Interval.types.hh"
 #include "Linear_Form.types.hh"
 #include <vector>
-#include <map>
 #include <iosfwd>
 
 namespace Parma_Polyhedra_Library {
@@ -1009,7 +1008,7 @@ public:
   void refine_with_linear_form_inequality(
   const Linear_Form< Interval<FP_Format, Interval_Info> >& left,
   const Linear_Form< Interval<FP_Format, Interval_Info> >& right,
-  const std::map< dimension_type, Interval<FP_Format, Interval_Info> >& store);
+  const Box< Interval<FP_Format, Interval_Info> >& store);
 
   //! Refines \p store with the constraints defining \p *this.
   /*!
@@ -1215,7 +1214,7 @@ public:
   template <typename FP_Format, typename Interval_Info>
   void affine_image(Variable var,
   const Linear_Form<Interval <FP_Format, Interval_Info> >& lf,
-  const std::map< dimension_type, Interval<FP_Format, Interval_Info> >& store);
+  const Box< Interval<FP_Format, Interval_Info> >& store);
 
   /*! \brief
     Assigns to \p *this the
@@ -2661,7 +2660,7 @@ protected:
   static void overapproximate_linear_form(
   const Linear_Form<Interval <FP_Format, Interval_Info> >& lf,
   const dimension_type lf_dimension,
-  const std::map< dimension_type, Interval<FP_Format, Interval_Info> >& store,
+  const Box< Interval<FP_Format, Interval_Info> >& store,
   Linear_Form<Interval <FP_Format, Interval_Info> >& result);
 
   /*! \brief
diff --git a/src/Polyhedron.templates.hh b/src/Polyhedron.templates.hh
index c312028..ed58841 100644
--- a/src/Polyhedron.templates.hh
+++ b/src/Polyhedron.templates.hh
@@ -28,7 +28,6 @@ site: http://www.cs.unipr.it/ppl/ . */
 #include "Interval.defs.hh"
 #include "Linear_Form.defs.hh"
 #include <algorithm>
-#include <map>
 #include <deque>
 
 namespace Parma_Polyhedra_Library {
@@ -301,7 +300,7 @@ void
 Polyhedron::refine_with_linear_form_inequality(
   const Linear_Form< Interval<FP_Format, Interval_Info> >& left,
   const Linear_Form< Interval<FP_Format, Interval_Info> >& right,
-  const std::map< dimension_type, Interval<FP_Format, Interval_Info> >& store) {
+  const Box< Interval<FP_Format, Interval_Info> >& store) {
 
   // Check that FP_Format is indeed a floating point type.
   PPL_COMPILE_TIME_CHECK(!std::numeric_limits<FP_Format>::is_exact,
@@ -347,7 +346,7 @@ template <typename FP_Format, typename Interval_Info>
 void
 Polyhedron::affine_image(const Variable var,
 const Linear_Form<Interval <FP_Format, Interval_Info> >& lf,
-const std::map< dimension_type, Interval<FP_Format, Interval_Info> >& store) {
+const Box< Interval<FP_Format, Interval_Info> >& store) {
 
   // Check that FP_Format is indeed a floating point type.
   PPL_COMPILE_TIME_CHECK(!std::numeric_limits<FP_Format>::is_exact,
@@ -392,7 +391,7 @@ void
 Polyhedron::overapproximate_linear_form(
   const Linear_Form<Interval <FP_Format, Interval_Info> >& lf,
   const dimension_type lf_dimension,
-  const std::map< dimension_type, Interval<FP_Format, Interval_Info> >& store,
+  const Box< Interval<FP_Format, Interval_Info> >& store,
   Linear_Form<Interval <FP_Format, Interval_Info> >& result) {
 
   // Check that FP_Format is indeed a floating point type.
@@ -400,9 +399,11 @@ Polyhedron::overapproximate_linear_form(
                          "Polyhedron::overapproximate_linear_form:"
                          " FP_Format not a floating point type.");
 
+  PPL_ASSERT(lf_dimension <= store.space_dimension());
+
   typedef Interval<FP_Format, Interval_Info> FP_Interval_Type;
   typedef Linear_Form<FP_Interval_Type> FP_Linear_Form;
-  typedef std::map<dimension_type, FP_Interval_Type> Interval_Abstract_Store;
+  typedef Box<FP_Interval_Type> Interval_Abstract_Store;
 
   result = FP_Linear_Form(lf.inhomogeneous_term());
   // FIXME: this may not be policy-neutral.
@@ -416,11 +417,10 @@ Polyhedron::overapproximate_linear_form(
     FP_Format curr_lb = curr_coeff.lower();
     FP_Format curr_ub = curr_coeff.upper();
     if (curr_lb != 0 || curr_ub != 0) {
-      typename Interval_Abstract_Store::const_iterator i_ite = store.find(i);
-      PPL_ASSERT(i_ite != store.end());
+      const FP_Interval_Type& curr_int = store.get_iterval(Variable(i));
       FP_Interval_Type curr_addend(curr_ub - curr_lb);
       curr_addend *= aux_divisor2;
-      curr_addend *= i_ite->second;
+      curr_addend *= curr_int;
       result += curr_addend;
       curr_addend = FP_Interval_Type(curr_lb + curr_ub);
       curr_addend *= aux_divisor1;




More information about the PPL-devel mailing list