Use more performant, less conservative Eigen solvers.
colPivHouseholderQR -> householderQR
ldlt -> llt.
The resulting performance differences are significant enough
to justify switching.
LAPACK's dgels routine used for solving linear least squares
problems does not use pivoting either.
Similarly, we are not actually using the fact that the matrix
being factorized can be indefinite when using LDLT factorization, so
its not clear that the performance hit is worth it.
These two changes result in Eigen being able to use blocking
algorithms, which for Cholesky factorization, brings the performance
closer to hardware optimized LAPACK. Similarly for dense QR
factorization, on intel there is a 2x speedup.
Change-Id: I4459ee0fc8eb87d58e2b299dfaa9e656d539dc5e
diff --git a/internal/ceres/schur_eliminator_test.cc b/internal/ceres/schur_eliminator_test.cc
index a7e96ae..bed8f3a 100644
--- a/internal/ceres/schur_eliminator_test.cc
+++ b/internal/ceres/schur_eliminator_test.cc
@@ -112,7 +112,7 @@
P.block(row, row, block_size, block_size) =
P
.block(row, row, block_size, block_size)
- .ldlt()
+ .llt()
.solve(Matrix::Identity(block_size, block_size));
row += block_size;
}
@@ -121,7 +121,7 @@
.triangularView<Eigen::Upper>() = R - Q.transpose() * P * Q;
rhs_expected =
g.tail(schur_size) - Q.transpose() * P * g.head(num_eliminate_cols);
- sol_expected = H.ldlt().solve(g);
+ sol_expected = H.llt().solve(g);
}
void EliminateSolveAndCompare(const VectorRef& diagonal,
@@ -160,7 +160,7 @@
Vector reduced_sol =
lhs_ref
.selfadjointView<Eigen::Upper>()
- .ldlt()
+ .llt()
.solve(rhs);
// Solution to the linear least squares problem.