small improvement
This commit is contained in:
parent
4b2ffee015
commit
c1bd230e61
@ -158,17 +158,17 @@ class TFactor
|
|||||||
size_t idx = indexOf (arg);
|
size_t idx = indexOf (arg);
|
||||||
assert (idx != args_.size());
|
assert (idx != args_.size());
|
||||||
assert (evidence < ranges_[idx]);
|
assert (evidence < ranges_[idx]);
|
||||||
Params copy = params_;
|
Params newps;
|
||||||
params_.clear();
|
newps.reserve (params_.size() / ranges_[idx]);
|
||||||
params_.reserve (copy.size() / ranges_[idx]);
|
|
||||||
Indexer indexer (ranges_);
|
Indexer indexer (ranges_);
|
||||||
for (unsigned i = 0; i < evidence; i++) {
|
for (unsigned i = 0; i < evidence; i++) {
|
||||||
indexer.incrementDimension (idx);
|
indexer.incrementDimension (idx);
|
||||||
}
|
}
|
||||||
while (indexer.valid()) {
|
while (indexer.valid()) {
|
||||||
params_.push_back (copy[indexer]);
|
newps.push_back (params_[indexer]);
|
||||||
indexer.incrementExceptDimension (idx);
|
indexer.incrementExceptDimension (idx);
|
||||||
}
|
}
|
||||||
|
params_ = newps;
|
||||||
args_.erase (args_.begin() + idx);
|
args_.erase (args_.begin() + idx);
|
||||||
ranges_.erase (ranges_.begin() + idx);
|
ranges_.erase (ranges_.begin() + idx);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user