Main MRPT website > C++ reference
MRPT logo
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends

TriangularView< _MatrixType, _Mode > Class Template Reference


Detailed Description

template<typename _MatrixType, unsigned int _Mode>
class TriangularView< _MatrixType, _Mode >

Base class for triangular part in a matrix.

Parameters:
MatrixType the type of the object in which we are taking the triangular part
Mode the kind of triangular matrix expression to construct. Can be Upper, Lower, UpperSelfadjoint, or LowerSelfadjoint. This is in fact a bit field; it must have either Upper or Lower, and additionnaly it may have either UnitDiag or Selfadjoint.

This class represents a triangular part of a matrix, not necessarily square. Strictly speaking, for rectangular matrices one should speak ok "trapezoid" parts. This class is the return type of MatrixBase::triangularView() and most of the time this is the only way it is used.

See also:
MatrixBase::triangularView()

Definition at line 153 of file TriangularMatrix.h.

#include <src/Core/TriangularMatrix.h>

Inheritance diagram for TriangularView< _MatrixType, _Mode >:
Inheritance graph
[legend]

List of all members.

Public Types

enum  { Mode = _Mode, TransposeMode }
typedef TriangularBase
< TriangularView
Base
typedef internal::traits
< TriangularView >::Scalar 
Scalar
typedef _MatrixType MatrixType
typedef MatrixType::PlainObject DenseMatrixType
typedef internal::traits
< TriangularView >
::StorageKind 
StorageKind
typedef internal::traits
< TriangularView >::Index 
Index

Public Member Functions

 TriangularView (const MatrixType &matrix)
Index rows () const
Index cols () const
Index outerStride () const
Index innerStride () const
template<typename Other >
TriangularViewoperator+= (const DenseBase< Other > &other)
template<typename Other >
TriangularViewoperator-= (const DenseBase< Other > &other)
TriangularViewoperator*= (const typename internal::traits< MatrixType >::Scalar &other)
TriangularViewoperator/= (const typename internal::traits< MatrixType >::Scalar &other)
void fill (const Scalar &value)
TriangularViewsetConstant (const Scalar &value)
TriangularViewsetZero ()
TriangularViewsetOnes ()
Scalar coeff (Index row, Index col) const
ScalarcoeffRef (Index row, Index col)
const MatrixTypenestedExpression () const
MatrixTypenestedExpression ()
template<typename OtherDerived >
TriangularViewoperator= (const TriangularBase< OtherDerived > &other)
 Assigns a triangular matrix to a triangular part of a dense matrix.
template<typename OtherDerived >
TriangularViewoperator= (const MatrixBase< OtherDerived > &other)
TriangularViewoperator= (const TriangularView &other)
template<typename OtherDerived >
void lazyAssign (const TriangularBase< OtherDerived > &other)
template<typename OtherDerived >
void lazyAssign (const MatrixBase< OtherDerived > &other)
TriangularView
< MatrixConjugateReturnType,
Mode > 
conjugate ()
const TriangularView
< MatrixConjugateReturnType,
Mode > 
conjugate () const
TriangularView< typename
MatrixType::AdjointReturnType,
TransposeMode > 
adjoint ()
const TriangularView< typename
MatrixType::AdjointReturnType,
TransposeMode > 
adjoint () const
TriangularView< Transpose
< MatrixType >, TransposeMode > 
transpose ()
const TriangularView
< Transpose< MatrixType >
, TransposeMode > 
transpose () const
DenseMatrixType toDenseMatrix () const
template<typename OtherDerived >
TriangularProduct< Mode, true,
MatrixType, false,
OtherDerived,
OtherDerived::IsVectorAtCompileTime > 
operator* (const MatrixBase< OtherDerived > &rhs) const
 Efficient triangular matrix times vector/matrix product.
template<int Side, typename OtherDerived >
internal::plain_matrix_type_column_major
< OtherDerived >::type 
solve (const MatrixBase< OtherDerived > &other) const
template<int Side, typename OtherDerived >
void solveInPlace (const MatrixBase< OtherDerived > &other) const
 "in-place" version of TriangularView::solve() where the result is written in other
template<typename OtherDerived >
internal::plain_matrix_type_column_major
< OtherDerived >::type 
solve (const MatrixBase< OtherDerived > &other) const
template<typename OtherDerived >
void solveInPlace (const MatrixBase< OtherDerived > &other) const
const SelfAdjointView
< _MatrixTypeNested, Mode > 
selfadjointView () const
SelfAdjointView
< _MatrixTypeNested, Mode > 
selfadjointView ()
template<typename OtherDerived >
void swap (TriangularBase< OtherDerived > const &other)
template<typename OtherDerived >
void swap (MatrixBase< OtherDerived > const &other)
Scalar determinant () const
template<typename ProductDerived , typename Lhs , typename Rhs >
EIGEN_STRONG_INLINE
TriangularView
operator= (const ProductBase< ProductDerived, Lhs, Rhs > &other)
template<typename ProductDerived , typename Lhs , typename Rhs >
EIGEN_STRONG_INLINE
TriangularView
operator+= (const ProductBase< ProductDerived, Lhs, Rhs > &other)
template<typename ProductDerived , typename Lhs , typename Rhs >
EIGEN_STRONG_INLINE
TriangularView
operator-= (const ProductBase< ProductDerived, Lhs, Rhs > &other)
template<typename ProductDerived >
EIGEN_STRONG_INLINE
TriangularView
operator= (const ScaledProduct< ProductDerived > &other)
template<typename ProductDerived >
EIGEN_STRONG_INLINE
TriangularView
operator+= (const ScaledProduct< ProductDerived > &other)
template<typename ProductDerived >
EIGEN_STRONG_INLINE
TriangularView
operator-= (const ScaledProduct< ProductDerived > &other)
template<typename ProductDerived , typename _Lhs , typename _Rhs >
TriangularView< MatrixType,
UpLo > & 
assignProduct (const ProductBase< ProductDerived, _Lhs, _Rhs > &prod, const Scalar &alpha)
template<int Side, typename RhsDerived >
internal::plain_matrix_type_column_major
< RhsDerived >::type 
solve (const MatrixBase< RhsDerived > &rhs) const

Protected Types

typedef MatrixType::Nested MatrixTypeNested
typedef internal::remove_all
< MatrixTypeNested >::type 
_MatrixTypeNested
typedef internal::remove_all
< typename
MatrixType::ConjugateReturnType >
::type 
MatrixConjugateReturnType

Protected Member Functions

template<typename ProductDerived , typename Lhs , typename Rhs >
EIGEN_STRONG_INLINE
TriangularView
assignProduct (const ProductBase< ProductDerived, Lhs, Rhs > &prod, const Scalar &alpha)

Protected Attributes

const MatrixTypeNested m_matrix

Friends

template<typename OtherDerived >
TriangularProduct< Mode, false,
OtherDerived,
OtherDerived::IsVectorAtCompileTime,
MatrixType, false > 
operator* (const MatrixBase< OtherDerived > &lhs, const TriangularView &rhs)
 Efficient vector/matrix times triangular matrix product.

Member Typedef Documentation

template<typename _MatrixType, unsigned int _Mode>
typedef internal::remove_all<MatrixTypeNested>::type TriangularView< _MatrixType, _Mode >::_MatrixTypeNested [protected]

Definition at line 166 of file TriangularMatrix.h.

template<typename _MatrixType, unsigned int _Mode>
typedef TriangularBase<TriangularView> TriangularView< _MatrixType, _Mode >::Base

Definition at line 158 of file TriangularMatrix.h.

template<typename _MatrixType, unsigned int _Mode>
typedef MatrixType::PlainObject TriangularView< _MatrixType, _Mode >::DenseMatrixType

Definition at line 162 of file TriangularMatrix.h.

template<typename _MatrixType, unsigned int _Mode>
typedef internal::traits<TriangularView>::Index TriangularView< _MatrixType, _Mode >::Index

Reimplemented from TriangularBase< TriangularView< _MatrixType, _Mode > >.

Definition at line 174 of file TriangularMatrix.h.

template<typename _MatrixType, unsigned int _Mode>
typedef internal::remove_all<typename MatrixType::ConjugateReturnType>::type TriangularView< _MatrixType, _Mode >::MatrixConjugateReturnType [protected]

Definition at line 167 of file TriangularMatrix.h.

template<typename _MatrixType, unsigned int _Mode>
typedef _MatrixType TriangularView< _MatrixType, _Mode >::MatrixType

Definition at line 161 of file TriangularMatrix.h.

template<typename _MatrixType, unsigned int _Mode>
typedef MatrixType::Nested TriangularView< _MatrixType, _Mode >::MatrixTypeNested [protected]

Definition at line 165 of file TriangularMatrix.h.

template<typename _MatrixType, unsigned int _Mode>
typedef internal::traits<TriangularView>::Scalar TriangularView< _MatrixType, _Mode >::Scalar

Reimplemented from TriangularBase< TriangularView< _MatrixType, _Mode > >.

Definition at line 159 of file TriangularMatrix.h.

template<typename _MatrixType, unsigned int _Mode>
typedef internal::traits<TriangularView>::StorageKind TriangularView< _MatrixType, _Mode >::StorageKind

Reimplemented from TriangularBase< TriangularView< _MatrixType, _Mode > >.

Definition at line 173 of file TriangularMatrix.h.


Member Enumeration Documentation

template<typename _MatrixType, unsigned int _Mode>
anonymous enum
Enumerator:
Mode 
TransposeMode 

Definition at line 176 of file TriangularMatrix.h.


Constructor & Destructor Documentation

template<typename _MatrixType, unsigned int _Mode>
TriangularView< _MatrixType, _Mode >::TriangularView ( const MatrixType matrix  )  [inline]

Definition at line 184 of file TriangularMatrix.h.


Member Function Documentation

template<typename _MatrixType, unsigned int _Mode>
TriangularView<typename MatrixType::AdjointReturnType,TransposeMode> TriangularView< _MatrixType, _Mode >::adjoint (  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
const TriangularView<typename MatrixType::AdjointReturnType,TransposeMode> TriangularView< _MatrixType, _Mode >::adjoint (  )  const [inline]
template<typename _MatrixType, unsigned int _Mode>
template<typename ProductDerived , typename Lhs , typename Rhs >
EIGEN_STRONG_INLINE TriangularView& TriangularView< _MatrixType, _Mode >::assignProduct ( const ProductBase< ProductDerived, Lhs, Rhs > &  prod,
const Scalar alpha 
) [protected]
template<typename _MatrixType, unsigned int _Mode>
template<typename ProductDerived , typename _Lhs , typename _Rhs >
TriangularView<MatrixType,UpLo>& TriangularView< _MatrixType, _Mode >::assignProduct ( const ProductBase< ProductDerived, _Lhs, _Rhs > &  prod,
const Scalar alpha 
)
template<typename _MatrixType, unsigned int _Mode>
Scalar TriangularView< _MatrixType, _Mode >::coeff ( Index  row,
Index  col 
) const [inline]
See also:
MatrixBase::coeff()
Warning:
the coordinates must fit into the referenced triangular part

Definition at line 214 of file TriangularMatrix.h.

References TriangularBase< Derived >::check_coordinates_internal(), and TriangularView< _MatrixType, _Mode >::m_matrix.

template<typename _MatrixType, unsigned int _Mode>
Scalar& TriangularView< _MatrixType, _Mode >::coeffRef ( Index  row,
Index  col 
) [inline]
See also:
MatrixBase::coeffRef()
Warning:
the coordinates must fit into the referenced triangular part

Definition at line 223 of file TriangularMatrix.h.

References TriangularBase< Derived >::check_coordinates_internal(), and TriangularView< _MatrixType, _Mode >::m_matrix.

template<typename _MatrixType, unsigned int _Mode>
Index TriangularView< _MatrixType, _Mode >::cols ( void   )  const [inline]
template<typename _MatrixType, unsigned int _Mode>
TriangularView<MatrixConjugateReturnType,Mode> TriangularView< _MatrixType, _Mode >::conjugate (  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
const TriangularView<MatrixConjugateReturnType,Mode> TriangularView< _MatrixType, _Mode >::conjugate (  )  const [inline]
template<typename _MatrixType, unsigned int _Mode>
Scalar TriangularView< _MatrixType, _Mode >::determinant (  )  const [inline]
template<typename _MatrixType, unsigned int _Mode>
void TriangularView< _MatrixType, _Mode >::fill ( const Scalar value  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
Index TriangularView< _MatrixType, _Mode >::innerStride (  )  const [inline]
template<typename MatrixType , unsigned int Mode>
template<typename OtherDerived >
void TriangularView< MatrixType, Mode >::lazyAssign ( const MatrixBase< OtherDerived > &  other  ) 
template<typename MatrixType , unsigned int Mode>
template<typename OtherDerived >
void TriangularView< MatrixType, Mode >::lazyAssign ( const TriangularBase< OtherDerived > &  other  ) 
template<typename _MatrixType, unsigned int _Mode>
MatrixType& TriangularView< _MatrixType, _Mode >::nestedExpression (  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
const MatrixType& TriangularView< _MatrixType, _Mode >::nestedExpression (  )  const [inline]
template<typename _MatrixType, unsigned int _Mode>
template<typename OtherDerived >
TriangularProduct<Mode,true,MatrixType,false,OtherDerived,OtherDerived::IsVectorAtCompileTime> TriangularView< _MatrixType, _Mode >::operator* ( const MatrixBase< OtherDerived > &  rhs  )  const [inline]

Efficient triangular matrix times vector/matrix product.

Definition at line 282 of file TriangularMatrix.h.

References TriangularView< _MatrixType, _Mode >::m_matrix.

template<typename _MatrixType, unsigned int _Mode>
TriangularView& TriangularView< _MatrixType, _Mode >::operator*= ( const typename internal::traits< MatrixType >::Scalar other  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
template<typename ProductDerived , typename Lhs , typename Rhs >
EIGEN_STRONG_INLINE TriangularView& TriangularView< _MatrixType, _Mode >::operator+= ( const ProductBase< ProductDerived, Lhs, Rhs > &  other  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
template<typename Other >
TriangularView& TriangularView< _MatrixType, _Mode >::operator+= ( const DenseBase< Other > &  other  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
template<typename ProductDerived >
EIGEN_STRONG_INLINE TriangularView& TriangularView< _MatrixType, _Mode >::operator+= ( const ScaledProduct< ProductDerived > &  other  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
template<typename ProductDerived >
EIGEN_STRONG_INLINE TriangularView& TriangularView< _MatrixType, _Mode >::operator-= ( const ScaledProduct< ProductDerived > &  other  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
template<typename ProductDerived , typename Lhs , typename Rhs >
EIGEN_STRONG_INLINE TriangularView& TriangularView< _MatrixType, _Mode >::operator-= ( const ProductBase< ProductDerived, Lhs, Rhs > &  other  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
template<typename Other >
TriangularView& TriangularView< _MatrixType, _Mode >::operator-= ( const DenseBase< Other > &  other  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
TriangularView& TriangularView< _MatrixType, _Mode >::operator/= ( const typename internal::traits< MatrixType >::Scalar other  )  [inline]
template<typename MatrixType , unsigned int Mode>
template<typename OtherDerived >
TriangularView< MatrixType, Mode > & TriangularView< MatrixType, Mode >::operator= ( const TriangularBase< OtherDerived > &  other  )  [inline]
template<typename MatrixType , unsigned int Mode>
template<typename OtherDerived >
TriangularView< MatrixType, Mode > & TriangularView< MatrixType, Mode >::operator= ( const MatrixBase< OtherDerived > &  other  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
TriangularView& TriangularView< _MatrixType, _Mode >::operator= ( const TriangularView< _MatrixType, _Mode > &  other  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
template<typename ProductDerived , typename Lhs , typename Rhs >
EIGEN_STRONG_INLINE TriangularView& TriangularView< _MatrixType, _Mode >::operator= ( const ProductBase< ProductDerived, Lhs, Rhs > &  other  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
template<typename ProductDerived >
EIGEN_STRONG_INLINE TriangularView& TriangularView< _MatrixType, _Mode >::operator= ( const ScaledProduct< ProductDerived > &  other  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
Index TriangularView< _MatrixType, _Mode >::outerStride (  )  const [inline]
template<typename _MatrixType, unsigned int _Mode>
Index TriangularView< _MatrixType, _Mode >::rows ( void   )  const [inline]
template<typename _MatrixType, unsigned int _Mode>
const SelfAdjointView<_MatrixTypeNested,Mode> TriangularView< _MatrixType, _Mode >::selfadjointView (  )  const [inline]
template<typename _MatrixType, unsigned int _Mode>
SelfAdjointView<_MatrixTypeNested,Mode> TriangularView< _MatrixType, _Mode >::selfadjointView (  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
TriangularView& TriangularView< _MatrixType, _Mode >::setConstant ( const Scalar value  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
TriangularView& TriangularView< _MatrixType, _Mode >::setOnes (  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
TriangularView& TriangularView< _MatrixType, _Mode >::setZero (  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
template<int Side, typename OtherDerived >
internal::plain_matrix_type_column_major<OtherDerived>::type TriangularView< _MatrixType, _Mode >::solve ( const MatrixBase< OtherDerived > &  other  )  const
template<typename _MatrixType, unsigned int _Mode>
template<typename OtherDerived >
internal::plain_matrix_type_column_major<OtherDerived>::type TriangularView< _MatrixType, _Mode >::solve ( const MatrixBase< OtherDerived > &  other  )  const [inline]

Definition at line 308 of file TriangularMatrix.h.

template<typename _MatrixType, unsigned int _Mode>
template<int Side, typename RhsDerived >
internal::plain_matrix_type_column_major<RhsDerived>::type TriangularView< _MatrixType, _Mode >::solve ( const MatrixBase< RhsDerived > &  rhs  )  const
Returns:
the product of the inverse of *this with other, *this being triangular.

This function computes the inverse-matrix matrix product inverse(*this) * other. The matrix *this must be triangular and invertible (i.e., all the coefficients of the diagonal must be non zero). It works as a forward (resp. backward) substitution if *this is an upper (resp. lower) triangular matrix.

It is required that *this be marked as either an upper or a lower triangular matrix, which can be done by marked(), and that is automatically the case with expressions such as those returned by extract().

Example:

Output:

This function is essentially a wrapper to the faster solveTriangularInPlace() function creating a temporary copy of other, calling solveTriangularInPlace() on the copy and returning it. Therefore, if other is not needed anymore, it is quite faster to call solveTriangularInPlace() instead of solveTriangular().

For users coming from BLAS, this function (and more specifically solveTriangularInPlace()) offer all the operations supported by the *TRSV and *TRSM BLAS routines.

Tips: to perform a "right-inverse-multiply" you can simply transpose the operation, e.g.:

 M * T^1  <=>  T.transpose().solveInPlace(M.transpose());
See also:
TriangularView::solveInPlace()

Definition at line 240 of file SolveTriangular.h.

template<typename MatrixType , unsigned int Mode>
template<int Side, typename OtherDerived >
void TriangularView< MatrixType, Mode >::solveInPlace ( const MatrixBase< OtherDerived > &  _other  )  const

"in-place" version of TriangularView::solve() where the result is written in other

Warning:
The parameter is only marked 'const' to make the C++ compiler accept a temporary expression here. This function will const_cast it, so constness isn't honored here.

See TriangularView:solve() for the details.

Definition at line 186 of file SolveTriangular.h.

References TriangularView< _MatrixType, _Mode >::cols(), eigen_assert, Lower, TriangularView< _MatrixType, _Mode >::Mode, TriangularView< _MatrixType, _Mode >::nestedExpression(), OnTheLeft, OnTheRight, RowMajorBit, TriangularView< _MatrixType, _Mode >::rows(), Upper, and ZeroDiag.

template<typename _MatrixType, unsigned int _Mode>
template<typename OtherDerived >
void TriangularView< _MatrixType, _Mode >::solveInPlace ( const MatrixBase< OtherDerived > &  other  )  const [inline]

Definition at line 312 of file TriangularMatrix.h.

template<typename _MatrixType, unsigned int _Mode>
template<typename OtherDerived >
void TriangularView< _MatrixType, _Mode >::swap ( MatrixBase< OtherDerived > const &  other  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
template<typename OtherDerived >
void TriangularView< _MatrixType, _Mode >::swap ( TriangularBase< OtherDerived > const &  other  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
DenseMatrixType TriangularView< _MatrixType, _Mode >::toDenseMatrix (  )  const [inline]
template<typename _MatrixType, unsigned int _Mode>
TriangularView<Transpose<MatrixType>,TransposeMode> TriangularView< _MatrixType, _Mode >::transpose (  )  [inline]
template<typename _MatrixType, unsigned int _Mode>
const TriangularView<Transpose<MatrixType>,TransposeMode> TriangularView< _MatrixType, _Mode >::transpose (  )  const [inline]

Friends And Related Function Documentation

template<typename _MatrixType, unsigned int _Mode>
template<typename OtherDerived >
TriangularProduct<Mode,false,OtherDerived,OtherDerived::IsVectorAtCompileTime,MatrixType,false> operator* ( const MatrixBase< OtherDerived > &  lhs,
const TriangularView< _MatrixType, _Mode > &  rhs 
) [friend]

Efficient vector/matrix times triangular matrix product.

Definition at line 292 of file TriangularMatrix.h.


Member Data Documentation

template<typename _MatrixType, unsigned int _Mode>
const MatrixTypeNested TriangularView< _MatrixType, _Mode >::m_matrix [protected]



Page generated by Doxygen 1.7.1 for MRPT 0.9.4 SVN: at Mon Jan 10 23:33:19 UTC 2011