[PPL-devel] [GIT] ppl/ppl(master): Fixed a couple of name hiding issues in Expression_Hide_Inhomo adapter.
Enea Zaffanella
zaffanella at cs.unipr.it
Tue Aug 14 16:29:39 CEST 2012
Module: ppl/ppl
Branch: master
Commit: 19bb7a9c716c6b4bbd1b61a0a5dd39170fbed5e7
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=19bb7a9c716c6b4bbd1b61a0a5dd39170fbed5e7
Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date: Tue Aug 14 16:26:45 2012 +0200
Fixed a couple of name hiding issues in Expression_Hide_Inhomo adapter.
This commit is meanto to be part of 9e4c9c57ae8ffca73bb9ee6c75a43d6ed6cd4096
---
src/BD_Shape.templates.hh | 20 ++++++++++++--------
src/Expression_Hide_Inhomo.defs.hh | 13 +++++++++++++
src/Expression_Hide_Inhomo.inlines.hh | 19 +++++++++++++++++++
src/Generator.defs.hh | 4 ----
4 files changed, 44 insertions(+), 12 deletions(-)
diff --git a/src/BD_Shape.templates.hh b/src/BD_Shape.templates.hh
index 6649a27..f5aad6e 100644
--- a/src/BD_Shape.templates.hh
+++ b/src/BD_Shape.templates.hh
@@ -90,14 +90,16 @@ BD_Shape<T>::BD_Shape(const Generator_System& gs)
const Coefficient& g_i = g.expression().get(Variable(i - 1));
DB_Row<N>& dbm_i = dbm[i];
for (dimension_type j = space_dim; j > 0; --j)
- if (i != j)
- div_round_up(dbm_i[j],
- g.expression().get(Variable(j - 1)) - g_i,
- d);
+ if (i != j) {
+ const Coefficient& g_j = g.expression().get(Variable(j - 1));
+ div_round_up(dbm_i[j], g_j - g_i, d);
+ }
div_round_up(dbm_i[0], -g_i, d);
}
- for (dimension_type j = space_dim; j > 0; --j)
- div_round_up(dbm_0[j], g.expression().get(Variable(j - 1)), d);
+ for (dimension_type j = space_dim; j > 0; --j) {
+ const Coefficient& g_j = g.expression().get(Variable(j - 1));
+ div_round_up(dbm_0[j], g_j, d);
+ }
// Note: no need to initialize the first element of the main diagonal.
}
else {
@@ -111,14 +113,16 @@ BD_Shape<T>::BD_Shape(const Generator_System& gs)
DB_Row<N>& dbm_i = dbm[i];
// The loop correctly handles the case when i == j.
for (dimension_type j = space_dim; j > 0; --j) {
- div_round_up(tmp, g.expression().get(Variable(j - 1)) - g_i, d);
+ const Coefficient& g_j = g.expression().get(Variable(j - 1));
+ div_round_up(tmp, g_j - g_i, d);
max_assign(dbm_i[j], tmp);
}
div_round_up(tmp, -g_i, d);
max_assign(dbm_i[0], tmp);
}
for (dimension_type j = space_dim; j > 0; --j) {
- div_round_up(tmp, g.expression().get(Variable(j - 1)), d);
+ const Coefficient& g_j = g.expression().get(Variable(j - 1));
+ div_round_up(tmp, g_j, d);
max_assign(dbm_0[j], tmp);
}
}
diff --git a/src/Expression_Hide_Inhomo.defs.hh b/src/Expression_Hide_Inhomo.defs.hh
index b6386dd..ffe2076 100644
--- a/src/Expression_Hide_Inhomo.defs.hh
+++ b/src/Expression_Hide_Inhomo.defs.hh
@@ -55,6 +55,15 @@ public:
//! Returns the i-th coefficient.
Coefficient_traits::const_reference get(dimension_type i) const;
+ //! Returns the coefficient of v.
+ Coefficient_traits::const_reference get(Variable v) const;
+
+ /*! \brief
+ Returns <CODE>true</CODE> if the coefficient of each variable in
+ \p vars[i] is \f$0\f$.
+ */
+ bool all_zeroes(const Variables_Set& vars) const;
+
/*! \brief
Returns <CODE>true</CODE> if (*this)[i] is \f$0\f$, for each i in
[start, end).
@@ -72,6 +81,10 @@ public:
*/
Coefficient gcd(dimension_type start, dimension_type end) const;
+ //! Returns the index of the last nonzero element, or 0 if there are no
+ //! nonzero elements.
+ dimension_type last_nonzero() const;
+
//! Returns the index of the last nonzero element in [first,last), or last
//! if there are no nonzero elements.
dimension_type last_nonzero(dimension_type first, dimension_type last) const;
diff --git a/src/Expression_Hide_Inhomo.inlines.hh b/src/Expression_Hide_Inhomo.inlines.hh
index 16e2b2e..603a0bd 100644
--- a/src/Expression_Hide_Inhomo.inlines.hh
+++ b/src/Expression_Hide_Inhomo.inlines.hh
@@ -67,6 +67,19 @@ Expression_Hide_Inhomo<T>::get(dimension_type i) const {
}
template <typename T>
+inline Coefficient_traits::const_reference
+Expression_Hide_Inhomo<T>::get(Variable v) const {
+ return this->obj_expr().get(v);
+}
+
+template <typename T>
+inline bool
+Expression_Hide_Inhomo<T>
+::all_zeroes(const Variables_Set& vars) const {
+ return this->obj_expr().all_zeroes(vars);
+}
+
+template <typename T>
inline bool
Expression_Hide_Inhomo<T>::all_zeroes(dimension_type start,
dimension_type end) const {
@@ -105,6 +118,12 @@ Expression_Hide_Inhomo<T>::gcd(dimension_type start,
template <typename T>
inline dimension_type
+Expression_Hide_Inhomo<T>::last_nonzero() const {
+ return this->obj_expr().last_nonzero();
+}
+
+template <typename T>
+inline dimension_type
Expression_Hide_Inhomo<T>::last_nonzero(dimension_type first,
dimension_type last) const {
if (first == last)
diff --git a/src/Generator.defs.hh b/src/Generator.defs.hh
index ae931fa..d3d9b7c 100644
--- a/src/Generator.defs.hh
+++ b/src/Generator.defs.hh
@@ -736,10 +736,6 @@ private:
friend class Parma_Polyhedra_Library::MIP_Problem;
friend class Parma_Polyhedra_Library::Grid;
- // friend
- // Parma_Polyhedra_Library
- // ::Linear_Expression::Linear_Expression(const Generator& g);
-
friend std::ostream&
Parma_Polyhedra_Library::IO_Operators::operator<<(std::ostream& s,
const Generator& g);
More information about the PPL-devel
mailing list