make jacobian factor use noise model distance when available

release/4.3a0
Mike Bosse 2019-12-16 15:52:24 -08:00
parent 63ef77156e
commit 1f43d73b34
1 changed files with 4 additions and 2 deletions

View File

@ -513,8 +513,10 @@ Vector JacobianFactor::error_vector(const VectorValues& c) const {
/* ************************************************************************* */
double JacobianFactor::error(const VectorValues& c) const {
Vector weighted = error_vector(c);
return 0.5 * weighted.dot(weighted);
Vector e = unweighted_error(c);
// Use the noise model distance function to get the correct error if available.
if (model_) return 0.5 * model_->distance(e);
return 0.5 * e.dot(e);
}
/* ************************************************************************* */