inplace_QR *already* zeros out below diagonal

release/4.3a0
Frank Dellaert 2025-02-19 23:38:43 -05:00
parent c87050bc8b
commit c0c8972d0d
2 changed files with 0 additions and 11 deletions

View File

@ -827,8 +827,6 @@ std::pair<GaussianConditional::shared_ptr, JacobianFactor::shared_ptr> Eliminate
// The inplace variant will have no valid rows anymore below m==n // The inplace variant will have no valid rows anymore below m==n
// and only entries above the diagonal are valid. // and only entries above the diagonal are valid.
inplace_QR(Ab.matrix()); inplace_QR(Ab.matrix());
// We zero below the diagonal to agree with the result from noieModel QR
Ab.matrix().triangularView<Eigen::StrictlyLower>().setZero();
size_t m = Ab.rows(), n = Ab.cols() - 1; size_t m = Ab.rows(), n = Ab.cols() - 1;
size_t maxRank = min(m, n); size_t maxRank = min(m, n);
jointFactor->model_ = noiseModel::Unit::Create(maxRank); jointFactor->model_ = noiseModel::Unit::Create(maxRank);

View File

@ -191,8 +191,6 @@ SharedDiagonal Gaussian::QR(Matrix& Ab) const {
gttic(Gaussian_noise_model_QR); gttic(Gaussian_noise_model_QR);
static const bool debug = false;
// get size(A) and maxRank // get size(A) and maxRank
// TODO: really no rank problems ? // TODO: really no rank problems ?
size_t m = Ab.rows(), n = Ab.cols()-1; size_t m = Ab.rows(), n = Ab.cols()-1;
@ -201,15 +199,8 @@ SharedDiagonal Gaussian::QR(Matrix& Ab) const {
// pre-whiten everything (cheaply if possible) // pre-whiten everything (cheaply if possible)
WhitenInPlace(Ab); WhitenInPlace(Ab);
if(debug) gtsam::print(Ab, "Whitened Ab: ");
// Eigen QR - much faster than older householder approach // Eigen QR - much faster than older householder approach
inplace_QR(Ab); inplace_QR(Ab);
Ab.triangularView<Eigen::StrictlyLower>().setZero();
// hand-coded householder implementation
// TODO: necessary to isolate last column?
// householder(Ab, maxRank);
return noiseModel::Unit::Create(maxRank); return noiseModel::Unit::Create(maxRank);
} }