Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Types | Friends | List of all members
Eigen::HouseholderSequence Class Reference

Sequence of Householder reflections acting on subspaces with decreasing size. More...

#include <ForwardDeclarations.h>

Public Types

enum  { RowsAtCompileTime = internal::traits<HouseholderSequence>::RowsAtCompileTime, ColsAtCompileTime = internal::traits<HouseholderSequence>::ColsAtCompileTime, MaxRowsAtCompileTime = internal::traits<HouseholderSequence>::MaxRowsAtCompileTime, MaxColsAtCompileTime = internal::traits<HouseholderSequence>::MaxColsAtCompileTime }
 
typedef HouseholderSequence< VectorsType, typename internal::conditional< NumTraits< Scalar >::IsComplex, typename internal::remove_all< typename CoeffsType::ConjugateReturnType >::type, CoeffsType >::type, Side > AdjointReturnType
 
typedef HouseholderSequence< typename internal::conditional< NumTraits< Scalar >::IsComplex, typename internal::remove_all< typename VectorsType::ConjugateReturnType >::type, VectorsType >::type, typename internal::conditional< NumTraits< Scalar >::IsComplex, typename internal::remove_all< typename CoeffsType::ConjugateReturnType >::type, CoeffsType >::type, Side > ConjugateReturnType
 
typedef HouseholderSequence< typename internal::add_const< VectorsType >::type, typename internal::add_const< CoeffsType >::type, Side > ConstHouseholderSequence
 
typedef internal::traits< HouseholderSequence >::Scalar Scalar
 
typedef HouseholderSequence< typename internal::conditional< NumTraits< Scalar >::IsComplex, typename internal::remove_all< typename VectorsType::ConjugateReturnType >::type, VectorsType >::type, CoeffsType, Side > TransposeReturnType
 

Public Member Functions

AdjointReturnType adjoint () const
 Adjoint (conjugate transpose) of the Householder sequence. More...
 
template<typename Dest >
void applyThisOnTheLeft (Dest &dst, bool inputIsIdentity=false) const
 
template<typename Dest , typename Workspace >
void applyThisOnTheLeft (Dest &dst, Workspace &workspace, bool inputIsIdentity=false) const
 
template<typename Dest >
void applyThisOnTheRight (Dest &dst) const
 
template<typename Dest , typename Workspace >
void applyThisOnTheRight (Dest &dst, Workspace &workspace) const
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 Number of columns of transformation viewed as a matrix. More...
 
ConjugateReturnType conjugate () const
 Complex conjugate of the Householder sequence. More...
 
template<bool Cond>
EIGEN_DEVICE_FUNC internal::conditional< Cond, ConjugateReturnType, ConstHouseholderSequence >::type conjugateIf () const
 
const EIGEN_DEVICE_FUNC EssentialVectorType essentialVector (Index k) const
 Essential part of a Householder vector. More...
 
template<typename Dest , typename Workspace >
EIGEN_DEVICE_FUNC void evalTo (Dest &dst, Workspace &workspace) const
 
template<typename DestType >
EIGEN_DEVICE_FUNC void evalTo (DestType &dst) const
 
EIGEN_DEVICE_FUNC HouseholderSequence (const HouseholderSequence &other)
 Copy constructor. More...
 
EIGEN_DEVICE_FUNC HouseholderSequence (const VectorsType &v, const CoeffsType &h)
 Constructor. More...
 
AdjointReturnType inverse () const
 Inverse of the Householder sequence (equals the adjoint). More...
 
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. More...
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 Number of rows of transformation viewed as a matrix. More...
 
EIGEN_DEVICE_FUNC HouseholderSequencesetLength (Index length)
 Sets the length of the Householder sequence. More...
 
EIGEN_DEVICE_FUNC HouseholderSequencesetShift (Index shift)
 Sets the shift of the Householder sequence. More...
 
TransposeReturnType transpose () const
 Transpose of the Householder sequence. More...
 

Protected Types

enum  { BlockSize = 48 }
 

Protected Member Functions

HouseholderSequencesetReverseFlag (bool reverse)
 

Protected Attributes

CoeffsType::Nested m_coeffs
 
Index m_length
 
bool m_reverse
 
Index m_shift
 
VectorsType::Nested m_vectors
 

Private Types

typedef internal::hseq_side_dependent_impl< VectorsType, CoeffsType, Side >::EssentialVectorType EssentialVectorType
 

Friends

template<typename VectorsType2 , typename CoeffsType2 , int Side2>
class HouseholderSequence
 
template<typename _VectorsType , typename _CoeffsType , int _Side>
struct internal::hseq_side_dependent_impl
 

Detailed Description

Sequence of Householder reflections acting on subspaces with decreasing size.

\householder_module

Template Parameters
VectorsTypetype of matrix containing the Householder vectors
CoeffsTypetype of vector containing the Householder coefficients
Sideeither 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 $ n \times n $ matrix $ H $ of the form $ H = \prod_{i=0}^{n-1} H_i $ where the i-th Householder reflection is $ H_i = I - h_i v_i v_i^* $. The i-th Householder coefficient $ h_i $ is a scalar and the i-th Householder vector $ v_i $ is a vector of the form

\[ v_i = [\underbrace{0, \ldots, 0}_{i-1\mbox{ zeros}}, 1, \underbrace{*, \ldots,*}_{n-i\mbox{ arbitrary entries}} ]. \]

The last $ n-i $ entries of $ v_i $ are called the essential part of the Householder vector.

Typical usages are listed below, where H is a HouseholderSequence:

A.applyOnTheRight(H); // A = A * H
A.applyOnTheLeft(H); // A = H * A
A.applyOnTheRight(H.adjoint()); // A = A * H^*
A.applyOnTheLeft(H.adjoint()); // A = H^* * A
MatrixXd Q = H; // conversion to a dense matrix

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.

See also
MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()

Definition at line 282 of file ForwardDeclarations.h.

Member Typedef Documentation

◆ AdjointReturnType

Definition at line 149 of file HouseholderSequence.h.

◆ ConjugateReturnType

typedef HouseholderSequence< typename internal::conditional<NumTraits<Scalar>::IsComplex, typename internal::remove_all<typename VectorsType::ConjugateReturnType>::type, VectorsType>::type, typename internal::conditional<NumTraits<Scalar>::IsComplex, typename internal::remove_all<typename CoeffsType::ConjugateReturnType>::type, CoeffsType>::type, Side > Eigen::HouseholderSequence::ConjugateReturnType

Definition at line 141 of file HouseholderSequence.h.

◆ ConstHouseholderSequence

Definition at line 163 of file HouseholderSequence.h.

◆ EssentialVectorType

Definition at line 122 of file HouseholderSequence.h.

◆ Scalar

Definition at line 131 of file HouseholderSequence.h.

◆ TransposeReturnType

Definition at line 157 of file HouseholderSequence.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
RowsAtCompileTime 
ColsAtCompileTime 
MaxRowsAtCompileTime 
MaxColsAtCompileTime 

Definition at line 125 of file HouseholderSequence.h.

◆ anonymous enum

anonymous enum
protected
Enumerator
BlockSize 

Definition at line 501 of file HouseholderSequence.h.

Constructor & Destructor Documentation

◆ HouseholderSequence() [1/2]

EIGEN_DEVICE_FUNC Eigen::HouseholderSequence::HouseholderSequence ( const VectorsType &  v,
const CoeffsType &  h 
)
inline

Constructor.

Parameters
[in]vMatrix containing the essential parts of the Householder vectors
[in]hVector 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 $ is given by h(i) and the essential part of the i-th Householder vector $ v_i $ is given by 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.

Note
The HouseholderSequence object stores v and h by reference.

Example:

Matrix3d v = Matrix3d::Random();
cout << "The matrix v is:" << endl;
cout << v << endl;
Vector3d v0(1, v(1,0), v(2,0));
cout << "The first Householder vector is: v_0 = " << v0.transpose() << endl;
Vector3d v1(0, 1, v(2,1));
cout << "The second Householder vector is: v_1 = " << v1.transpose() << endl;
Vector3d v2(0, 0, 1);
cout << "The third Householder vector is: v_2 = " << v2.transpose() << endl;
Vector3d h = Vector3d::Random();
cout << "The Householder coefficients are: h = " << h.transpose() << endl;
Matrix3d H0 = Matrix3d::Identity() - h(0) * v0 * v0.adjoint();
cout << "The first Householder reflection is represented by H_0 = " << endl;
cout << H0 << endl;
Matrix3d H1 = Matrix3d::Identity() - h(1) * v1 * v1.adjoint();
cout << "The second Householder reflection is represented by H_1 = " << endl;
cout << H1 << endl;
Matrix3d H2 = Matrix3d::Identity() - h(2) * v2 * v2.adjoint();
cout << "The third Householder reflection is represented by H_2 = " << endl;
cout << H2 << endl;
cout << "Their product is H_0 H_1 H_2 = " << endl;
cout << H0 * H1 * H2 << endl;
HouseholderSequence<Matrix3d, Vector3d> hhSeq(v, h);
Matrix3d hhSeqAsMatrix(hhSeq);
cout << "If we construct a HouseholderSequence from v and h" << endl;
cout << "and convert it to a matrix, we get:" << endl;
cout << hhSeqAsMatrix << endl;

Output:

See also
setLength(), setShift()

Definition at line 183 of file HouseholderSequence.h.

◆ HouseholderSequence() [2/2]

EIGEN_DEVICE_FUNC Eigen::HouseholderSequence::HouseholderSequence ( const HouseholderSequence other)
inline

Copy constructor.

Definition at line 191 of file HouseholderSequence.h.

Member Function Documentation

◆ adjoint()

AdjointReturnType Eigen::HouseholderSequence::adjoint ( ) const
inline

Adjoint (conjugate transpose) of the Householder sequence.

Definition at line 266 of file HouseholderSequence.h.

◆ applyThisOnTheLeft() [1/2]

template<typename Dest >
void Eigen::HouseholderSequence::applyThisOnTheLeft ( Dest &  dst,
bool  inputIsIdentity = false 
) const
inline

Definition at line 361 of file HouseholderSequence.h.

◆ applyThisOnTheLeft() [2/2]

template<typename Dest , typename Workspace >
void Eigen::HouseholderSequence::applyThisOnTheLeft ( Dest &  dst,
Workspace &  workspace,
bool  inputIsIdentity = false 
) const
inline

Definition at line 369 of file HouseholderSequence.h.

◆ applyThisOnTheRight() [1/2]

template<typename Dest >
void Eigen::HouseholderSequence::applyThisOnTheRight ( Dest &  dst) const
inline

Definition at line 341 of file HouseholderSequence.h.

◆ applyThisOnTheRight() [2/2]

template<typename Dest , typename Workspace >
void Eigen::HouseholderSequence::applyThisOnTheRight ( Dest &  dst,
Workspace &  workspace 
) const
inline

Definition at line 349 of file HouseholderSequence.h.

◆ cols()

EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index Eigen::HouseholderSequence::cols ( ) const
inline

Number of columns of transformation viewed as a matrix.

Returns
Number of columns

This equals the dimension of the space that the transformation acts on.

Definition at line 212 of file HouseholderSequence.h.

◆ conjugate()

ConjugateReturnType Eigen::HouseholderSequence::conjugate ( ) const
inline

Complex conjugate of the Householder sequence.

Definition at line 245 of file HouseholderSequence.h.

◆ conjugateIf()

template<bool Cond>
EIGEN_DEVICE_FUNC internal::conditional<Cond,ConjugateReturnType,ConstHouseholderSequence>::type Eigen::HouseholderSequence::conjugateIf ( ) const
inline
Returns
an expression of the complex conjugate of *this if Cond==true, returns *this otherwise.

Definition at line 259 of file HouseholderSequence.h.

◆ essentialVector()

const EIGEN_DEVICE_FUNC EssentialVectorType Eigen::HouseholderSequence::essentialVector ( Index  k) const
inline

Essential part of a Householder vector.

Parameters
[in]kIndex of Householder reflection
Returns
Vector containing non-trivial entries of k-th Householder vector

This function returns the essential part of the Householder vector $ v_i $. This is a vector of length $ n-i $ containing the last $ n-i $ entries of the vector

\[ v_i = [\underbrace{0, \ldots, 0}_{i-1\mbox{ zeros}}, 1, \underbrace{*, \ldots,*}_{n-i\mbox{ arbitrary entries}} ]. \]

The index $ i $ equals k + shift(), corresponding to the k-th column of the matrix v passed to the constructor.

See also
setShift(), shift()

Definition at line 229 of file HouseholderSequence.h.

◆ evalTo() [1/2]

template<typename Dest , typename Workspace >
EIGEN_DEVICE_FUNC void Eigen::HouseholderSequence::evalTo ( Dest &  dst,
Workspace &  workspace 
) const
inline

Definition at line 290 of file HouseholderSequence.h.

◆ evalTo() [2/2]

template<typename DestType >
EIGEN_DEVICE_FUNC void Eigen::HouseholderSequence::evalTo ( DestType &  dst) const
inline

Definition at line 280 of file HouseholderSequence.h.

◆ inverse()

AdjointReturnType Eigen::HouseholderSequence::inverse ( ) const
inline

Inverse of the Householder sequence (equals the adjoint).

Definition at line 275 of file HouseholderSequence.h.

◆ operator*()

template<typename OtherDerived >
internal::matrix_type_times_scalar_type<Scalar, OtherDerived>::Type Eigen::HouseholderSequence::operator* ( const MatrixBase< OtherDerived > &  other) const
inline

Computes the product of a Householder sequence with a matrix.

Parameters
[in]otherMatrix being multiplied.
Returns
Expression object representing the product.

This function computes $ HM $ where $ H $ is the Householder sequence represented by *this and $ M $ is the matrix other.

Definition at line 423 of file HouseholderSequence.h.

◆ rows()

EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index Eigen::HouseholderSequence::rows ( ) const
inline

Number of rows of transformation viewed as a matrix.

Returns
Number of rows

This equals the dimension of the space that the transformation acts on.

Definition at line 205 of file HouseholderSequence.h.

◆ setLength()

EIGEN_DEVICE_FUNC HouseholderSequence& Eigen::HouseholderSequence::setLength ( Index  length)
inline

Sets the length of the Householder sequence.

Parameters
[in]lengthNew value for the length.

By default, the length $ n $ of the Householder sequence $ H = H_0 H_1 \ldots H_{n-1} $ is set to the number of columns of the matrix v passed to the constructor, or the number of rows if that is smaller. After this function is called, the length equals length.

See also
length()

Definition at line 443 of file HouseholderSequence.h.

◆ setReverseFlag()

HouseholderSequence& Eigen::HouseholderSequence::setReverseFlag ( bool  reverse)
inlineprotected

Definition at line 488 of file HouseholderSequence.h.

◆ setShift()

EIGEN_DEVICE_FUNC HouseholderSequence& Eigen::HouseholderSequence::setShift ( Index  shift)
inline

Sets the shift of the Householder sequence.

Parameters
[in]shiftNew value for the shift.

By default, a HouseholderSequence object represents $ H = H_0 H_1 \ldots H_{n-1} $ and the i-th column of the matrix v passed to the constructor corresponds to the i-th Householder reflection. After this function is called, the object represents $ H = H_{\mathrm{shift}} H_{\mathrm{shift}+1} \ldots H_{n-1} $ and the i-th column of v corresponds to the (shift+i)-th Householder reflection.

See also
shift()

Definition at line 461 of file HouseholderSequence.h.

◆ transpose()

TransposeReturnType Eigen::HouseholderSequence::transpose ( ) const
inline

Transpose of the Householder sequence.

Definition at line 236 of file HouseholderSequence.h.

Friends And Related Function Documentation

◆ HouseholderSequence

template<typename VectorsType2 , typename CoeffsType2 , int Side2>
friend class HouseholderSequence
friend

Definition at line 474 of file HouseholderSequence.h.

◆ internal::hseq_side_dependent_impl

template<typename _VectorsType , typename _CoeffsType , int _Side>
friend struct internal::hseq_side_dependent_impl
friend

Definition at line 431 of file HouseholderSequence.h.

Member Data Documentation

◆ m_coeffs

CoeffsType::Nested Eigen::HouseholderSequence::m_coeffs
protected

Definition at line 497 of file HouseholderSequence.h.

◆ m_length

Index Eigen::HouseholderSequence::m_length
protected

Definition at line 499 of file HouseholderSequence.h.

◆ m_reverse

bool Eigen::HouseholderSequence::m_reverse
protected

Definition at line 498 of file HouseholderSequence.h.

◆ m_shift

Index Eigen::HouseholderSequence::m_shift
protected

Definition at line 500 of file HouseholderSequence.h.

◆ m_vectors

VectorsType::Nested Eigen::HouseholderSequence::m_vectors
protected

Definition at line 496 of file HouseholderSequence.h.


The documentation for this class was generated from the following files:
H
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange[*:*] noreverse nowriteback set trange[*:*] noreverse nowriteback set urange[*:*] noreverse nowriteback set vrange[*:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
Definition: gnuplot_common_settings.hh:74
v0
static const double v0
Definition: testCal3DFisheye.cpp:31
hhSeqAsMatrix
Matrix3d hhSeqAsMatrix(hhSeq)
h
const double h
Definition: testSimpleHelicopter.cpp:19
A
Definition: test_numpy_dtypes.cpp:298
Eigen::Quaternion
The quaternion class used to represent 3D orientations and rotations.
Definition: ForwardDeclarations.h:293
v2
Vector v2
Definition: testSerializationBase.cpp:39
v
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
hhSeq
cout<< "The matrix v is:"<< endl;cout<< v<< endl;Vector3d v0(1, v(1, 0), v(2, 0));cout<< "The first Householder vector is: v_0 = "<< v0.transpose()<< endl;Vector3d v1(0, 1, v(2, 1));cout<< "The second Householder vector is: v_1 = "<< v1.transpose()<< endl;Vector3d v2(0, 0, 1);cout<< "The third Householder vector is: v_2 = "<< v2.transpose()<< endl;Vector3d h=Vector3d::Random();cout<< "The Householder coefficients are: h = "<< h.transpose()<< endl;Matrix3d H0=Matrix3d::Identity() - h(0) *v0 *v0.adjoint();cout<< "The first Householder reflection is represented by H_0 = "<< endl;cout<< H0<< endl;Matrix3d H1=Matrix3d::Identity() - h(1) *v1 *v1.adjoint();cout<< "The second Householder reflection is represented by H_1 = "<< endl;cout<< H1<< endl;Matrix3d H2=Matrix3d::Identity() - h(2) *v2 *v2.adjoint();cout<< "The third Householder reflection is represented by H_2 = "<< endl;cout<< H2<< endl;cout<< "Their product is H_0 H_1 H_2 = "<< endl;cout<< H0 *H1 *H2<< endl;HouseholderSequence< Matrix3d, Vector3d > hhSeq(v, h)
v1
Vector v1
Definition: testSerializationBase.cpp:38


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:10:52