![]() |
Eigen
5.0.1
|
This page presents a catalogue of the dense matrix decompositions offered by Eigen. For an introduction on linear solvers and decompositions, check this page . To get an overview of the true relative speed of the different decompositions, check this benchmark .
| Generic information, not Eigen-specific | Eigen-specific | |||||||
|---|---|---|---|---|---|---|---|---|
| Decomposition | Requirements on the matrix | Speed | Algorithm reliability and accuracy | Rank-revealing | Allows to compute (besides linear solving) | Linear solver provided by Eigen | Maturity of Eigen's implementation | Optimizations |
| PartialPivLU | Invertible | Fast | Good4 | - | - | Yes | Excellent | Blocking, Implicit MT |
| FullPivLU | - | Slow (no blocking) | Good4 | Yes | Rank, kernel, image | Yes | Excellent | - |
| HouseholderQR | - | Fast | Good4 | - | Orthogonalization, least squares for overdetermined systems | Yes (and does least squares) | Excellent | Blocking |
| ColPivHouseholderQR | - | Fast | Good4 | Yes | Orthogonalization, least squares for overdetermined systems | Yes (and does least squares) | Excellent | - |
| RandColPivHouseholderQR | - | Fast (large matrices) | Good4 | Yes | Orthogonalization, least squares for overdetermined systems | Yes (and does least squares) | Good | Blocking, randomized pivot selection |
| FullPivHouseholderQR | - | Slow (no blocking) | Good4 | Yes | Orthogonalization, least squares for overdetermined systems | Yes (and does least squares) | Average | - |
| CompleteOrthogonalDecomposition | - | Fast | Good4 | Yes | Orthogonalization, minimum-norm least squares, pseudo-inverse | Yes (and does least squares) | Excellent | - |
| RandCompleteOrthogonalDecomposition | - | Fast (large matrices) | Good4 | Yes | Orthogonalization, minimum-norm least squares, pseudo-inverse | Yes (and does least squares) | Good | Blocking, randomized pivot selection |
| LLT | Positive definite | Very fast | Good5 | - | - | Yes | Excellent | Blocking |
| LDLT | Positive or negative semidefinite1 | Very fast | Good | - | - | Yes | Excellent | - |
| BunchKaufman | Self-adjoint (possibly indefinite) | Very fast | Good | - | Inertia | Yes | Good | Blocking |
| ||||||||
| BDCSVD (divide & conquer) | - | One of the fastest SVD algorithms | Excellent | Yes | Singular values/vectors, least squares | Yes (and does least squares) | Excellent | Blocked bidiagonalization |
| JacobiSVD (two-sided) | - | Slow (but fast for small matrices) | High relative accuracy3 | Yes | Singular values/vectors, least squares | Yes (and does least squares) | Excellent | R-SVD |
| SelfAdjointEigenSolver | Self-adjoint | Fast-average2 | Good | - | Eigenvalues/vectors | - | Excellent | Closed forms for 2x2 and 3x3 |
| TridiagonalEigenSolver | Symmetric tridiagonal | Fast | Good | - | Eigenvalues/vectors, subsets of the spectrum | - | Good | Vectorization, Explicit MT |
| ComplexEigenSolver | Square | Slow-very slow2 | Depends on condition number | - | Eigenvalues/vectors | - | Average | - |
| EigenSolver | Square and real | Average-slow2 | Depends on condition number | - | Eigenvalues/vectors | - | Average | - |
| GeneralizedSelfAdjointEigenSolver | Square | Fast-average2 | Depends on condition number | - | Generalized eigenvalues/vectors | - | Good | - |
| GeneralizedEigenSolver | Square and real | Slow-very slow2 | Depends on condition number | - | Generalized eigenvalues/vectors | - | Average | - |
| ||||||||
| RealSchur | Square and real | Average-slow2 | Depends on condition number | - | - | - | Average | - |
| ComplexSchur | Square | Slow-very slow2 | Depends on condition number | - | - | - | Average | - |
| RealQZ | Square and real (pair of matrices) | Average-slow2 | Depends on condition number | - | Generalized eigenvalues of a pencil | - | Average | - |
| ComplexQZ | Square (pair of matrices) | Slow-very slow2 | Depends on condition number | - | Generalized eigenvalues of a pencil | - | Average | - |
| Tridiagonalization | Self-adjoint | Fast | Good | - | - | - | Good | - |
| HessenbergDecomposition | Square | Average | Good | - | - | - | Good | - |
Notes:
PreconditionSquareMatrix applies it to square matrices too. Householder QR is backward stable with or without pivoting, so this choice is about rank revelation rather than about the accuracy of the factorization itself: the default ColPivHouseholderQRPreconditioner reveals rank reliably in practice but without a guarantee, FullPivHouseholderQRPreconditioner inspects the whole trailing submatrix at a substantially higher cost, and HouseholderQRPreconditioner and NoQRPreconditioner do not pivot at all. See the guidance below on complete pivoting. n. That partial-pivoting worst case is not observed on real matrices, however, and partial pivoting is more than sufficient in practice. Householder QR is backward stable irrespective of pivoting, with a bound that involves no growth factor at all; there, pivoting serves rank revelation rather than stability, and what separates column from complete pivoting is how reliably the trailing diagonal of R exposes a rank deficiency. Since complete pivoting also rules out the cache-friendly blocked algorithms, LAPACK and Eigen both treat partial and column pivoting as the defaults for LU and QR; see the guidance below. This is a judgement about those two factorizations rather than about complete pivoting in general: LAPACK does provide a complete-pivoting Cholesky (pstrf) for positive semidefinite matrices, where the pivoting also determines the rank. The following recommendations apply to the most common use cases:
getrf) and column-pivoted QR (geqp3, geqp3rk). Complete-pivoting LU survives there only as the auxiliary routine getc2, called by the generalized Sylvester solver, and complete pivoting has no QR counterpart at all. A selfadjoint matrix \( A \) is positive semi-definite if \( v^* A v \ge 0 \) for any non zero vector \( v \). In the same vein, it is negative semi-definite if \( v^* A v \le 0 \) for any non zero vector \( v \)