Remove error checking
parent
69b1313eed
commit
83fae8ecf8
|
@ -37,14 +37,9 @@ HybridGaussianConditional::ConstructorHelper::ConstructorHelper(
|
||||||
[&](const GaussianConditional::shared_ptr &c) -> GaussianFactorValuePair {
|
[&](const GaussianConditional::shared_ptr &c) -> GaussianFactorValuePair {
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
if (c) {
|
if (c) {
|
||||||
KeyVector cf(c->frontals().begin(), c->frontals().end());
|
|
||||||
KeyVector cp(c->parents().begin(), c->parents().end());
|
|
||||||
if (frontals.empty()) {
|
if (frontals.empty()) {
|
||||||
frontals = cf;
|
frontals = KeyVector(c->frontals().begin(), c->frontals().end());
|
||||||
parents = cp;
|
parents = KeyVector(c->parents().begin(), c->parents().end());
|
||||||
} else if (cf != frontals || cp != parents) {
|
|
||||||
throw std::invalid_argument(
|
|
||||||
"All conditionals must have the same frontals and parents");
|
|
||||||
}
|
}
|
||||||
value = c->negLogConstant();
|
value = c->negLogConstant();
|
||||||
negLogConstant = std::min(negLogConstant, value);
|
negLogConstant = std::min(negLogConstant, value);
|
||||||
|
|
|
@ -76,11 +76,9 @@ HybridGaussianFactor::ConstructorHelper::ConstructorHelper(
|
||||||
: discreteKeys({discreteKey}) {
|
: discreteKeys({discreteKey}) {
|
||||||
// Extract continuous keys from the first non-null factor
|
// Extract continuous keys from the first non-null factor
|
||||||
for (const auto &factor : factors) {
|
for (const auto &factor : factors) {
|
||||||
if (!factor) continue; // Skip null factors
|
if (factor && continuousKeys.empty()) {
|
||||||
if (continuousKeys.empty()) {
|
|
||||||
continuousKeys = factor->keys();
|
continuousKeys = factor->keys();
|
||||||
} else if (factor->keys() != continuousKeys) {
|
break;
|
||||||
throw std::invalid_argument("All factors must have the same keys");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,11 +93,9 @@ HybridGaussianFactor::ConstructorHelper::ConstructorHelper(
|
||||||
: discreteKeys({discreteKey}) {
|
: discreteKeys({discreteKey}) {
|
||||||
// Extract continuous keys from the first non-null factor
|
// Extract continuous keys from the first non-null factor
|
||||||
for (const auto &pair : factorPairs) {
|
for (const auto &pair : factorPairs) {
|
||||||
if (!pair.first) continue; // Skip null factors
|
if (pair.first && continuousKeys.empty()) {
|
||||||
if (continuousKeys.empty()) {
|
|
||||||
continuousKeys = pair.first->keys();
|
continuousKeys = pair.first->keys();
|
||||||
} else if (pair.first->keys() != continuousKeys) {
|
break;
|
||||||
throw std::invalid_argument("All factors must have the same keys");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,11 +109,8 @@ HybridGaussianFactor::ConstructorHelper::ConstructorHelper(
|
||||||
: discreteKeys(discreteKeys) {
|
: discreteKeys(discreteKeys) {
|
||||||
// Extract continuous keys from the first non-null factor
|
// Extract continuous keys from the first non-null factor
|
||||||
factorPairs.visit([&](const GaussianFactorValuePair &pair) {
|
factorPairs.visit([&](const GaussianFactorValuePair &pair) {
|
||||||
if (!pair.first) return; // Skip null factors
|
if (pair.first && continuousKeys.empty()) {
|
||||||
if (continuousKeys.empty()) {
|
|
||||||
continuousKeys = pair.first->keys();
|
continuousKeys = pair.first->keys();
|
||||||
} else if (pair.first->keys() != continuousKeys) {
|
|
||||||
throw std::invalid_argument("All factors must have the same keys");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue