Public Types | Public Member Functions | Protected Attributes | List of all members
QR< MatrixType > Class Template Reference

QR decomposition of a matrix. More...

Public Types

typedef Block< MatrixType,
MatrixType::ColsAtCompileTime,
MatrixType::ColsAtCompileTime > 
MatrixRBlockType
typedef Matrix< Scalar,
MatrixType::ColsAtCompileTime,
MatrixType::ColsAtCompileTime > 
MatrixTypeR
typedef MatrixType::RealScalar RealScalar
typedef MatrixType::Scalar Scalar
typedef Matrix< Scalar,
MatrixType::ColsAtCompileTime, 1 > 
VectorType

Public Member Functions

void compute (const MatrixType &matrix)
int dimensionOfKernel () const
EIGEN_DEPRECATED bool isFullRank () const
bool isInjective () const
bool isInvertible () const
bool isSurjective () const
MatrixType matrixQ (void) const
const Part< NestByValue
< MatrixRBlockType >
, UpperTriangular > 
matrixR (void) const
 QR ()
 Default Constructor.
 QR (const MatrixType &matrix)
int rank () const
template<typename OtherDerived , typename ResultType >
bool solve (const MatrixBase< OtherDerived > &b, ResultType *result) const

Protected Attributes

VectorType m_hCoeffs
bool m_isInitialized
MatrixType m_qr
int m_rank
bool m_rankIsUptodate

Detailed Description

template<typename MatrixType>
class Eigen::QR< MatrixType >

QR decomposition of a matrix.

Warning
This is not considered to be part of the stable public API yet. Changes may happen in future releases. See Experimental parts of Eigen
Parameters
MatrixTypethe type of the matrix of which we are computing the QR decomposition

This class performs a QR decomposition using Householder transformations. The result is stored in a compact way compatible with LAPACK.

See Also
MatrixBase::qr()

Constructor & Destructor Documentation

QR ( )
inline

Default Constructor.

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

Member Function Documentation

int dimensionOfKernel ( ) const
inline
Returns
the dimension of the kernel of the matrix of which *this is the QR decomposition.
Note
Since the rank is computed only once, i.e. the first time it is needed, this method almost does not perform any further computation.
EIGEN_DEPRECATED bool isFullRank ( ) const
inline
Returns
whether or not the matrix is of full rank
Note
Since the rank is computed only once, i.e. the first time it is needed, this method almost does not perform any further computation.
bool isInjective ( ) const
inline
Returns
true if the matrix of which *this is the QR decomposition represents an injective linear map, i.e. has trivial kernel; false otherwise.
Note
Since the rank is computed only once, i.e. the first time it is needed, this method almost does not perform any further computation.
bool isInvertible ( ) const
inline
Returns
true if the matrix of which *this is the QR decomposition is invertible.
Note
Since the rank is computed only once, i.e. the first time it is needed, this method almost does not perform any further computation.
bool isSurjective ( ) const
inline
Returns
true if the matrix of which *this is the QR decomposition represents a surjective linear map; false otherwise.
Note
Since the rank is computed only once, i.e. the first time it is needed, this method almost does not perform any further computation.
MatrixType matrixQ ( void  ) const
Returns
the matrix Q
const Part<NestByValue<MatrixRBlockType>, UpperTriangular> matrixR ( void  ) const
inline
Returns
a read-only expression of the matrix R of the actual the QR decomposition
int rank ( ) const
Returns
the rank of the matrix of which *this is the QR decomposition.
Note
Since the rank is computed only once, i.e. the first time it is needed, this method almost does not perform any further computation.
Returns
the rank of the matrix of which *this is the QR decomposition.
bool solve ( const MatrixBase< OtherDerived > &  b,
ResultType *  result 
) const

This method finds a solution x to the equation Ax=b, where A is the matrix of which *this is the QR decomposition, if any exists.

Parameters
bthe right-hand-side of the equation to solve.
resulta pointer to the vector/matrix in which to store the solution, if any exists. Resized if necessary, so that result->rows()==A.cols() and result->cols()==b.cols(). If no solution exists, *result is left with undefined coefficients.
Returns
true if any solution exists, false if no solution exists.
Note
If there exist more than one solution, this method will arbitrarily choose one. If you need a complete analysis of the space of solutions, take the one solution obtained by this method and add to it elements of the kernel, as determined by kernel().
The case where b is a matrix is not yet implemented. Also, this code is space inefficient.

Example:

Output:

See Also
MatrixBase::solveTriangular(), kernel(), computeKernel(), inverse(), computeInverse()

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