void reweight(Weight& wt, Util::Random01& rng) const { double cost = wt.getValue(); double newcost = cost; maybeSet(newcost); if (!weights.empty()) { if (!IsFeatureWeight<Weight>::value) SDL_THROW_LOG(Hypergraph.Reweight, ConfigException, "supplied (unusable) feature weights for non-feature hypergraph"); double weighted = FeatureDotProduct<Weight, double>::dotProduct(wt, weights); if (weightsAdd) newcost += weighted; else newcost = weighted; } postSet(newcost, rng); if (clearFeatures) wt = Weight((typename Weight::FloatT)newcost); else wt.value_ = newcost; }
bool trivial() const { return is_null(set) && is_null(random_add) && is_null(add) && is_null(scale) && !clearFeatures && !fsm_normalize && !head_normalize && weights.empty(); }