[PPL-devel] [GIT] ppl/ppl(floating_point): Implemented Linear_Form::intervalize ( still not compiling,

Fabio Bossi bossi at cs.unipr.it
Wed Jul 21 15:20:24 CEST 2010


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

Author: Fabio Bossi <bossi at cs.unipr.it>
Date:   Wed Jul 21 15:18:30 2010 +0200

Implemented Linear_Form::intervalize (still not compiling,
probably due to some sort of cyclic dependency problem
between Grid and Box).

---

 src/Linear_Form.defs.hh      |    3 +++
 src/Linear_Form.templates.hh |   17 +++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/Linear_Form.defs.hh b/src/Linear_Form.defs.hh
index c80b605..f7ed492 100644
--- a/src/Linear_Form.defs.hh
+++ b/src/Linear_Form.defs.hh
@@ -26,6 +26,7 @@ site: http://www.cs.unipr.it/ppl/ . */
 #include "Linear_Form.types.hh"
 #include "Linear_Expression.types.hh"
 #include "Variable.defs.hh"
+#include "Box.types.hh"
 #include <vector>
 
 namespace Parma_Polyhedra_Library {
@@ -329,6 +330,8 @@ public:
   void relative_error(Floating_Point_Format analyzed_format,
                       Linear_Form& result) const;
 
+  void intervalize(const Box<C>& store, C& result) const;
+
 private:
   //! The generic coefficient equal to the singleton zero.
   static C zero;
diff --git a/src/Linear_Form.templates.hh b/src/Linear_Form.templates.hh
index 83e7c1f..666207e 100644
--- a/src/Linear_Form.templates.hh
+++ b/src/Linear_Form.templates.hh
@@ -24,6 +24,7 @@ site: http://www.cs.unipr.it/ppl/ . */
 #define PPL_Linear_Form_templates_hh 1
 
 #include "Linear_Expression.defs.hh"
+#include "Box.defs.hh"
 #include <stdexcept>
 #include <iostream>
 
@@ -445,6 +446,22 @@ Linear_Form<C>::relative_error(
   return;
 }
 
+template <typename C>
+void
+Linear_Form<C>::intervalize(const Box<C>& store, C& result) const {
+  result = C(inhomogeneous_term());
+  dimension_type dimension = space_dimension();
+  assert(dimension <= store.space_dimension());
+  for (dimension_type i = 0; i < dimension; ++i) {
+    C current_addend = coefficient(Variable(i));
+    const C& curr_int = store.get_interval(Variable(i));
+    current_addend *= curr_int;
+    result += current_addend;
+  }
+
+  return;
+}
+
 /*! \relates Parma_Polyhedra_Library::Linear_Form */
 template <typename C>
 std::ostream&




More information about the PPL-devel mailing list