WPILibC++ 2023.4.3
Eigen::FullPivLU< _MatrixType > Class Template Reference

LU decomposition of a matrix with complete pivoting, and related features. More...

#include </home/runner/work/allwpilib/allwpilib/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/LU/FullPivLU.h>

Inheritance diagram for Eigen::FullPivLU< _MatrixType >:
Eigen::SolverBase< FullPivLU< _MatrixType > > Eigen::EigenBase< FullPivLU< _MatrixType > >

Public Types

enum  { MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime , MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }
 
typedef _MatrixType MatrixType
 
typedef SolverBase< FullPivLUBase
 
typedef internal::plain_row_type< MatrixType, StorageIndex >::type IntRowVectorType
 
typedef internal::plain_col_type< MatrixType, StorageIndex >::type IntColVectorType
 
typedef PermutationMatrix< ColsAtCompileTime, MaxColsAtCompileTimePermutationQType
 
typedef PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTimePermutationPType
 
typedef MatrixType::PlainObject PlainObject
 
- Public Types inherited from Eigen::SolverBase< FullPivLU< _MatrixType > >
enum  
 
typedef EigenBase< FullPivLU< _MatrixType > > Base
 
typedef internal::traits< FullPivLU< _MatrixType > >::Scalar Scalar
 
typedef Scalar CoeffReturnType
 
typedef internal::add_const< Transpose< constDerived > >::type ConstTransposeReturnType
 
typedef internal::conditional< NumTraits< Scalar >::IsComplex, CwiseUnaryOp< internal::scalar_conjugate_op< Scalar >, ConstTransposeReturnType >, ConstTransposeReturnType >::type AdjointReturnType
 
- Public Types inherited from Eigen::EigenBase< FullPivLU< _MatrixType > >
typedef Eigen::Index Index
 The interface type of indices. More...
 
typedef internal::traits< FullPivLU< _MatrixType > >::StorageKind StorageKind
 

Public Member Functions

 FullPivLU ()
 Default Constructor. More...
 
 FullPivLU (Index rows, Index cols)
 Default Constructor with memory preallocation. More...
 
template<typename InputType >
 FullPivLU (const EigenBase< InputType > &matrix)
 Constructor. More...
 
template<typename InputType >
 FullPivLU (EigenBase< InputType > &matrix)
 Constructs a LU factorization from a given matrix. More...
 
template<typename InputType >
FullPivLUcompute (const EigenBase< InputType > &matrix)
 Computes the LU decomposition of the given matrix. More...
 
const MatrixTypematrixLU () const
 
Index nonzeroPivots () const
 
RealScalar maxPivot () const
 
EIGEN_DEVICE_FUNC const PermutationPTypepermutationP () const
 
const PermutationQTypepermutationQ () const
 
const internal::kernel_retval< FullPivLUkernel () const
 
const internal::image_retval< FullPivLUimage (const MatrixType &originalMatrix) const
 
RealScalar rcond () const
 
internal::traits< MatrixType >::Scalar determinant () const
 
FullPivLUsetThreshold (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...
 
FullPivLUsetThreshold (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 Inverse< FullPivLUinverse () const
 
MatrixType reconstructedMatrix () const
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
template<typename RhsType , typename DstType >
void _solve_impl (const RhsType &rhs, DstType &dst) const
 
template<bool Conjugate, typename RhsType , typename DstType >
void _solve_impl_transposed (const RhsType &rhs, DstType &dst) const
 
- Public Member Functions inherited from Eigen::SolverBase< FullPivLU< _MatrixType > >
 SolverBase ()
 Default constructor. More...
 
 ~SolverBase ()
 
const Solve< FullPivLU< _MatrixType >, Rhs > solve (const MatrixBase< Rhs > &b) const
 
ConstTransposeReturnType transpose () const
 
AdjointReturnType adjoint () const
 
EIGEN_DEVICE_FUNC FullPivLU< _MatrixType > & derived ()
 
EIGEN_DEVICE_FUNC const FullPivLU< _MatrixType > & derived () const
 
- Public Member Functions inherited from Eigen::EigenBase< FullPivLU< _MatrixType > >
EIGEN_DEVICE_FUNC FullPivLU< _MatrixType > & derived ()
 
EIGEN_DEVICE_FUNC const FullPivLU< _MatrixType > & derived () const
 
EIGEN_DEVICE_FUNC FullPivLU< _MatrixType > & const_cast_derived () const
 
EIGEN_DEVICE_FUNC const FullPivLU< _MatrixType > & const_derived () const
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC void evalTo (Dest &dst) const
 
EIGEN_DEVICE_FUNC void addTo (Dest &dst) const
 
EIGEN_DEVICE_FUNC void subTo (Dest &dst) const
 
EIGEN_DEVICE_FUNC void applyThisOnTheRight (Dest &dst) const
 
EIGEN_DEVICE_FUNC void applyThisOnTheLeft (Dest &dst) const
 

Protected Member Functions

void computeInPlace ()
 
- Protected Member Functions inherited from Eigen::SolverBase< FullPivLU< _MatrixType > >
void _check_solve_assertion (const Rhs &b) 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_nonzero_pivots
 
RealScalar m_l1_norm
 
RealScalar m_maxpivot
 
RealScalar m_prescribedThreshold
 
signed char m_det_pq
 
bool m_isInitialized
 
bool m_usePrescribedThreshold
 

Friends

class SolverBase< FullPivLU >
 

Detailed Description

template<typename _MatrixType>
class Eigen::FullPivLU< _MatrixType >

LU decomposition of a matrix with complete pivoting, and related features.

Template Parameters
_MatrixTypethe 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 example, here is how the original matrix can be retrieved:

Output:

This class supports the inplace decomposition mechanism.

See also
MatrixBase::fullPivLu(), MatrixBase::determinant(), MatrixBase::inverse()

Member Typedef Documentation

◆ Base

template<typename _MatrixType >
typedef SolverBase<FullPivLU> Eigen::FullPivLU< _MatrixType >::Base

◆ IntColVectorType

template<typename _MatrixType >
typedef internal::plain_col_type<MatrixType,StorageIndex>::type Eigen::FullPivLU< _MatrixType >::IntColVectorType

◆ IntRowVectorType

template<typename _MatrixType >
typedef internal::plain_row_type<MatrixType,StorageIndex>::type Eigen::FullPivLU< _MatrixType >::IntRowVectorType

◆ MatrixType

template<typename _MatrixType >
typedef _MatrixType Eigen::FullPivLU< _MatrixType >::MatrixType

◆ PermutationPType

template<typename _MatrixType >
typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime> Eigen::FullPivLU< _MatrixType >::PermutationPType

◆ PermutationQType

template<typename _MatrixType >
typedef PermutationMatrix<ColsAtCompileTime, MaxColsAtCompileTime> Eigen::FullPivLU< _MatrixType >::PermutationQType

◆ PlainObject

template<typename _MatrixType >
typedef MatrixType::PlainObject Eigen::FullPivLU< _MatrixType >::PlainObject

Member Enumeration Documentation

◆ anonymous enum

template<typename _MatrixType >
anonymous enum
Enumerator
MaxRowsAtCompileTime 
MaxColsAtCompileTime 

Constructor & Destructor Documentation

◆ FullPivLU() [1/4]

template<typename MatrixType >
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&).

◆ FullPivLU() [2/4]

template<typename 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.

See also
FullPivLU()

◆ FullPivLU() [3/4]

template<typename MatrixType >
template<typename InputType >
Eigen::FullPivLU< MatrixType >::FullPivLU ( const EigenBase< InputType > &  matrix)
explicit

Constructor.

Parameters
matrixthe matrix of which to compute the LU decomposition. It is required to be nonzero.

◆ FullPivLU() [4/4]

template<typename MatrixType >
template<typename InputType >
Eigen::FullPivLU< MatrixType >::FullPivLU ( EigenBase< InputType > &  matrix)
explicit

Constructs a LU factorization from a given matrix.

This overloaded constructor is provided for inplace decomposition when MatrixType is a Eigen::Ref.

See also
FullPivLU(const EigenBase&)

Member Function Documentation

◆ _solve_impl()

template<typename _MatrixType >
template<typename RhsType , typename DstType >
void Eigen::FullPivLU< _MatrixType >::_solve_impl ( const RhsType &  rhs,
DstType &  dst 
) const

◆ _solve_impl_transposed()

template<typename _MatrixType >
template<bool Conjugate, typename RhsType , typename DstType >
void Eigen::FullPivLU< _MatrixType >::_solve_impl_transposed ( const RhsType &  rhs,
DstType &  dst 
) const

◆ check_template_parameters()

template<typename _MatrixType >
static void Eigen::FullPivLU< _MatrixType >::check_template_parameters ( )
inlinestaticprotected

◆ cols()

template<typename _MatrixType >
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index Eigen::FullPivLU< _MatrixType >::cols ( ) const
inline

◆ compute()

template<typename _MatrixType >
template<typename InputType >
FullPivLU & Eigen::FullPivLU< _MatrixType >::compute ( const EigenBase< InputType > &  matrix)
inline

Computes the LU decomposition of the given matrix.

Parameters
matrixthe matrix of which to compute the LU decomposition. It is required to be nonzero.
Returns
a reference to *this

◆ computeInPlace()

template<typename MatrixType >
void Eigen::FullPivLU< MatrixType >::computeInPlace
protected

◆ determinant()

Returns
the determinant of the matrix of which *this is the LU decomposition. It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the LU decomposition has already been computed.
Note
This is only for square matrices.
For fixed-size matrices of size up to 4, MatrixBase::determinant() offers optimized paths.
Warning
a determinant can be very big or small, so for matrices of large enough dimension, there is a risk of overflow/underflow.
See also
MatrixBase::determinant()

◆ dimensionOfKernel()

template<typename _MatrixType >
Index Eigen::FullPivLU< _MatrixType >::dimensionOfKernel ( ) const
inline
Returns
the dimension of the kernel of the matrix of which *this is the LU decomposition.
Note
This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling setThreshold(const RealScalar&).

◆ image()

template<typename _MatrixType >
const internal::image_retval< FullPivLU > Eigen::FullPivLU< _MatrixType >::image ( const MatrixType originalMatrix) const
inline
Returns
the image of the matrix, also called its column-space. The columns of the returned matrix will form a basis of the image (column-space).
Parameters
originalMatrixthe 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.
Note
If the image has dimension zero, then the returned matrix is a column-vector filled with zeros.
This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling setThreshold(const RealScalar&).

Example:

Output:

See also
kernel()

◆ inverse()

template<typename _MatrixType >
const Inverse< FullPivLU > Eigen::FullPivLU< _MatrixType >::inverse ( ) const
inline
Returns
the inverse of the matrix of which *this is the LU decomposition.
Note
If this matrix is not invertible, the returned matrix has undefined coefficients. Use isInvertible() to first determine whether this matrix is invertible.
See also
MatrixBase::inverse()

◆ isInjective()

template<typename _MatrixType >
bool Eigen::FullPivLU< _MatrixType >::isInjective ( ) const
inline
Returns
true if the matrix of which *this is the LU decomposition represents an injective linear map, i.e. has trivial kernel; false otherwise.
Note
This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling setThreshold(const RealScalar&).

◆ isInvertible()

template<typename _MatrixType >
bool Eigen::FullPivLU< _MatrixType >::isInvertible ( ) const
inline
Returns
true if the matrix of which *this is the LU decomposition is invertible.
Note
This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling setThreshold(const RealScalar&).

◆ isSurjective()

template<typename _MatrixType >
bool Eigen::FullPivLU< _MatrixType >::isSurjective ( ) const
inline
Returns
true if the matrix of which *this is the LU decomposition represents a surjective linear map; false otherwise.
Note
This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling setThreshold(const RealScalar&).

◆ kernel()

template<typename _MatrixType >
const internal::kernel_retval< FullPivLU > Eigen::FullPivLU< _MatrixType >::kernel ( ) const
inline
Returns
the kernel of the matrix, also called its null-space. The columns of the returned matrix will form a basis of the kernel.
Note
If the kernel has dimension zero, then the returned matrix is a column-vector filled with zeros.
This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling setThreshold(const RealScalar&).

Example:

Output:

See also
image()

◆ matrixLU()

template<typename _MatrixType >
const MatrixType & Eigen::FullPivLU< _MatrixType >::matrixLU ( ) const
inline
Returns
the LU decomposition matrix: the upper-triangular part is U, the unit-lower-triangular part is L (at least for square matrices; in the non-square case, special care is needed, see the documentation of class FullPivLU).
See also
matrixL(), matrixU()

◆ maxPivot()

template<typename _MatrixType >
RealScalar Eigen::FullPivLU< _MatrixType >::maxPivot ( ) const
inline
Returns
the absolute value of the biggest pivot, i.e. the biggest diagonal coefficient of U.

◆ nonzeroPivots()

template<typename _MatrixType >
Index Eigen::FullPivLU< _MatrixType >::nonzeroPivots ( ) const
inline
Returns
the number of nonzero pivots in the LU decomposition. Here nonzero is meant in the exact sense, not in a fuzzy sense. So that notion isn't really intrinsically interesting, but it is still useful when implementing algorithms.
See also
rank()

◆ permutationP()

template<typename _MatrixType >
EIGEN_DEVICE_FUNC const PermutationPType & Eigen::FullPivLU< _MatrixType >::permutationP ( ) const
inline
Returns
the permutation matrix P
See also
permutationQ()

◆ permutationQ()

template<typename _MatrixType >
const PermutationQType & Eigen::FullPivLU< _MatrixType >::permutationQ ( ) const
inline
Returns
the permutation matrix Q
See also
permutationP()

◆ rank()

template<typename _MatrixType >
Index Eigen::FullPivLU< _MatrixType >::rank ( ) const
inline
Returns
the rank of the matrix of which *this is the LU decomposition.
Note
This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling setThreshold(const RealScalar&).

◆ rcond()

template<typename _MatrixType >
RealScalar Eigen::FullPivLU< _MatrixType >::rcond ( ) const
inline
Returns
an estimate of the reciprocal condition number of the matrix of which *this is the LU decomposition.

◆ reconstructedMatrix()

template<typename MatrixType >
MatrixType Eigen::FullPivLU< MatrixType >::reconstructedMatrix
Returns
the matrix represented by the decomposition, i.e., it returns the product: \( P^{-1} L U Q^{-1} \). This function is provided for debug purposes.

◆ rows()

template<typename _MatrixType >
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index Eigen::FullPivLU< _MatrixType >::rows ( ) const
inline

◆ setThreshold() [1/2]

template<typename _MatrixType >
FullPivLU & Eigen::FullPivLU< _MatrixType >::setThreshold ( const RealScalar &  threshold)
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.

Parameters
thresholdThe 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)

◆ setThreshold() [2/2]

template<typename _MatrixType >
FullPivLU & Eigen::FullPivLU< _MatrixType >::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.

lu.setThreshold(Eigen::Default);
@ Default
Definition: Constants.h:362

See the documentation of setThreshold(const RealScalar&).

◆ threshold()

template<typename _MatrixType >
RealScalar Eigen::FullPivLU< _MatrixType >::threshold ( ) const
inline

Returns the threshold that will be used by certain methods such as rank().

See the documentation of setThreshold(const RealScalar&).

Friends And Related Function Documentation

◆ SolverBase< FullPivLU >

template<typename _MatrixType >
friend class SolverBase< FullPivLU >
friend

Member Data Documentation

◆ m_colsTranspositions

template<typename _MatrixType >
IntRowVectorType Eigen::FullPivLU< _MatrixType >::m_colsTranspositions
protected

◆ m_det_pq

template<typename _MatrixType >
signed char Eigen::FullPivLU< _MatrixType >::m_det_pq
protected

◆ m_isInitialized

template<typename _MatrixType >
bool Eigen::FullPivLU< _MatrixType >::m_isInitialized
protected

◆ m_l1_norm

template<typename _MatrixType >
RealScalar Eigen::FullPivLU< _MatrixType >::m_l1_norm
protected

◆ m_lu

template<typename _MatrixType >
MatrixType Eigen::FullPivLU< _MatrixType >::m_lu
protected

◆ m_maxpivot

template<typename _MatrixType >
RealScalar Eigen::FullPivLU< _MatrixType >::m_maxpivot
protected

◆ m_nonzero_pivots

template<typename _MatrixType >
Index Eigen::FullPivLU< _MatrixType >::m_nonzero_pivots
protected

◆ m_p

template<typename _MatrixType >
PermutationPType Eigen::FullPivLU< _MatrixType >::m_p
protected

◆ m_prescribedThreshold

template<typename _MatrixType >
RealScalar Eigen::FullPivLU< _MatrixType >::m_prescribedThreshold
protected

◆ m_q

template<typename _MatrixType >
PermutationQType Eigen::FullPivLU< _MatrixType >::m_q
protected

◆ m_rowsTranspositions

template<typename _MatrixType >
IntColVectorType Eigen::FullPivLU< _MatrixType >::m_rowsTranspositions
protected

◆ m_usePrescribedThreshold

template<typename _MatrixType >
bool Eigen::FullPivLU< _MatrixType >::m_usePrescribedThreshold
protected

The documentation for this class was generated from the following file: