![]() |
Eigen
5.0.1
|
#include <Eigen/src/Cholesky/BunchKaufman.h>
Bunch-Kaufman factorization of a symmetric / Hermitian indefinite matrix.
| MatrixType_ | the type of the matrix of which to compute the Bunch-Kaufman factorization |
| UpLo_ | the triangular part that will be used for the decomposition: Lower (default) or Upper. The other triangular part won't be read. |
Perform a symmetric-indefinite factorization of a real symmetric or complex Hermitian matrix \( A \) using the Bunch-Kaufman diagonal pivoting method, such that \( P A P^T = L D L^* \) (or \( P A P^T = U^* D U \) for the upper variant), where \( P \) is a permutation matrix, \( L \) is unit lower triangular and \( D \) is block diagonal with 1x1 and 2x2 diagonal blocks.
Unlike LLT and LDLT, this factorization is numerically stable (backward stable, with a bounded element-growth factor) for indefinite symmetric / Hermitian matrices. It is the dense analog of LAPACK's xSYTRF / xHETRF routines. For positive- or negative-(semi)definite matrices LLT / LDLT are cheaper and should be preferred.
The diagonal-pivoting threshold \( \alpha = (1+\sqrt{17})/8 \) and the pivot-selection logic follow:
The blocked (level-3 BLAS) variant follows the panel/trailing-update structure of LAPACK's xSYTRF / xLASYF.
This factorization also reveals the inertia of \( A \) (the number of positive, negative and zero eigenvalues) by Sylvester's law of inertia, accessible through isPositive() / isNegative().
This class supports the inplace decomposition mechanism.
Inheritance diagram for Eigen::BunchKaufman< MatrixType_, UpLo_ >:Public Member Functions | |
| RealScalar | absDeterminant () const |
| const BunchKaufman & | adjoint () const |
| BunchKaufman () | |
| Default Constructor. | |
| template<typename InputType> | |
| BunchKaufman (const EigenBase< InputType > &matrix) | |
| Constructor with decomposition. | |
| template<typename InputType> | |
| BunchKaufman (EigenBase< InputType > &matrix) | |
| Constructs a Bunch-Kaufman factorization from a given matrix. | |
| BunchKaufman (Index size) | |
| Default Constructor with memory preallocation. | |
| template<typename InputType> | |
| BunchKaufman< MatrixType, UpLo_ > & | compute (const EigenBase< InputType > &a) |
| Scalar | determinant () const |
| ComputationInfo | info () const |
| Reports whether previous computation was successful. | |
| bool | isNegative () const |
| bool | isPositive () const |
| RealScalar | logAbsDeterminant () const |
| Traits::MatrixL | matrixL () const |
| const MatrixType & | matrixLDLT () const |
| Traits::MatrixU | matrixU () const |
| RealScalar | rcond () const |
| MatrixType | reconstructedMatrix () const |
| Scalar | signDeterminant () const |
| template<typename Rhs> | |
| Solve< BunchKaufman, Rhs > | solve (const MatrixBase< Rhs > &b) const |
| const TmpVectorType & | subDiagonal () const |
| const TranspositionType & | transpositionsP () const |
| Diagonal< const MatrixType > | vectorD () const |
Public Member Functions inherited from Eigen::SolverBase< BunchKaufman< MatrixType_, UpLo_ > > | |
| const AdjointReturnType | adjoint () const |
| constexpr BunchKaufman< MatrixType_, UpLo_ > & | derived () |
| constexpr const BunchKaufman< MatrixType_, UpLo_ > & | derived () const |
| Solve< BunchKaufman< MatrixType_, UpLo_ >, Rhs > | solve (const MatrixBase< Rhs > &b) const |
| SolverBase ()=default | |
| const ConstTransposeReturnType | transpose () const |
Public Member Functions inherited from Eigen::EigenBase< BunchKaufman< MatrixType_, UpLo_ > > | |
| constexpr Index | cols () const noexcept |
| constexpr BunchKaufman< MatrixType_, UpLo_ > & | derived () |
| constexpr const BunchKaufman< MatrixType_, UpLo_ > & | derived () const |
| constexpr Index | rows () const noexcept |
| constexpr Index | size () const noexcept |
Additional Inherited Members | |
Public Types inherited from Eigen::EigenBase< BunchKaufman< MatrixType_, UpLo_ > > | |
| using | Index |
| The interface type of indices. | |
|
inline |
Default Constructor.
The default constructor is useful in cases in which the user intends to perform decompositions via BunchKaufman::compute(const MatrixType&).
|
inlineexplicit |
Default Constructor with memory preallocation.
Like the default constructor but with preallocation of the internal data according to the specified problem size.
|
inlineexplicit |
Constructor with decomposition.
This calculates the decomposition for the input matrix.
|
inlineexplicit |
Constructs a Bunch-Kaufman factorization from a given matrix.
This overloaded constructor is provided for inplace decomposition when MatrixType is a Eigen::Ref.
| BunchKaufman< MatrixType, UpLo_ >::RealScalar Eigen::BunchKaufman< MatrixType, UpLo_ >::absDeterminant | ( | ) | const |
It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the decomposition has already been computed.
|
inline |
*this, that is, a const reference to the decomposition itself as the underlying matrix is self-adjoint.This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as:
| BunchKaufman< MatrixType, UpLo_ > & Eigen::BunchKaufman< MatrixType_, UpLo_ >::compute | ( | const EigenBase< InputType > & | a | ) |
Compute / recompute the Bunch-Kaufman factorization \( P A P^T = L D L^* \) (or \( U^* D U \) for the upper variant) of a.
| BunchKaufman< MatrixType, UpLo_ >::Scalar Eigen::BunchKaufman< MatrixType, UpLo_ >::determinant | ( | ) | const |
It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the decomposition has already been computed.
|
inline |
Reports whether previous computation was successful.
Success if computation was successful, NumericalIssue if the factorization failed because of a zero pivot (the matrix is singular) or because a 2x2 pivot block has no representable inverse (a NaN entry, or an off-diagonal so much smaller than the diagonal that the scaled inverse overflows).
|
inline |
|
inline |
| BunchKaufman< MatrixType, UpLo_ >::RealScalar Eigen::BunchKaufman< MatrixType, UpLo_ >::logAbsDeterminant | ( | ) | const |
It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the decomposition has already been computed.
|
inline |
|
inline |
The strictly lower (resp. upper) triangular part holds the unit triangular factor L (resp. U); the diagonal holds the main diagonal of D. The sub/super-diagonal entries of the 2x2 blocks of D are stored separately, in subDiagonal().
|
inline |
|
inline |
*this is the Bunch-Kaufman decomposition. | MatrixType Eigen::BunchKaufman< MatrixType, UpLo_ >::reconstructedMatrix | ( | ) | const |
| BunchKaufman< MatrixType, UpLo_ >::Scalar Eigen::BunchKaufman< MatrixType, UpLo_ >::signDeterminant | ( | ) | const |
1, -1, or 0 if the matrix is singular.The sign is read off the inertia rather than computed from a product, so it is exact and cannot overflow: \( \mathrm{sign}(\det A) = (-1)^{n_-} \), with \( n_- \) the number of negative eigenvalues, which congruence leaves invariant (Sylvester's law of inertia).
|
inline |
This function also supports in-place solves using the syntax x = decompositionObject.solve(x) .
This method just tries to find as good a solution as possible. If you want to check whether a solution exists or if it is accurate, just call this function to get a result and then compute the error of this result, or use MatrixBase::isApprox() directly, for instance like this:
This method avoids dividing by zero, so that the non-existence of a solution doesn't by itself mean that you'll get inf or nan values.
|
inline |
Entry k is non-zero if and only if a 2x2 diagonal block of D occupies rows/columns k and k+1; it then holds \( D_{k+1,k} \). All other entries are zero.
|
inline |
|
inline |
The block-diagonal matrix D is fully described by vectorD() (its main diagonal) together with subDiagonal() (the sub-diagonal entries of its 2x2 blocks).