[PPL-devel] [GIT] ppl/ppl(master): FIXME resolved.
Roberto Bagnara
bagnara at cs.unipr.it
Fri May 15 21:09:11 CEST 2009
Module: ppl/ppl
Branch: master
Commit: 1c9efaf9e303b17f107435b665d1aaab5ad1d269
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=1c9efaf9e303b17f107435b665d1aaab5ad1d269
Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date: Fri May 15 21:08:49 2009 +0200
FIXME resolved.
---
src/Octagonal_Shape.defs.hh | 6 ------
src/Octagonal_Shape.inlines.hh | 14 +++++++++++++-
src/Octagonal_Shape.templates.hh | 19 +++++++++++++++++++
3 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/src/Octagonal_Shape.defs.hh b/src/Octagonal_Shape.defs.hh
index 08f951a..f74577b 100644
--- a/src/Octagonal_Shape.defs.hh
+++ b/src/Octagonal_Shape.defs.hh
@@ -297,12 +297,6 @@ bool extract_octagonal_difference(const Constraint& c,
Coefficient& c_coeff,
Coefficient& c_term);
-#ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
-//! Returns the index coherent to \p i.
-/*! \relates Octagonal_Shape */
-#endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
-dimension_type coherent_index(dimension_type i);
-
} // namespace Parma_Polyhedra_Library
//! An octagonal shape.
diff --git a/src/Octagonal_Shape.inlines.hh b/src/Octagonal_Shape.inlines.hh
index b70391f..77fccd4 100644
--- a/src/Octagonal_Shape.inlines.hh
+++ b/src/Octagonal_Shape.inlines.hh
@@ -36,13 +36,23 @@ site: http://www.cs.unipr.it/ppl/ . */
namespace Parma_Polyhedra_Library {
-// FIXME: find the appropriate place for this.
+namespace Implementation {
+
+namespace Octagonal_Shapes {
+
+#ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
+//! Returns the index coherent to \p i.
/*! \relates Octagonal_Shape */
+#endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
inline dimension_type
coherent_index(const dimension_type i) {
return (i % 2 != 0) ? i-1 : i+1;
}
+} // namespace Octagonal_Shapes
+
+} // namespace Implementation
+
template <typename T>
inline dimension_type
Octagonal_Shape<T>::max_space_dimension() {
@@ -345,6 +355,7 @@ inline const typename Octagonal_Shape<T>::coefficient_type&
Octagonal_Shape<T>::matrix_at(const dimension_type i,
const dimension_type j) const {
assert(i < matrix.num_rows() && j < matrix.num_rows());
+ using namespace Implementation::Octagonal_Shapes;
return (j < matrix.row_size(i))
? matrix[i][j]
: matrix[coherent_index(j)][coherent_index(i)];
@@ -355,6 +366,7 @@ inline typename Octagonal_Shape<T>::coefficient_type&
Octagonal_Shape<T>::matrix_at(const dimension_type i,
const dimension_type j) {
assert(i < matrix.num_rows() && j < matrix.num_rows());
+ using namespace Implementation::Octagonal_Shapes;
return (j < matrix.row_size(i))
? matrix[i][j]
: matrix[coherent_index(j)][coherent_index(i)];
diff --git a/src/Octagonal_Shape.templates.hh b/src/Octagonal_Shape.templates.hh
index 6a041c8..df6de2d 100644
--- a/src/Octagonal_Shape.templates.hh
+++ b/src/Octagonal_Shape.templates.hh
@@ -431,6 +431,7 @@ Octagonal_Shape<T>::add_constraint(const Constraint& c) {
--i_iter;
typename OR_Matrix<N>::row_reference_type m_ci = *i_iter;
+ using namespace Implementation::Octagonal_Shapes;
dimension_type cj = coherent_index(j);
N& m_ci_cj = m_ci[cj];
// Also compute the bound for `m_ci_cj', rounding towards plus infinity.
@@ -527,6 +528,7 @@ Octagonal_Shape<T>::refine_no_check(const Constraint& c) {
--i_iter;
typename OR_Matrix<N>::row_reference_type m_ci = *i_iter;
+ using namespace Implementation::Octagonal_Shapes;
dimension_type cj = coherent_index(j);
N& m_ci_cj = m_ci[cj];
// Also compute the bound for `m_ci_cj', rounding towards plus infinity.
@@ -645,6 +647,7 @@ Octagonal_Shape<T>::minimized_congruences() const {
{
const N& c_i_li = matrix[i][lead_i];
#ifndef NDEBUG
+ using namespace Implementation::Octagonal_Shapes;
const N& c_ii_lii = matrix[i+1][coherent_index(lead_i)];
assert(is_additive_inverse(c_ii_lii, c_i_li));
#endif
@@ -773,6 +776,7 @@ Octagonal_Shape<T>::is_disjoint_from(const Octagonal_Shape& y) const {
PPL_DIRTY_TEMP(N, neg_y_ci_cj);
for (Row_Iterator i_iter = m_begin; i_iter != m_end; ++i_iter) {
+ using namespace Implementation::Octagonal_Shapes;
const dimension_type i = i_iter.index();
const dimension_type ci = coherent_index(i);
const dimension_type rs_i = i_iter.row_size();
@@ -939,6 +943,7 @@ Octagonal_Shape<T>::is_strong_coherent() const {
for (dimension_type i = num_rows; i-- > 0; ) {
typename OR_Matrix<N>::const_row_iterator iter = matrix.row_begin() + i;
typename OR_Matrix<N>::const_row_reference_type m_i = *iter;
+ using namespace Implementation::Octagonal_Shapes;
const N& m_i_ci = m_i[coherent_index(i)];
for (dimension_type j = matrix.row_size(i); j-- > 0; )
// Note: on the main diagonal only PLUS_INFINITY can occur.
@@ -1408,6 +1413,7 @@ Octagonal_Shape<T>::relation_with(const Constraint& c) const {
else
--i_iter;
typename OR_Matrix<N>::const_row_reference_type m_ci = *i_iter;
+ using namespace Implementation::Octagonal_Shapes;
const N& m_ci_cj = m_ci[coherent_index(j)];
PPL_DIRTY_TEMP_COEFFICIENT(numer);
PPL_DIRTY_TEMP_COEFFICIENT(denom);
@@ -1855,6 +1861,7 @@ Octagonal_Shape<T>::strong_closure_assign() const {
}
for (dimension_type i = 0; i < n_rows; ++i) {
+ using namespace Implementation::Octagonal_Shapes;
const dimension_type ci = coherent_index(i);
const N& vec_k_ci = vec_k[ci];
const N& vec_ck_ci = vec_ck[ci];
@@ -1918,6 +1925,7 @@ Octagonal_Shape<T>::strong_coherence_assign() {
i_end = matrix.row_end(); i_iter != i_end; ++i_iter) {
typename OR_Matrix<N>::row_reference_type x_i = *i_iter;
const dimension_type i = i_iter.index();
+ using namespace Implementation::Octagonal_Shapes;
const N& x_i_ci = x_i[coherent_index(i)];
// Avoid to do unnecessary sums.
if (!is_plus_infinity(x_i_ci))
@@ -2023,6 +2031,7 @@ Octagonal_Shape<T>
const dimension_type rs_v = v_iter.row_size();
const dimension_type n_rows = x.matrix.num_rows();
PPL_DIRTY_TEMP(N, sum);
+ using namespace Implementation::Octagonal_Shapes;
for (Row_Iterator k_iter = m_begin; k_iter != m_end; ++k_iter) {
const dimension_type k = k_iter.index();
const dimension_type ck = coherent_index(k);
@@ -2146,7 +2155,9 @@ Octagonal_Shape<T>
typename OR_Matrix<N>::const_row_reference_type m_ci
= (i % 2 != 0) ? *(i_iter-1) : *(i_iter+1);
for (dimension_type j = 0; j < i; ++j) {
+ // FIXME: what is the following, commented-out for?
//for (dimension_type j = i; j-- > 0; ) {
+ using namespace Implementation::Octagonal_Shapes;
dimension_type cj = coherent_index(j);
if (is_additive_inverse(m_ci[cj], m_i[j]))
// Choose as successor the variable having the greatest index.
@@ -2178,6 +2189,7 @@ Octagonal_Shape<T>
typename OR_Matrix<N>::const_row_reference_type m_ci
= (i % 2 != 0) ? *(i_iter-1) : *(i_iter+1);
for (dimension_type j = 0; j < i; ++j) {
+ using namespace Implementation::Octagonal_Shapes;
dimension_type cj = coherent_index(j);
if (is_additive_inverse(m_ci[cj], m_i[j]))
// Choose as leader the variable having the smaller index.
@@ -2202,6 +2214,7 @@ Octagonal_Shape<T>
if (!dealt_with[i]) {
// The index is a leader.
// Now check if it is a leader of a singular class or not.
+ using namespace Implementation::Octagonal_Shapes;
if (next_i == coherent_index(i)) {
exist_sing_class = true;
sing_leader = i;
@@ -2276,10 +2289,12 @@ Octagonal_Shape<T>
compute_leaders(successor, no_sing_leaders, exist_sing_class, sing_leader);
const dimension_type num_no_sing_leaders = no_sing_leaders.size();
+
// Step 2: flag redundant constraints in `redundancy'.
// Go through non-singular leaders first.
for (dimension_type li = 0; li < num_no_sing_leaders; ++li) {
const dimension_type i = no_sing_leaders[li];
+ using namespace Implementation::Octagonal_Shapes;
const dimension_type ci = coherent_index(i);
typename OR_Matrix<N>::const_row_reference_type
m_i = *(matrix.row_begin()+i);
@@ -3111,6 +3126,7 @@ Octagonal_Shape<T>
Row_reference m_ci = *i_iter;
Row_Reference lo_m_ci = *lo_iter;
// Select the right column of the cell.
+ using namespace Implementation::Octagonal_Shapes;
dimension_type cj = coherent_index(j);
N& lo_m_ci_cj = lo_m_ci[cj];
neg_assign(term);
@@ -6234,6 +6250,7 @@ Octagonal_Shape<T>::fold_space_dimensions(const Variables_Set& vars,
const dimension_type min_id = std::min(n_dest, tbf_var);
const dimension_type max_id = std::max(n_dest, tbf_var);
+ using namespace Implementation::Octagonal_Shapes;
for (dimension_type j = 0; j < min_id; ++j) {
const dimension_type cj = coherent_index(j);
max_assign(m_v[j], m_tbf[j]);
@@ -6330,6 +6347,7 @@ Octagonal_Shape<T>::upper_bound_assign_if_exact(const Octagonal_Shape& y) {
for (dimension_type i = n_rows; i-- > 0; ) {
const Bit_Row& x_non_red_i = x_non_red[i];
+ using namespace Implementation::Octagonal_Shapes;
const dimension_type ci = coherent_index(i);
const dimension_type row_size_i = OR_Matrix<N>::row_size(i);
Row_Reference x_i = *(x_m_begin + i);
@@ -6507,6 +6525,7 @@ Octagonal_Shape<T>
for (dimension_type i = n_rows; i-- > 0; ) {
const Bit_Row& tx_non_red_i = tx_non_red[i];
+ using namespace Implementation::Octagonal_Shapes;
const dimension_type ci = coherent_index(i);
const dimension_type row_size_i = OR_Matrix<N>::row_size(i);
Row_Reference tx_i = *(tx_m_begin + i);
More information about the PPL-devel
mailing list