Main MRPT website > C++ reference
MRPT logo
Public Types | Public Member Functions | Protected Attributes
Eigen::PartialPivLU Class Reference

Detailed Description

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

Parameters:
MatrixTypethe type of the matrix of which we are computing the LU decomposition

This class represents a LU decomposition of a square invertible matrix, with partial pivoting: the matrix A is decomposed as A = PLU where L is unit-lower-triangular, U is upper-triangular, and P is a permutation matrix.

Typically, partial pivoting LU decomposition is only considered numerically stable for square invertible matrices. Thus LAPACK's dgesv and dgesvx require the matrix to be square and invertible. The present class does the same. It will assert that the matrix is square, but it won't (actually it can't) check that the matrix is invertible: it is your task to check that you only use this decomposition on invertible matrices.

The guaranteed safe alternative, working for all matrices, is the full pivoting LU decomposition, provided by class FullPivLU.

This is not a rank-revealing LU decomposition. Many features are intentionally absent from this class, such as rank computation. If you need these features, use class FullPivLU.

This LU decomposition is suitable to invert invertible matrices. It is what MatrixBase::inverse() uses in the general case. On the other hand, it is not suitable to determine whether a given matrix is invertible.

The data of the LU decomposition can be directly accessed through the methods matrixLU(), permutationP().

See also:
MatrixBase::partialPivLu(), MatrixBase::determinant(), MatrixBase::inverse(), MatrixBase::computeInverse(), class FullPivLU

List of all members.

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 PermutationMatrix
< RowsAtCompileTime,
MaxRowsAtCompileTime > 
PermutationType
typedef Transpositions
< RowsAtCompileTime,
MaxRowsAtCompileTime > 
TranspositionType

Public Member Functions

 PartialPivLU ()
 Default Constructor.
 PartialPivLU (Index size)
 Default Constructor with memory preallocation.
 PartialPivLU (const MatrixType &matrix)
 Constructor.
PartialPivLUcompute (const MatrixType &matrix)
const MatrixTypematrixLU () const
const PermutationTypepermutationP () const
template<typename Rhs >
const internal::solve_retval
< PartialPivLU, Rhs > 
solve (const MatrixBase< Rhs > &b) const
 This method returns the solution x to the equation Ax=b, where A is the matrix of which *this is the LU decomposition.
const internal::solve_retval
< PartialPivLU, typename
MatrixType::IdentityReturnType > 
inverse () const
internal::traits< MatrixType >
::Scalar 
determinant () const
MatrixType reconstructedMatrix () const
Index rows () const
Index cols () const

Protected Attributes

MatrixType m_lu
PermutationType m_p
TranspositionType m_rowsTranspositions
Index m_det_p
bool m_isInitialized

Member Typedef Documentation

typedef MatrixType::Index Eigen::PartialPivLU::Index

Definition at line 76 of file LU.

typedef _MatrixType Eigen::PartialPivLU::MatrixType

Definition at line 65 of file LU.

typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime> Eigen::PartialPivLU::PermutationType

Definition at line 77 of file LU.

typedef NumTraits<typename MatrixType::Scalar>::Real Eigen::PartialPivLU::RealScalar

Definition at line 74 of file LU.

typedef MatrixType::Scalar Eigen::PartialPivLU::Scalar

Definition at line 73 of file LU.

Definition at line 75 of file LU.

typedef Transpositions<RowsAtCompileTime, MaxRowsAtCompileTime> Eigen::PartialPivLU::TranspositionType

Definition at line 78 of file LU.


Member Enumeration Documentation

anonymous enum
Enumerator:
RowsAtCompileTime 
ColsAtCompileTime 
Options 
MaxRowsAtCompileTime 
MaxColsAtCompileTime 

Definition at line 66 of file LU.


Constructor & Destructor Documentation

Eigen::PartialPivLU::PartialPivLU ( )

Default Constructor.

The default constructor is useful in cases in which the user intends to perform decompositions via PartialPivLU::compute(const MatrixType&).

Definition at line 196 of file LU.

Eigen::PartialPivLU::PartialPivLU ( Index  size)

Default Constructor with memory preallocation.

Like the default constructor but with preallocation of the internal data according to the specified problem size.

See also:
PartialPivLU()

Definition at line 206 of file LU.

Eigen::PartialPivLU::PartialPivLU ( const MatrixType matrix)

Constructor.

Parameters:
matrixthe matrix of which to compute the LU decomposition.
Warning:
The matrix should have full rank (e.g. if it's square, it should be invertible). If you need to deal with non-full rank, use class FullPivLU instead.

Definition at line 216 of file LU.


Member Function Documentation

Index Eigen::PartialPivLU::cols ( void  ) const [inline]

Definition at line 185 of file LU.

PartialPivLU< MatrixType > & Eigen::PartialPivLU::compute ( const MatrixType matrix)

Definition at line 401 of file LU.

internal::traits< MatrixType >::Scalar Eigen::PartialPivLU::determinant ( ) const
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:
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()

Definition at line 421 of file LU.

const internal::solve_retval<PartialPivLU,typename MatrixType::IdentityReturnType> Eigen::PartialPivLU::inverse ( ) const [inline]
Returns:
the inverse of the matrix of which *this is the LU decomposition.
Warning:
The matrix being decomposed here is assumed to be invertible. If you need to check for invertibility, use class FullPivLU instead.
See also:
MatrixBase::inverse(), LU::inverse()

Definition at line 160 of file LU.

const MatrixType& Eigen::PartialPivLU::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()

Definition at line 114 of file LU.

const PermutationType& Eigen::PartialPivLU::permutationP ( ) const [inline]
Returns:
the permutation matrix P.

Definition at line 122 of file LU.

MatrixType Eigen::PartialPivLU::reconstructedMatrix ( ) const
Returns:
the matrix represented by the decomposition, i.e., it returns the product: P^{-1} L U. This function is provided for debug purpose.

Definition at line 431 of file LU.

Index Eigen::PartialPivLU::rows ( void  ) const [inline]

Definition at line 184 of file LU.

template<typename Rhs >
const internal::solve_retval<PartialPivLU, Rhs> Eigen::PartialPivLU::solve ( const MatrixBase< Rhs > &  b) const [inline]

This method returns the solution x to the equation Ax=b, where A is the matrix of which *this is the LU decomposition.

Parameters:
bthe 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.
Returns:
the solution.

Example:

Output:

Since this PartialPivLU class assumes anyway that the matrix A is invertible, the solution theoretically exists and is unique regardless of b.

See also:
TriangularView::solve(), inverse(), computeInverse()

Definition at line 147 of file LU.


Member Data Documentation

Definition at line 191 of file LU.

Definition at line 192 of file LU.

Definition at line 188 of file LU.

Definition at line 189 of file LU.

Definition at line 190 of file LU.




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011