[PPL-devel] [GIT] ppl/ppl(floating_point): Added a first, untested implementation of
Fabio Bossi
bossi at cs.unipr.it
Tue Sep 15 18:03:36 CEST 2009
Module: ppl/ppl
Branch: floating_point
Commit: 27853708a791db900a1c40ff490f5a5c630f9559
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=27853708a791db900a1c40ff490f5a5c630f9559
Author: Fabio Bossi <bossi at cs.unipr.it>
Date: Tue Sep 15 18:06:23 2009 +0200
Added a first, untested implementation of
refine_fp_interval_abstract_store.
---
src/Octagonal_Shape.defs.hh | 5 ++++
src/Octagonal_Shape.templates.hh | 43 ++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/src/Octagonal_Shape.defs.hh b/src/Octagonal_Shape.defs.hh
index 1ed356b..536d9bc 100644
--- a/src/Octagonal_Shape.defs.hh
+++ b/src/Octagonal_Shape.defs.hh
@@ -47,6 +47,7 @@ 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>
@@ -1696,6 +1697,10 @@ public:
*/
void fold_space_dimensions(const Variables_Set& vars, Variable dest);
+ template <typename Interval_Info>
+ void refine_fp_interval_abstract_store(
+ std::map< dimension_type, Interval<T, Interval_Info> >& store);
+
//@} // Member Functions that May Modify the Dimension of the Vector Space
PPL_OUTPUT_DECLARATIONS
diff --git a/src/Octagonal_Shape.templates.hh b/src/Octagonal_Shape.templates.hh
index 46cf817..9251559 100644
--- a/src/Octagonal_Shape.templates.hh
+++ b/src/Octagonal_Shape.templates.hh
@@ -5231,6 +5231,49 @@ interval_coefficient_upper_bound(const N& var_ub, const N& minus_var_ub,
}
template <typename T>
+template <typename Interval_Info>
+void
+Octagonal_Shape<T>::
+refine_fp_interval_abstract_store(
+ std::map< dimension_type, Interval<T, Interval_Info> >& store) {
+
+ // Check that T is a floating point type.
+ PPL_ASSERT(!std::numeric_limits<T>::is_exact);
+
+ strong_closure_assign();
+
+ typedef Interval<T, Interval_Info> FP_Interval_Type;
+ typedef typename std::map<dimension_type, FP_Interval_Type>::iterator
+ Map_Iterator;
+
+ PPL_DIRTY_TEMP(N, upper_bound);
+ Map_Iterator store_end = store.end();
+ for (Map_Iterator ite = store.begin(); ite != store_end; ++ite) {
+ dimension_type curr_var = ite->first;
+ PPL_ASSERT(curr_var < space_dim);
+ dimension_type n_curr_var = curr_var * 2;
+ FP_Interval_Type& curr_int = &(ite->second);
+ T& lb = curr_int.lower();
+ T& ub = curr_int.upper();
+ // FIXME: are we sure that ROUND_IGNORE is good?
+ // Now get the upper bound for curr_var in the octagon.
+ assign_r(upper_bound, matrix[n_curr_var+1][n_curr_var], ROUND_NOT_NEEDED);
+ div_2exp_assign_r(upper_bound, upper_bound, 1, ROUND_IGNORE);
+
+ if (upper_bound < ub)
+ ub = upper_bound;
+
+ // Now get the lower bound for curr_var in the octagon.
+ neg_assign_r(upper_bound, matrix[n_curr_var][n_curr_var+1],
+ ROUND_NOT_NEEDED);
+ div_2exp_assign_r(upper_bound, upper_bound, 1, ROUND_IGNORE);
+
+ if (upper_bound > lb)
+ lb = upper_bound;
+ }
+}
+
+template <typename T>
void
Octagonal_Shape<T>::affine_preimage(const Variable var,
const Linear_Expression& expr,
More information about the PPL-devel
mailing list