release/4.3a0
Varun Agrawal 2024-09-25 14:13:14 -04:00
parent 2682cde259
commit 9243655e3b
1 changed files with 4 additions and 9 deletions

View File

@ -282,15 +282,10 @@ Diagonal::Diagonal(const Vector& sigmas)
/* ************************************************************************* */ /* ************************************************************************* */
Diagonal::shared_ptr Diagonal::Variances(const Vector& variances, bool smart) { Diagonal::shared_ptr Diagonal::Variances(const Vector& variances, bool smart) {
if (smart) { // check whether all the same entry
// check whether all the same entry return (smart && (variances.array() == variances(0)).all())
if ((variances.array() == variances(0)).all()) { ? Isotropic::Variance(variances.size(), variances(0), true)
return Isotropic::Variance(variances.size(), variances(0), true); : shared_ptr(new Diagonal(variances.cwiseSqrt()));
} else
goto full;
}
full:
return shared_ptr(new Diagonal(variances.cwiseSqrt()));
} }
/* ************************************************************************* */ /* ************************************************************************* */