Main MRPT website > C++ reference
MRPT logo
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Friends
Eigen::HouseholderSequence Class Reference

Detailed Description

Sequence of Householder reflections acting on subspaces with decreasing size

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()
Inheritance diagram for Eigen::HouseholderSequence:
Inheritance graph
[legend]

List of all members.

Public Types

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

Public Member Functions

 HouseholderSequence (const VectorsType &v, const CoeffsType &h)
 Constructor.
 HouseholderSequence (const HouseholderSequence &other)
 Copy constructor.
Index rows () const
 Number of rows of transformation viewed as a matrix.
Index cols () const
 Number of columns of transformation viewed as a matrix.
const EssentialVectorType essentialVector (Index k) const
 Essential part of a Householder vector.
HouseholderSequence transpose () const
 Transpose of the Householder sequence.
ConjugateReturnType conjugate () const
 Complex conjugate of the Householder sequence.
ConjugateReturnType adjoint () const
 Adjoint (conjugate transpose) of the Householder sequence.
ConjugateReturnType inverse () const
 Inverse of the Householder sequence (equals the adjoint).
template<typename DestType >
void evalTo (DestType &dst) const
template<typename Dest >
void applyThisOnTheRight (Dest &dst) const
template<typename Dest >
void applyThisOnTheLeft (Dest &dst) const
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.
HouseholderSequencesetLength (Index length)
 Sets the length of the Householder sequence.
HouseholderSequencesetShift (Index shift)
 Sets the shift of the Householder sequence.
Index length () const
 Returns the length of the Householder sequence.
Index shift () const
 Returns the shift of the Householder sequence.
Derived & derived ()
const Derived & derived () const
Derived & const_cast_derived () const
const Derived & const_derived () const
Index size () const
void evalTo (Dest &dst) const
void addTo (Dest &dst) const
void subTo (Dest &dst) const

Protected Member Functions

HouseholderSequencesetTrans (bool trans)
 Sets the transpose flag.
bool trans () const
 Returns the transpose flag.

Protected Attributes

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

Private Types

enum  { RowsAtCompileTime = internal::traits<HouseholderSequence>::RowsAtCompileTime, ColsAtCompileTime = internal::traits<HouseholderSequence>::ColsAtCompileTime, MaxRowsAtCompileTime = internal::traits<HouseholderSequence>::MaxRowsAtCompileTime, MaxColsAtCompileTime = internal::traits<HouseholderSequence>::MaxColsAtCompileTime }
typedef internal::traits
< HouseholderSequence >
::Scalar 
Scalar
typedef VectorsType::Index Index
typedef
internal::hseq_side_dependent_impl
< VectorsType, CoeffsType,
Side >::EssentialVectorType 
EssentialVectorType

Friends

struct internal::hseq_side_dependent_impl
class HouseholderSequence

Member Typedef Documentation

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

Definition at line 149 of file Householder.

Definition at line 139 of file Householder.

typedef VectorsType::Index Eigen::HouseholderSequence::Index [private]
typedef internal::traits<HouseholderSequence>::Scalar Eigen::HouseholderSequence::Scalar [private]

Definition at line 135 of file Householder.

typedef internal::traits<Derived>::StorageKind Eigen::EigenBase::StorageKind [inherited]

Definition at line 45 of file Core.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
RowsAtCompileTime 
ColsAtCompileTime 
MaxRowsAtCompileTime 
MaxColsAtCompileTime 

Definition at line 129 of file Householder.


Constructor & Destructor Documentation

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:

Output:

See also:
setLength(), setShift()

Definition at line 168 of file Householder.

Eigen::HouseholderSequence::HouseholderSequence ( const HouseholderSequence other) [inline]

Copy constructor.

Definition at line 175 of file Householder.


Member Function Documentation

void Eigen::EigenBase::addTo ( Dest &  dst) const [inline, inherited]

Definition at line 71 of file Core.

ConjugateReturnType Eigen::HouseholderSequence::adjoint ( ) const [inline]

Adjoint (conjugate transpose) of the Householder sequence.

Definition at line 232 of file Householder.

template<typename Dest >
void Eigen::HouseholderSequence::applyThisOnTheLeft ( Dest &  dst) const [inline]
template<typename Dest >
void Eigen::HouseholderSequence::applyThisOnTheRight ( Dest &  dst) const [inline]
Index Eigen::HouseholderSequence::cols ( void  ) 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.

Reimplemented from Eigen::EigenBase< HouseholderSequence< VectorsType, CoeffsType, Side > >.

Definition at line 194 of file Householder.

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

Complex conjugate of the Householder sequence.

Definition at line 223 of file Householder.

Derived& Eigen::EigenBase::const_cast_derived ( ) const [inline, inherited]

Definition at line 53 of file Core.

const Derived& Eigen::EigenBase::const_derived ( ) const [inline, inherited]

Definition at line 55 of file Core.

Derived& Eigen::EigenBase::derived ( ) [inline, inherited]
Returns:
a reference to the derived object

Definition at line 49 of file Core.

const Derived& Eigen::EigenBase::derived ( ) const [inline, inherited]
Returns:
a const reference to the derived object

Definition at line 51 of file Core.

const 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 210 of file Householder.

void Eigen::EigenBase::evalTo ( Dest &  dst) const [inline, inherited]

Definition at line 67 of file Core.

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

Definition at line 241 of file Householder.

ConjugateReturnType Eigen::HouseholderSequence::inverse ( ) const [inline]

Inverse of the Householder sequence (equals the adjoint).

Definition at line 238 of file Householder.

Index Eigen::HouseholderSequence::length ( ) const [inline]

Returns the length of the Householder sequence.

Definition at line 360 of file Householder.

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 318 of file Householder.

Index Eigen::HouseholderSequence::rows ( void  ) 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.

Reimplemented from Eigen::EigenBase< HouseholderSequence< VectorsType, CoeffsType, Side > >.

Definition at line 188 of file Householder.

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 337 of file Householder.

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 354 of file Householder.

HouseholderSequence& Eigen::HouseholderSequence::setTrans ( bool  trans) [inline, protected]

Sets the transpose flag.

Parameters:
[in]transNew value of the transpose flag.

By default, the transpose flag is not set. If the transpose flag is set, then this object represents $ H^T = H_{n-1}^T \ldots H_1^T H_0^T $ instead of $ H = H_0 H_1 \ldots H_{n-1} $.

See also:
trans()

Definition at line 376 of file Householder.

Index Eigen::HouseholderSequence::shift ( ) const [inline]

Returns the shift of the Householder sequence.

Definition at line 361 of file Householder.

Index Eigen::EigenBase::size ( ) const [inline, inherited]
Returns:
the number of coefficients, which is rows()*cols().
See also:
rows(), cols(), SizeAtCompileTime.

Definition at line 64 of file Core.

void Eigen::EigenBase::subTo ( Dest &  dst) const [inline, inherited]

Definition at line 81 of file Core.

bool Eigen::HouseholderSequence::trans ( ) const [inline, protected]

Returns the transpose flag.

Definition at line 382 of file Householder.

HouseholderSequence Eigen::HouseholderSequence::transpose ( ) const [inline]

Transpose of the Householder sequence.

Definition at line 217 of file Householder.


Friends And Related Function Documentation

friend class HouseholderSequence [friend]

Definition at line 364 of file Householder.

friend struct internal::hseq_side_dependent_impl [friend]

Definition at line 326 of file Householder.


Member Data Documentation

CoeffsType::Nested Eigen::HouseholderSequence::m_coeffs [protected]

Definition at line 385 of file Householder.

Definition at line 387 of file Householder.

Definition at line 388 of file Householder.

Definition at line 386 of file Householder.

VectorsType::Nested Eigen::HouseholderSequence::m_vectors [protected]

Definition at line 384 of file Householder.




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011