Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Eigen_test Odometry_test AttitudeEstimation_usingTicker MPU9250_Quaternion_Binary_Serial ... more
HouseholderQR< _MatrixType > Class Template Reference
[QR module]
Householder QR decomposition of a matrix. More...
#include <HouseholderQR.h>
Public Member Functions | |
HouseholderQR () | |
Default Constructor. | |
HouseholderQR (Index rows, Index cols) | |
Default Constructor with memory preallocation. | |
HouseholderQR (const MatrixType &matrix) | |
Constructs a QR factorization from a given matrix. | |
template<typename Rhs > | |
const internal::solve_retval < HouseholderQR, Rhs > | solve (const MatrixBase< Rhs > &b) 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. | |
HouseholderSequenceType | householderQ () const |
This method returns an expression of the unitary matrix Q as a sequence of Householder transformations. | |
const MatrixType & | matrixQR () const |
HouseholderQR & | compute (const MatrixType &matrix) |
Performs the QR factorization of the given matrix matrix. | |
MatrixType::RealScalar | absDeterminant () const |
MatrixType::RealScalar | logAbsDeterminant () const |
const HCoeffsType & | hCoeffs () const |
Detailed Description
template<typename _MatrixType>
class Eigen::HouseholderQR< _MatrixType >
Householder QR decomposition of a matrix.
- Parameters:
-
MatrixType the type of the matrix of which we are computing the QR decomposition
This class performs a QR decomposition of a matrix A into matrices Q and R such that
by using Householder transformations. Here, Q a unitary matrix and R an upper triangular matrix. The result is stored in a compact way compatible with LAPACK.
Note that no pivoting is performed. This is not a rank-revealing decomposition. If you want that feature, use FullPivHouseholderQR or ColPivHouseholderQR instead.
This Householder QR decomposition is faster, but less numerically stable and less feature-full than FullPivHouseholderQR or ColPivHouseholderQR.
- See also:
- MatrixBase::householderQr()
Definition at line 42 of file HouseholderQR.h.
Constructor & Destructor Documentation
HouseholderQR | ( | ) |
Default Constructor.
The default constructor is useful in cases in which the user intends to perform decompositions via HouseholderQR::compute(const MatrixType&).
Definition at line 68 of file HouseholderQR.h.
HouseholderQR | ( | 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:
- HouseholderQR()
Definition at line 76 of file HouseholderQR.h.
HouseholderQR | ( | const MatrixType & | matrix ) |
Constructs a QR factorization from a given matrix.
This constructor computes the QR factorization of the matrix matrix by calling the method compute(). It is a short cut for:
HouseholderQR<MatrixType> qr(matrix.rows(), matrix.cols()); qr.compute(matrix);
- See also:
- compute()
Definition at line 94 of file HouseholderQR.h.
Member Function Documentation
MatrixType::RealScalar absDeterminant | ( | ) | const |
- Returns:
- the absolute value of the determinant of the matrix of which *this is the QR decomposition. It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the QR decomposition has already been computed.
- Note:
- This is only for square matrices.
- Warning:
- a determinant can be very big or small, so for matrices of large enough dimension, there is a risk of overflow/underflow. One way to work around that is to use logAbsDeterminant() instead.
- See also:
- logAbsDeterminant(), MatrixBase::determinant()
Definition at line 205 of file HouseholderQR.h.
HouseholderQR< MatrixType > & compute | ( | const MatrixType & | matrix ) |
Performs the QR factorization of the given matrix matrix.
The result of the factorization is stored into *this
, and a reference to *this
is returned.
- See also:
- class HouseholderQR, HouseholderQR(const MatrixType&)
Definition at line 356 of file HouseholderQR.h.
const HCoeffsType& hCoeffs | ( | ) | const |
- Returns:
- a const reference to the vector of Householder coefficients used to represent the factor
Q
.
For advanced uses only.
Definition at line 189 of file HouseholderQR.h.
HouseholderSequenceType householderQ | ( | void | ) | const |
This method returns an expression of the unitary matrix Q as a sequence of Householder transformations.
The returned expression can directly be used to perform matrix products. It can also be assigned to a dense Matrix object. Here is an example showing how to recover the full or thin matrix Q, as well as how to perform matrix products using operator*:
Example:
Output:
Definition at line 136 of file HouseholderQR.h.
MatrixType::RealScalar logAbsDeterminant | ( | ) | const |
- Returns:
- the natural log of the absolute value of the determinant of the matrix of which *this is the QR decomposition. It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the QR decomposition has already been computed.
- Note:
- This is only for square matrices.
- This method is useful to work around the risk of overflow/underflow that's inherent to determinant computation.
- See also:
- absDeterminant(), MatrixBase::determinant()
Definition at line 214 of file HouseholderQR.h.
const MatrixType& matrixQR | ( | ) | const |
- Returns:
- a reference to the matrix where the Householder QR decomposition is stored in a LAPACK-compatible way.
Definition at line 145 of file HouseholderQR.h.
const internal::solve_retval<HouseholderQR, Rhs> solve | ( | const MatrixBase< Rhs > & | b ) | 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:
-
b the right-hand-side of the equation to solve.
- Returns:
- a solution.
- Note:
- The case where b is a matrix is not yet implemented. Also, this code is space inefficient.
Example:
Output:
Definition at line 122 of file HouseholderQR.h.
Generated on Tue Jul 12 2022 17:47:06 by
