![]() |
Eigen
3.4.90 (git rev 9589cc4e7fd8e4538bedef80dd36c7738977a8be)
|
#include <Eigen/src/Eigenvalues/HessenbergDecomposition.h>
Reduces a square matrix to Hessenberg form by an orthogonal similarity transformation.
This is defined in the Eigenvalues module.
MatrixType_ | the type of the matrix of which we are computing the Hessenberg decomposition |
This class performs an Hessenberg decomposition of a matrix
Call the function compute() to compute the Hessenberg decomposition of a given matrix. Alternatively, you can use the HessenbergDecomposition(const MatrixType&) constructor which computes the Hessenberg decomposition at construction time. Once the decomposition is computed, you can use the matrixH() and matrixQ() functions to construct the matrices H and Q in the decomposition.
The documentation for matrixH() contains an example of the typical use of this class.
Public Types | |
typedef Matrix< Scalar, SizeMinusOne, 1, Options &~RowMajor, MaxSizeMinusOne, 1 > | CoeffVectorType |
Type for vector of Householder coefficients. | |
typedef HouseholderSequence< MatrixType, internal::remove_all_t< typename CoeffVectorType::ConjugateReturnType > > | HouseholderSequenceType |
Return type of matrixQ() | |
typedef Eigen::Index | Index |
typedef MatrixType_ | MatrixType |
Synonym for the template parameter MatrixType_ . | |
typedef MatrixType::Scalar | Scalar |
Scalar type for matrices of type MatrixType. | |
Public Member Functions | |
template<typename InputType> | |
HessenbergDecomposition & | compute (const EigenBase< InputType > &matrix) |
Computes Hessenberg decomposition of given matrix. | |
template<typename InputType> | |
HessenbergDecomposition (const EigenBase< InputType > &matrix) | |
Constructor; computes Hessenberg decomposition of given matrix. | |
HessenbergDecomposition (Index size=Size==Dynamic ? 2 :Size) | |
Default constructor; the decomposition will be computed later. | |
const CoeffVectorType & | householderCoefficients () const |
Returns the Householder coefficients. | |
MatrixHReturnType | matrixH () const |
Constructs the Hessenberg matrix H in the decomposition. | |
HouseholderSequenceType | matrixQ () const |
Reconstructs the orthogonal matrix Q in the decomposition. | |
const MatrixType & | packedMatrix () const |
Returns the internal representation of the decomposition. | |
typedef Matrix<Scalar, SizeMinusOne, 1, Options & ~RowMajor, MaxSizeMinusOne, 1> Eigen::HessenbergDecomposition< MatrixType_ >::CoeffVectorType |
Type for vector of Householder coefficients.
This is column vector with entries of type Scalar. The length of the vector is one less than the size of MatrixType, if it is a fixed-side type.
typedef Eigen::Index Eigen::HessenbergDecomposition< MatrixType_ >::Index |
|
inlineexplicit |
Default constructor; the decomposition will be computed later.
[in] | size | The size of the matrix whose Hessenberg decomposition will be computed. |
The default constructor is useful in cases in which the user intends to perform decompositions via compute(). The size
parameter is only used as a hint. It is not an error to give a wrong size
, but it may impair performance.
|
inlineexplicit |
|
inline |
Computes Hessenberg decomposition of given matrix.
[in] | matrix | Square matrix whose Hessenberg decomposition is to be computed. |
*this
The Hessenberg decomposition is computed by bringing the columns of the matrix successively in the required form using Householder reflections (see, e.g., Algorithm 7.4.2 in Golub & Van Loan, Matrix Computations). The cost is
This method reuses of the allocated data in the HessenbergDecomposition object.
Example:
Output:
The matrix H in the decomposition of A is: (0.924,-0.824) (0.722,0.0641) (0.163,0.047) (-0.99,0.681) (0.796,0) (-0.345,-0.471) (0.958,0.0777) (0.0977,-0.422) (0,0) (1.05,0) (0.419,-0.822) (-0.448,-0.197) (0,0) (0,0) (-1.2,0) (0.892,-0.312) The matrix H in the decomposition of 2A is: (1.85,-1.65) (1.44,0.128) (0.327,0.0941) (-1.98,1.36) (1.59,0) (-0.69,-0.941) (1.92,0.155) (0.195,-0.845) (0,0) (2.11,0) (0.838,-1.64) (-0.896,-0.394) (0,0) (0,0) (-2.41,0) (1.78,-0.625)
|
inline |
Returns the Householder coefficients.
The Householder coefficients allow the reconstruction of the matrix
|
inline |
Constructs the Hessenberg matrix H in the decomposition.
The object returned by this function constructs the Hessenberg matrix H when it is assigned to a matrix or otherwise evaluated. The matrix H is constructed from the packed matrix as returned by packedMatrix(): The upper part (including the subdiagonal) of the packed matrix contains the matrix H. It may sometimes be better to directly use the packed matrix instead of constructing the matrix H.
Example:
Output:
Here is a random 4x4 matrix: -0.824 -0.237 -0.779 -0.23 0.924 0.146 0.633 -0.139 -0.0532 0.634 -0.573 0.542 -0.199 0.334 0.982 0.0919 The Hessenberg matrix H is: -0.824 0.139 0.828 0.111 -0.947 0.0502 0.321 0.357 0 0.607 0.326 -0.557 0 0 -1.01 -0.711 The orthogonal matrix Q is: 1 0 0 0 0 -0.976 -0.144 0.163 0 0.0562 -0.891 -0.451 0 0.21 -0.431 0.877 Q H Q^T is: -0.824 -0.237 -0.779 -0.23 0.924 0.146 0.633 -0.139 -0.0532 0.634 -0.573 0.542 -0.199 0.334 0.982 0.0919
|
inline |
Reconstructs the orthogonal matrix Q in the decomposition.
This function returns a light-weight object of template class HouseholderSequence. You can either apply it directly to a matrix or you can convert it to a matrix of type MatrixType.
|
inline |
Returns the internal representation of the decomposition.
The returned matrix contains the following information:
See LAPACK for further details on this packed storage.
Example:
Output:
Here is a random 4x4 matrix: 0.696 -0.47 0.0241 0.134 0.205 0.928 0.0723 -0.16 -0.415 0.445 0.432 -0.00986 0.334 -0.633 -0.046 -0.498 The packed matrix M is: 0.696 0.108 -0.314 0.359 -0.571 -0.101 -0.259 -0.518 -0.535 -0.535 0.078 -0.567 0.431 0.806 -0.429 0.884 The upper Hessenberg part corresponds to the matrix H, which is: 0.696 0.108 -0.314 0.359 -0.571 -0.101 -0.259 -0.518 0 -0.535 0.078 -0.567 0 0 -0.429 0.884 The vector of Householder coefficients is: 1.36 1.21 0