add check in GaussianMixtureFactor::likelihood
parent
bb31956a96
commit
ed16c335c1
|
@ -69,8 +69,7 @@ GaussianFactorGraphTree GaussianMixture::asGaussianFactorGraphTree() const {
|
||||||
GaussianFactorGraph result;
|
GaussianFactorGraph result;
|
||||||
result.push_back(conditional);
|
result.push_back(conditional);
|
||||||
if (conditional) {
|
if (conditional) {
|
||||||
return GraphAndConstant(
|
return GraphAndConstant(result, conditional->logNormalizationConstant());
|
||||||
result, conditional->logNormalizationConstant());
|
|
||||||
} else {
|
} else {
|
||||||
return GraphAndConstant(result, 0.0);
|
return GraphAndConstant(result, 0.0);
|
||||||
}
|
}
|
||||||
|
@ -163,7 +162,13 @@ KeyVector GaussianMixture::continuousParents() const {
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
boost::shared_ptr<GaussianMixtureFactor> GaussianMixture::likelihood(
|
boost::shared_ptr<GaussianMixtureFactor> GaussianMixture::likelihood(
|
||||||
const VectorValues &frontals) const {
|
const VectorValues &frontals) const {
|
||||||
// TODO(dellaert): check that values has all frontals
|
// Check that values has all frontals
|
||||||
|
for (auto &&kv : frontals) {
|
||||||
|
if (frontals.find(kv.first) == frontals.end()) {
|
||||||
|
throw std::runtime_error("GaussianMixture: frontals missing factor key.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const DiscreteKeys discreteParentKeys = discreteKeys();
|
const DiscreteKeys discreteParentKeys = discreteKeys();
|
||||||
const KeyVector continuousParentKeys = continuousParents();
|
const KeyVector continuousParentKeys = continuousParents();
|
||||||
const GaussianMixtureFactor::Factors likelihoods(
|
const GaussianMixtureFactor::Factors likelihoods(
|
||||||
|
|
Loading…
Reference in New Issue