5% speedup by using faster setAllZero

release/4.3a0
Frank Dellaert 2025-01-28 18:19:35 -05:00
parent d8b75f6bd0
commit 02c8f02a10
2 changed files with 7 additions and 2 deletions

View File

@ -256,11 +256,16 @@ namespace gtsam {
full().triangularView<Eigen::Upper>() = xpr.template triangularView<Eigen::Upper>();
}
/// Set the entire active matrix zero.
/// Set the entire *active* matrix zero.
void setZero() {
full().triangularView<Eigen::Upper>().setZero();
}
/// Set entire matrix zero.
void setAllZero() {
matrix_.setZero();
}
/// Negate the entire active matrix.
void negate();

View File

@ -245,7 +245,7 @@ HessianFactor::HessianFactor(const GaussianFactorGraph& factors,
// Form A' * A
gttic(update);
info_.setZero();
info_.setAllZero();
for(const auto& factor: factors)
if (factor)
factor->updateHessian(keys_, &info_);