OSVR-Core
|
LU decomposition of a matrix with complete pivoting, and related features. More...
#include <FullPivLU.h>
Public Types | |
enum | { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, Options = MatrixType::Options, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime } |
typedef _MatrixType | MatrixType |
typedef MatrixType::Scalar | Scalar |
typedef NumTraits< typename MatrixType::Scalar >::Real | RealScalar |
typedef internal::traits< MatrixType >::StorageKind | StorageKind |
typedef MatrixType::Index | Index |
typedef internal::plain_row_type< MatrixType, Index >::type | IntRowVectorType |
typedef internal::plain_col_type< MatrixType, Index >::type | IntColVectorType |
typedef PermutationMatrix< ColsAtCompileTime, MaxColsAtCompileTime > | PermutationQType |
typedef PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime > | PermutationPType |
Public Member Functions | |
FullPivLU () | |
Default Constructor. More... | |
FullPivLU (Index rows, Index cols) | |
Default Constructor with memory preallocation. More... | |
FullPivLU (const MatrixType &matrix) | |
Constructor. More... | |
FullPivLU & | compute (const MatrixType &matrix) |
Computes the LU decomposition of the given matrix. More... | |
const MatrixType & | matrixLU () const |
Index | nonzeroPivots () const |
RealScalar | maxPivot () const |
const PermutationPType & | permutationP () const |
const PermutationQType & | permutationQ () const |
const internal::kernel_retval< FullPivLU > | kernel () const |
const internal::image_retval< FullPivLU > | image (const MatrixType &originalMatrix) const |
template<typename Rhs > | |
const internal::solve_retval< FullPivLU, Rhs > | solve (const MatrixBase< Rhs > &b) const |
internal::traits< MatrixType >::Scalar | determinant () const |
FullPivLU & | setThreshold (const RealScalar &threshold) |
Allows to prescribe a threshold to be used by certain methods, such as rank(), who need to determine when pivots are to be considered nonzero. More... | |
FullPivLU & | setThreshold (Default_t) |
Allows to come back to the default behavior, letting Eigen use its default formula for determining the threshold. More... | |
RealScalar | threshold () const |
Returns the threshold that will be used by certain methods such as rank(). More... | |
Index | rank () const |
Index | dimensionOfKernel () const |
bool | isInjective () const |
bool | isSurjective () const |
bool | isInvertible () const |
const internal::solve_retval< FullPivLU, typename MatrixType::IdentityReturnType > | inverse () const |
MatrixType | reconstructedMatrix () const |
Index | rows () const |
Index | cols () const |
Static Protected Member Functions | |
static void | check_template_parameters () |
Protected Attributes | |
MatrixType | m_lu |
PermutationPType | m_p |
PermutationQType | m_q |
IntColVectorType | m_rowsTranspositions |
IntRowVectorType | m_colsTranspositions |
Index | m_det_pq |
Index | m_nonzero_pivots |
RealScalar | m_maxpivot |
RealScalar | m_prescribedThreshold |
bool | m_isInitialized |
bool | m_usePrescribedThreshold |
LU decomposition of a matrix with complete pivoting, and related features.
MatrixType | the type of the matrix of which we are computing the LU decomposition |
This class represents a LU decomposition of any matrix, with complete pivoting: the matrix A is decomposed as \( A = P^{-1} L U Q^{-1} \) where L is unit-lower-triangular, U is upper-triangular, and P and Q are permutation matrices. This is a rank-revealing LU decomposition. The eigenvalues (diagonal coefficients) of U are sorted in such a way that any zeros are at the end.
This decomposition provides the generic approach to solving systems of linear equations, computing the rank, invertibility, inverse, kernel, and determinant.
This LU decomposition is very stable and well tested with large matrices. However there are use cases where the SVD decomposition is inherently more stable and/or flexible. For example, when computing the kernel of a matrix, working with the SVD allows to select the smallest singular values of the matrix, something that the LU decomposition doesn't see.
The data of the LU decomposition can be directly accessed through the methods matrixLU(), permutationP(), permutationQ().
As an exemple, here is how the original matrix can be retrieved:
Output:
Eigen::FullPivLU< MatrixType >::FullPivLU | ( | ) |
Default Constructor.
The default constructor is useful in cases in which the user intends to perform decompositions via LU::compute(const MatrixType&).
Eigen::FullPivLU< MatrixType >::FullPivLU | ( | Index | rows, |
Index | cols | ||
) |
Default Constructor with memory preallocation.
Like the default constructor but with preallocation of the internal data according to the specified problem size.
Eigen::FullPivLU< MatrixType >::FullPivLU | ( | const MatrixType & | matrix | ) |
Constructor.
matrix | the matrix of which to compute the LU decomposition. It is required to be nonzero. |
FullPivLU< MatrixType > & Eigen::FullPivLU< MatrixType >::compute | ( | const MatrixType & | matrix | ) |
internal::traits< MatrixType >::Scalar Eigen::FullPivLU< MatrixType >::determinant | ( | ) | const |
|
inline |
|
inline |
originalMatrix | the original matrix, of which *this is the LU decomposition. The reason why it is needed to pass it here, is that this allows a large optimization, as otherwise this method would need to reconstruct it from the LU decomposition. |
Example:
Output:
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Example:
Output:
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
MatrixType Eigen::FullPivLU< MatrixType >::reconstructedMatrix | ( | ) | const |
|
inline |
Allows to prescribe a threshold to be used by certain methods, such as rank(), who need to determine when pivots are to be considered nonzero.
This is not used for the LU decomposition itself.
When it needs to get the threshold value, Eigen calls threshold(). By default, this uses a formula to automatically determine a reasonable threshold. Once you have called the present method setThreshold(const RealScalar&), your value is used instead.
threshold | The new value to use as the threshold. |
A pivot will be considered nonzero if its absolute value is strictly greater than \( \vert pivot \vert \leqslant threshold \times \vert maxpivot \vert \) where maxpivot is the biggest pivot.
If you want to come back to the default behavior, call setThreshold(Default_t)
|
inline |
Allows to come back to the default behavior, letting Eigen use its default formula for determining the threshold.
You should pass the special object Eigen::Default as parameter here.
See the documentation of setThreshold(const RealScalar&).
|
inline |
b | the right-hand-side of the equation to solve. Can be a vector or a matrix, the only requirement in order for the equation to make sense is that b.rows()==A.rows(), where A is the matrix of which *this is the LU decomposition. |
Example:
Output:
|
inline |
Returns the threshold that will be used by certain methods such as rank().
See the documentation of setThreshold(const RealScalar&).