Added print() to Reduction

release/4.3a0
Alex Cunningham 2012-10-09 17:48:38 +00:00
parent b05cd24a0b
commit f8b96ad090
2 changed files with 14 additions and 2 deletions

View File

@ -200,6 +200,13 @@ namespace internal {
return it->second;
}
/* ************************************************************************* */
void Reduction::print(const std::string& s) const {
cout << s << " reduction:" << endl;
BOOST_FOREACH(const value_type& p, *this)
cout << " " << p.first << " : " << p.second << endl;
}
/* ************************************************************************* */
Permutation createReducingPermutation(const std::set<Index>& indices) {
Permutation p(indices.size());
@ -210,6 +217,7 @@ namespace internal {
}
return p;
}
}
} // \namespace internal
}
/* ************************************************************************* */
} // \namespace gtsam

View File

@ -189,11 +189,15 @@ namespace internal {
// An internal class used for storing and applying a permutation from a map
class Reduction : public gtsam::FastMap<Index,Index> {
public:
typedef gtsam::FastMap<Index,Index> Base;
static Reduction CreateAsInverse(const Permutation& p);
void applyInverse(std::vector<Index>& js) const;
Permutation inverse() const;
Index& operator[](const Index& j);
const Index& operator[](const Index& j) const;
void print(const std::string& s="") const;
};
// Reduce the variable indices so that those in the set are mapped to start at zero