rename CutIndexer to MapIndexer

This commit is contained in:
Tiago Gomes 2012-05-28 12:32:15 +01:00
parent 3290834dfe
commit 3986012e56
4 changed files with 16 additions and 16 deletions

View File

@ -209,7 +209,7 @@ Factor::sumOutArgs (const vector<bool>& mask)
Params newps (new_size, LogAware::addIdenty());
Params::const_iterator first = params_.begin();
Params::const_iterator last = params_.end();
CutIndexer indexer (oldRanges, mask);
MapIndexer indexer (oldRanges, mask);
if (Globals::logDomain) {
while (first != last) {
newps[indexer] = Util::logSum (newps[indexer], *first++);

View File

@ -101,7 +101,7 @@ class TFactor
} else {
extend (range_prod);
Params::iterator it = params_.begin();
CutIndexer indexer (args_, ranges_, g_args, g_ranges);
MapIndexer indexer (args_, ranges_, g_args, g_ranges);
if (Globals::logDomain) {
for (; indexer.valid(); ++indexer) {
*it++ += g_params[indexer];
@ -122,7 +122,7 @@ class TFactor
Params newps (new_size, LogAware::addIdenty());
Params::const_iterator first = params_.begin();
Params::const_iterator last = params_.end();
CutIndexer indexer (ranges_, idx);
MapIndexer indexer (ranges_, idx);
if (Globals::logDomain) {
for (; first != last; ++indexer) {
newps[indexer] = Util::logSum (newps[indexer], *first++);
@ -171,7 +171,7 @@ class TFactor
}
Params newps;
newps.reserve (params_.size());
CutIndexer indexer (new_args, new_ranges, args_, ranges_);
MapIndexer indexer (new_args, new_ranges, args_, ranges_);
for (; indexer.valid(); ++indexer) {
newps.push_back (params_[indexer]);
}

View File

@ -137,10 +137,10 @@ operator<< (std::ostream& os, const Indexer& indexer)
class CutIndexer
class MapIndexer
{
public:
CutIndexer (const Ranges& ranges, const vector<bool>& mask)
MapIndexer (const Ranges& ranges, const vector<bool>& mask)
: index_(0), indices_(ranges.size(), 0), ranges_(ranges),
valid_(true)
{
@ -155,7 +155,7 @@ class CutIndexer
assert (ranges.size() == mask.size());
}
CutIndexer (const Ranges& ranges, size_t dim)
MapIndexer (const Ranges& ranges, size_t dim)
: index_(0), indices_(ranges.size(), 0), ranges_(ranges),
valid_(true)
{
@ -170,7 +170,7 @@ class CutIndexer
}
template <typename T>
CutIndexer (
MapIndexer (
const vector<T>& allArgs,
const Ranges& allRanges,
const vector<T>& wantedArgs,
@ -191,7 +191,7 @@ class CutIndexer
}
}
CutIndexer& operator++ (void)
MapIndexer& operator++ (void)
{
assert (valid_);
for (size_t i = ranges_.size(); i-- > 0; ) {
@ -232,7 +232,7 @@ class CutIndexer
index_ = 0;
}
friend std::ostream& operator<< (std::ostream&, const CutIndexer&);
friend std::ostream& operator<< (std::ostream&, const MapIndexer&);
private:
size_t index_;
@ -245,7 +245,7 @@ class CutIndexer
inline std::ostream&
operator<< (std::ostream &os, const CutIndexer& indexer)
operator<< (std::ostream &os, const MapIndexer& indexer)
{
os << "(" ;
os << std::setw (2) << std::setfill('0') << indexer.index_;

View File

@ -228,11 +228,11 @@ Parfactor::countConvert (LogVar X)
params_.reserve (sumout.size() * H);
ranges_[fIdx] = H;
CutIndexer cutIndexer (ranges_, fIdx);
while (cutIndexer.valid()) {
MapIndexer mapIndexer (ranges_, fIdx);
while (mapIndexer.valid()) {
double prod = LogAware::multIdenty();
size_t i = cutIndexer;
unsigned h = cutIndexer[fIdx];
size_t i = mapIndexer;
unsigned h = mapIndexer[fIdx];
for (unsigned r = 0; r < R; r++) {
if (Globals::logDomain) {
prod += LogAware::pow (sumout[i][r], histograms[h][r]);
@ -241,7 +241,7 @@ Parfactor::countConvert (LogVar X)
}
}
params_.push_back (prod);
++ cutIndexer;
++ mapIndexer;
}
args_[fIdx].setCountedLogVar (X);
simplifyCountingFormulas (fIdx);