28 gttic(VariableIndex_augment);
33 const size_t globalI =
34 newFactorIndices ? (*newFactorIndices)[
i] :
nFactors_;
42 if (newFactorIndices) {
52 template<
typename ITERATOR,
class FG>
55 gttic(VariableIndex_remove);
61 ITERATOR factorIndex = firstFactor;
63 for (; factorIndex != lastFactor; ++factorIndex, ++
i) {
65 throw std::invalid_argument(
66 "Internal error, requested inconsistent number of factor indices and factors in VariableIndex::remove");
70 auto entry = std::find(factorEntries.begin(),
71 factorEntries.end(), *factorIndex);
72 if (entry == factorEntries.end())
73 throw std::invalid_argument(
74 "Internal error, indices and factors passed into VariableIndex::remove are not consistent with the existing variable index");
75 factorEntries.erase(entry);
83 template<
typename ITERATOR>
85 for (ITERATOR
key = firstKey;
key != lastKey; ++
key) {
86 KeyMap::iterator entry =
index_.find(*
key);
87 if (!entry->second.empty())
88 throw std::invalid_argument(
89 "Asking to remove variables from the variable index that are not unused");