Eigen  3.4.0 (git rev e3e74001f7c4bf95f0dde572e8a08c5b2918a3ab)
Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense > Class Template Reference

Detailed Description

template<typename _MatrixType, unsigned int _Mode>
class Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >

Base class for a triangular part in a dense matrix.

This class is an abstract base class of class TriangularView, and objects of type TriangularViewImpl cannot be instantiated. It extends class TriangularView with additional methods which available for dense expressions only.

See also
class TriangularView, MatrixBase::triangularView()
+ Inheritance diagram for Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >:

Public Member Functions

Scalar coeff (Index row, Index col) const
 
Scalar & coeffRef (Index row, Index col)
 
template<typename DenseDerived >
void evalToLazy (MatrixBase< DenseDerived > &other) const
 
void fill (const Scalar &value)
 
Index innerStride () const
 
template<typename OtherDerived >
const Product< TriangularViewType, OtherDerived > operator* (const MatrixBase< OtherDerived > &rhs) const
 
TriangularViewTypeoperator*= (const typename internal::traits< MatrixType >::Scalar &other)
 
template<typename Other >
TriangularViewTypeoperator+= (const DenseBase< Other > &other)
 
template<typename Other >
TriangularViewTypeoperator-= (const DenseBase< Other > &other)
 
TriangularViewTypeoperator/= (const typename internal::traits< MatrixType >::Scalar &other)
 
template<typename OtherDerived >
TriangularViewTypeoperator= (const MatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
TriangularViewTypeoperator= (const TriangularBase< OtherDerived > &other)
 
Index outerStride () const
 
TriangularViewTypesetConstant (const Scalar &value)
 
TriangularViewTypesetOnes ()
 
TriangularViewTypesetZero ()
 
template<int Side, typename Other >
const internal::triangular_solve_retval< Side, TriangularViewType, Other > solve (const MatrixBase< Other > &other) const
 
template<int Side, typename OtherDerived >
void solveInPlace (const MatrixBase< OtherDerived > &other) const
 
template<typename OtherDerived >
EIGEN_DEPRECATED void swap (MatrixBase< OtherDerived > const &other)
 
template<typename OtherDerived >
void swap (TriangularBase< OtherDerived > &other)
 
- Public Member Functions inherited from Eigen::TriangularBase< TriangularView< _MatrixType, _Mode > >
void copyCoeff (Index row, Index col, Other &other)
 
void evalTo (MatrixBase< DenseDerived > &other) const
 
void evalToLazy (MatrixBase< DenseDerived > &other) const
 
- Public Member Functions inherited from Eigen::EigenBase< Derived >
EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
Derived & derived ()
 
const Derived & derived () const
 
EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 
EIGEN_CONSTEXPR Index size () const EIGEN_NOEXCEPT
 

Additional Inherited Members

- Public Types inherited from Eigen::EigenBase< Derived >
typedef Eigen::Index Index
 The interface type of indices. More...
 

Member Function Documentation

◆ coeff()

template<typename _MatrixType , unsigned int _Mode>
Scalar Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::coeff ( Index  row,
Index  col 
) const
inline
See also
MatrixBase::coeff()
Warning
the coordinates must fit into the referenced triangular part

◆ coeffRef()

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

◆ evalToLazy()

template<typename _MatrixType , unsigned int _Mode>
template<typename DenseDerived >
void Eigen::TriangularBase< Derived >::evalToLazy ( typename DenseDerived  )

Assigns a triangular or selfadjoint matrix to a dense matrix. If the matrix is triangular, the opposite part is set to zero.

◆ fill()

template<typename _MatrixType , unsigned int _Mode>
void Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::fill ( const Scalar &  value)
inline

◆ innerStride()

template<typename _MatrixType , unsigned int _Mode>
Index Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::innerStride ( ) const
inline
Returns
the inner-stride of the underlying dense matrix
See also
DenseCoeffsBase::innerStride()

◆ operator*()

template<typename _MatrixType , unsigned int _Mode>
template<typename OtherDerived >
const Product<TriangularViewType,OtherDerived> Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::operator* ( const MatrixBase< OtherDerived > &  rhs) const
inline

Efficient triangular matrix times vector/matrix product

◆ operator*=()

template<typename _MatrixType , unsigned int _Mode>
TriangularViewType& Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::operator*= ( const typename internal::traits< MatrixType >::Scalar &  other)
inline

◆ operator+=()

template<typename _MatrixType , unsigned int _Mode>
template<typename Other >
TriangularViewType& Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::operator+= ( const DenseBase< Other > &  other)
inline

◆ operator-=()

template<typename _MatrixType , unsigned int _Mode>
template<typename Other >
TriangularViewType& Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::operator-= ( const DenseBase< Other > &  other)
inline

◆ operator/=()

template<typename _MatrixType , unsigned int _Mode>
TriangularViewType& Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::operator/= ( const typename internal::traits< MatrixType >::Scalar &  other)
inline
See also
DenseBase::operator/=()

◆ operator=() [1/2]

template<typename _MatrixType , unsigned int _Mode>
template<typename OtherDerived >
TriangularViewType& Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::operator= ( const MatrixBase< OtherDerived > &  other)

Shortcut for

*this = other.other.triangularView<(*this)::Mode>()

◆ operator=() [2/2]

template<typename _MatrixType , unsigned int _Mode>
template<typename OtherDerived >
TriangularViewType& Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::operator= ( const TriangularBase< OtherDerived > &  other)

Assigns a triangular matrix to a triangular part of a dense matrix

◆ outerStride()

template<typename _MatrixType , unsigned int _Mode>
Index Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::outerStride ( ) const
inline
Returns
the outer-stride of the underlying dense matrix
See also
DenseCoeffsBase::outerStride()

◆ setConstant()

template<typename _MatrixType , unsigned int _Mode>
TriangularViewType& Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::setConstant ( const Scalar &  value)
inline

◆ setOnes()

template<typename _MatrixType , unsigned int _Mode>
TriangularViewType& Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::setOnes ( )
inline

◆ setZero()

template<typename _MatrixType , unsigned int _Mode>
TriangularViewType& Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::setZero ( )
inline

◆ solve()

template<typename _MatrixType , unsigned int _Mode>
template<int Side, typename Other >
const internal::triangular_solve_retval<Side,TriangularViewType, Other> Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::solve ( const MatrixBase< Other > &  other) const
inline
Returns
the product of the inverse of *this with other, *this being triangular.

This function computes the inverse-matrix matrix product inverse(*this) * other if Side==OnTheLeft (the default), or the right-inverse-multiply other * inverse(*this) if Side==OnTheRight.

Note that the template parameter Side can be omitted, in which case Side==OnTheLeft

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.

Example:

Matrix3d m = Matrix3d::Zero();
m.triangularView<Eigen::Upper>().setOnes();
cout << "Here is the matrix m:\n" << m << endl;
Matrix3d n = Matrix3d::Ones();
n.triangularView<Eigen::Lower>() *= 2;
cout << "Here is the matrix n:\n" << n << endl;
cout << "And now here is m.inverse()*n, taking advantage of the fact that"
" m is upper-triangular:\n"
<< m.triangularView<Eigen::Upper>().solve(n) << endl;
cout << "And this is n*m.inverse():\n"
<< m.triangularView<Eigen::Upper>().solve<Eigen::OnTheRight>(n);
static const ConstantReturnType Ones()
Definition: CwiseNullaryOp.h:670
static const ConstantReturnType Zero()
Definition: CwiseNullaryOp.h:514
TriangularViewType & setOnes()
Definition: TriangularMatrix.h:412
const internal::triangular_solve_retval< Side, TriangularViewType, Other > solve(const MatrixBase< Other > &other) const
@ Lower
Definition: Constants.h:209
@ Upper
Definition: Constants.h:211

Output:

Here is the matrix m:
1 1 1
0 1 1
0 0 1
Here is the matrix n:
2 1 1
2 2 1
2 2 2
And now here is m.inverse()*n, taking advantage of the fact that m is upper-triangular:
 0 -1  0
 0  0 -1
 2  2  2
And this is n*m.inverse():
 2 -1  0
 2  0 -1
 2  0  0

This function returns an expression of the inverse-multiply and can works in-place if it is assigned to the same matrix or vector other.

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

See also
TriangularView::solveInPlace()

◆ solveInPlace()

template<typename _MatrixType , unsigned int _Mode>
template<int Side, typename OtherDerived >
void Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::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.

Note that the template parameter Side can be omitted, in which case Side==OnTheLeft

See TriangularView:solve() for the details.

◆ swap() [1/2]

template<typename _MatrixType , unsigned int _Mode>
template<typename OtherDerived >
EIGEN_DEPRECATED void Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::swap ( MatrixBase< OtherDerived > const &  other)
inline

Shortcut for

(*this).swap(other.triangularView<(*this)::Mode>())
Deprecated:

◆ swap() [2/2]

template<typename _MatrixType , unsigned int _Mode>
template<typename OtherDerived >
void Eigen::TriangularViewImpl< _MatrixType, _Mode, Dense >::swap ( TriangularBase< OtherDerived > &  other)
inline

Swaps the coefficients of the common triangular parts of two matrices


The documentation for this class was generated from the following file: