![]() |
Eigen
3.4.90 (git rev 9589cc4e7fd8e4538bedef80dd36c7738977a8be)
|
#include <Eigen/src/Householder/HouseholderSequence.h>
Sequence of Householder reflections acting on subspaces with decreasing size.
This is defined in the Householder module.
VectorsType | type of matrix containing the Householder vectors |
CoeffsType | type of vector containing the Householder coefficients |
Side | either OnTheLeft (the default) or OnTheRight |
This class represents a product sequence of Householder reflections where the first Householder reflection acts on the whole space, the second Householder reflection leaves the one-dimensional subspace spanned by the first unit vector invariant, the third Householder reflection leaves the two-dimensional subspace spanned by the first two unit vectors invariant, and so on up to the last reflection which leaves all but one dimensions invariant and acts only on the last dimension. Such sequences of Householder reflections are used in several algorithms to zero out certain parts of a matrix. Indeed, the methods HessenbergDecomposition::matrixQ(), Tridiagonalization::matrixQ(), HouseholderQR::householderQ(), and ColPivHouseholderQR::householderQ() all return a HouseholderSequence.
More precisely, the class HouseholderSequence represents an
The last
Typical usages are listed below, where H is a HouseholderSequence:
In addition to the adjoint, you can also apply the inverse (=adjoint), the transpose, and the conjugate operators.
See the documentation for HouseholderSequence(const VectorsType&, const CoeffsType&) for an example.
Public Member Functions | |
AdjointReturnType | adjoint () const |
Adjoint (conjugate transpose) of the Householder sequence. | |
EIGEN_CONSTEXPR Index | cols () const EIGEN_NOEXCEPT |
Number of columns of transformation viewed as a matrix. | |
ConjugateReturnType | conjugate () const |
Complex conjugate of the Householder sequence. | |
template<bool Cond> | |
std::conditional_t< Cond, ConjugateReturnType, ConstHouseholderSequence > | conjugateIf () const |
const EssentialVectorType | essentialVector (Index k) const |
Essential part of a Householder vector. | |
HouseholderSequence (const HouseholderSequence &other) | |
Copy constructor. | |
HouseholderSequence (const VectorsType &v, const CoeffsType &h) | |
Constructor. | |
AdjointReturnType | inverse () const |
Inverse of the Householder sequence (equals the adjoint). | |
Index | length () const |
Returns the length of the Householder sequence. | |
template<typename OtherDerived> | |
internal::matrix_type_times_scalar_type< Scalar, OtherDerived >::Type | operator* (const MatrixBase< OtherDerived > &other) const |
Computes the product of a Householder sequence with a matrix. | |
EIGEN_CONSTEXPR Index | rows () const EIGEN_NOEXCEPT |
Number of rows of transformation viewed as a matrix. | |
HouseholderSequence & | setLength (Index length) |
Sets the length of the Householder sequence. | |
HouseholderSequence & | setShift (Index shift) |
Sets the shift of the Householder sequence. | |
Index | shift () const |
Returns the shift of the Householder sequence. | |
TransposeReturnType | transpose () const |
Transpose of the Householder sequence. | |
![]() | |
EIGEN_CONSTEXPR Index | cols () const EIGEN_NOEXCEPT |
constexpr HouseholderSequence< VectorsType, CoeffsType, Side > & | derived () |
constexpr const HouseholderSequence< VectorsType, CoeffsType, Side > & | derived () const |
EIGEN_CONSTEXPR Index | rows () const EIGEN_NOEXCEPT |
EIGEN_CONSTEXPR Index | size () const EIGEN_NOEXCEPT |
Additional Inherited Members | |
![]() | |
typedef Eigen::Index | Index |
The interface type of indices. | |
|
inline |
Constructor.
[in] | v | Matrix containing the essential parts of the Householder vectors |
[in] | h | Vector containing the Householder coefficients |
Constructs the Householder sequence with coefficients given by h
and vectors given by v
. The i-th Householder coefficient h(i)
and the essential part of the i-th Householder vector v(k,i)
with k
> i
(the subdiagonal part of the i-th column). If v
has fewer columns than rows, then the Householder sequence contains as many Householder reflections as there are columns.
v
and h
by reference.Example:
Output:
The matrix v is: 0.696 0.334 0.445 0.205 -0.47 -0.633 -0.415 0.928 0.0241 The first Householder vector is: v_0 = 1 0.205 -0.415 The second Householder vector is: v_1 = 0 1 0.928 The third Householder vector is: v_2 = 0 0 1 The Householder coefficients are: h = 0.0723 0.432 -0.046 The first Householder reflection is represented by H_0 = 0.928 -0.0148 0.03 -0.0148 0.997 0.00615 0.03 0.00615 0.988 The second Householder reflection is represented by H_1 = 1 0 0 0 0.568 -0.401 0 -0.401 0.628 The third Householder reflection is represented by H_2 = 1 0 0 0 1 0 0 0 1.05 Their product is H_0 H_1 H_2 = 0.928 -0.0204 0.0259 -0.0148 0.564 -0.414 0.03 -0.392 0.646 If we construct a HouseholderSequence from v and h and convert it to a matrix, we get: 0.928 -0.0204 0.0259 -0.0148 0.564 -0.414 0.03 -0.392 0.646
|
inline |
Number of columns of transformation viewed as a matrix.
This equals the dimension of the space that the transformation acts on.
|
inline |
*this
if Cond==true, returns *this
otherwise.
|
inline |
Essential part of a Householder vector.
[in] | k | Index of Householder reflection |
This function returns the essential part of the Householder vector
The index k
+ shift(), corresponding to the k-th column of the matrix v
passed to the constructor.
|
inline |
Computes the product of a Householder sequence with a matrix.
[in] | other | Matrix being multiplied. |
This function computes *this
and other
.
|
inline |
Number of rows of transformation viewed as a matrix.
This equals the dimension of the space that the transformation acts on.
|
inline |
Sets the length of the Householder sequence.
[in] | length | New value for the length. |
By default, the length v
passed to the constructor, or the number of rows if that is smaller. After this function is called, the length equals length
.
|
inline |
Sets the shift of the Householder sequence.
[in] | shift | New value for the shift. |
By default, a HouseholderSequence object represents v
passed to the constructor corresponds to the i-th Householder reflection. After this function is called, the object represents v
corresponds to the (shift+i)-th Householder reflection.