TriangularView< _MatrixType, _Mode > Class Template Reference

Base class for triangular part in a matrix. More...

#include <TriangularMatrix.h>

Public Member Functions

const TriangularView< const typename MatrixType::AdjointReturnType, TransposeMode > adjoint () const
 
Scalar coeff (Index row, Index col) const
 
Scalar & coeffRef (Index row, Index col)
 
TriangularView< MatrixConjugateReturnType, Mode > conjugate ()
 
const TriangularView< MatrixConjugateReturnType, Mode > conjugate () const
 
template<typename Other>
void copyCoeff (Index row, Index col, Other &other)
 
Derived & derived ()
 
const Derived & derived () const
 
template<typename DenseDerived>
void evalTo (MatrixBase< DenseDerived > &other) const
 
template<typename DenseDerived>
void evalToLazy (MatrixBase< DenseDerived > &other) const
 
void fill (const Scalar &value)
 
template<typename OtherDerived>
TriangularProduct< Mode, true, MatrixType, false, OtherDerived, OtherDerived::IsVectorAtCompileTime > operator* (const MatrixBase< OtherDerived > &rhs) const
 
TriangularViewoperator*= (const typename internal::traits< MatrixType >::Scalar &other)
 
template<typename Other>
TriangularViewoperator+= (const DenseBase< Other > &other)
 
template<typename Other>
TriangularViewoperator-= (const DenseBase< Other > &other)
 
TriangularViewoperator/= (const typename internal::traits< MatrixType >::Scalar &other)
 
template<typename OtherDerived>
TriangularViewoperator= (const TriangularBase< OtherDerived > &other)
 
TriangularViewsetConstant (const Scalar &value)
 
TriangularViewsetOnes ()
 
TriangularViewsetZero ()
 
Index size () const
 
template<int Side, typename Other>
const internal::triangular_solve_retval< Side, TriangularView< Derived, Mode >, Other > solve (const MatrixBase< Other > &other) const
 
template<int Side, typename OtherDerived>
void solveInPlace (const MatrixBase< OtherDerived > &other) const
 
TriangularView< Transpose< MatrixType >, TransposeMode > transpose ()
 
const TriangularView< Transpose< MatrixType >, TransposeMode > transpose () const
 

Detailed Description

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

Base class for triangular part in a matrix.

Parameters
MatrixTypethe type of the object in which we are taking the triangular part
Modethe kind of triangular matrix expression to construct. Can be Upper, Lower, UnitUpper, UnitLower, StrictlyUpper, or StrictlyLower. This is in fact a bit field; it must have either Upper or Lower, and additionnaly it may have UnitDiag or ZeroDiag or neither.

This class represents a triangular part of a matrix, not necessarily square. Strictly speaking, for rectangular matrices one should speak of "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()

Member Function Documentation

◆ adjoint()

template<typename _MatrixType, unsigned int _Mode>
const TriangularView< const typename MatrixType::AdjointReturnType, TransposeMode > adjoint ( ) const
inline

◆ coeff()

template<typename _MatrixType, unsigned int _Mode>
Scalar 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 & coeffRef ( Index row,
Index col )
inline
See also
MatrixBase::coeffRef()
Warning
the coordinates must fit into the referenced triangular part

◆ conjugate() [1/2]

template<typename _MatrixType, unsigned int _Mode>
TriangularView< MatrixConjugateReturnType, Mode > conjugate ( )
inline

◆ conjugate() [2/2]

template<typename _MatrixType, unsigned int _Mode>
const TriangularView< MatrixConjugateReturnType, Mode > conjugate ( ) const
inline

◆ copyCoeff()

template<typename Derived>
template<typename Other>
void copyCoeff ( Index row,
Index col,
Other & other )
inlineinherited
See also
MatrixBase::copyCoeff(row,col)

◆ derived() [1/2]

template<typename Derived>
Derived & derived ( )
inlineinherited
Returns
a reference to the derived object

Referenced by MatrixBase< Derived >::applyOnTheLeft(), MatrixBase< Derived >::applyOnTheRight(), PermutationBase< PermutationMatrix >::applyTranspositionOnTheLeft(), PermutationBase< PermutationMatrix >::applyTranspositionOnTheRight(), SparseMatrixBase< SparseDenseOuterProduct >::binaryExpr(), cols(), SparseMatrixBase< SparseDenseOuterProduct >::imag(), PermutationBase< PermutationMatrix >::indices(), PermutationBase< PermutationMatrix >::indices(), SparseMatrixBase< Derived >::innerVector(), SparseMatrixBase< Derived >::innerVector(), SparseMatrixBase< SparseDenseOuterProduct >::innerVector(), SparseMatrixBase< Derived >::innerVectors(), SparseMatrixBase< Derived >::innerVectors(), PermutationBase< PermutationMatrix >::inverse(), PermutationBase< PermutationMatrix >::operator*(), RotationBase< AngleAxis< _Scalar >, 3 >::operator*(), RotationBase< AngleAxis< _Scalar >, 3 >::operator*, SparseMatrixBase< Derived >::operator*(), SparseMatrixBase< Derived >::operator*(), SparseMatrixBase< SparseDenseOuterProduct >::operator*, Transform< Scalar, Dim, Mode, Options >::operator*, Transform< Scalar, Dim, Mode, Options >::operator*(), Translation< _Scalar, _Dim >::operator*(), Translation< Scalar, Dim >::operator*, MatrixBase< Derived >::operator*=(), DenseBase< Derived >::operator=(), PermutationBase< PermutationMatrix >::operator=(), PermutationBase< PermutationMatrix >::operator=(), PlainObjectBase< Array >::operator=(), Transform< Scalar, Dim, Mode, Options >::operator=(), PlainObjectBase< Array >::PlainObjectBase(), PlainObjectBase< Array >::resizeLike(), rows(), CholmodBase< _MatrixType, _UpLo, CholmodSimplicialLLT >::solve(), IterativeSolverBase< BiCGSTAB >::solve(), SimplicialCholeskyBase< SimplicialLLT >::solve(), SparseMatrix< Scalar, RowMajor >::SparseMatrix(), SparseMatrix< Scalar, RowMajor >::SparseMatrix(), PermutationBase< PermutationMatrix >::toDenseMatrix(), Transform< Scalar, Dim, Mode, Options >::Transform(), PermutationBase< PermutationMatrix >::transpose(), and SparseMatrixBase< SparseDenseOuterProduct >::unaryExpr().

◆ derived() [2/2]

template<typename Derived>
const Derived & derived ( ) const
inlineinherited
Returns
a const reference to the derived object

◆ evalTo()

template<typename Derived>
template<typename DenseDerived>
void evalTo ( MatrixBase< DenseDerived > & other) const
inherited

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

◆ evalToLazy()

template<typename Derived>
template<typename DenseDerived>
void evalToLazy ( MatrixBase< DenseDerived > & other) const
inherited

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 fill ( const Scalar & value)
inline

◆ operator*()

template<typename _MatrixType, unsigned int _Mode>
template<typename OtherDerived>
TriangularProduct< Mode, true, MatrixType, false, OtherDerived, OtherDerived::IsVectorAtCompileTime > operator* ( const MatrixBase< OtherDerived > & rhs) const
inline

Efficient triangular matrix times vector/matrix product

◆ operator*=()

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

◆ operator+=()

template<typename _MatrixType, unsigned int _Mode>
template<typename Other>
TriangularView & operator+= ( const DenseBase< Other > & other)
inline

◆ operator-=()

template<typename _MatrixType, unsigned int _Mode>
template<typename Other>
TriangularView & operator-= ( const DenseBase< Other > & other)
inline

◆ operator/=()

template<typename _MatrixType, unsigned int _Mode>
TriangularView & operator/= ( const typename internal::traits< MatrixType >::Scalar & other)
inline
See also
MatrixBase::operator/=()

◆ operator=()

template<typename _MatrixType, unsigned int _Mode>
template<typename OtherDerived>
TriangularView & operator= ( const TriangularBase< OtherDerived > & other)

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

◆ setConstant()

template<typename _MatrixType, unsigned int _Mode>
TriangularView & setConstant ( const Scalar & value)
inline

◆ setOnes()

template<typename _MatrixType, unsigned int _Mode>
TriangularView & setOnes ( )
inline

◆ setZero()

template<typename _MatrixType, unsigned int _Mode>
TriangularView & setZero ( )
inline

◆ size()

template<typename Derived>
Index size ( ) const
inlineinherited
Returns
the number of coefficients, which is rows()*cols().
See also
rows(), cols(), SizeAtCompileTime.

References cols(), and rows().

Referenced by SparseMatrixBase< Derived >::middleCols(), SparseMatrixBase< Derived >::middleCols(), SparseMatrixBase< Derived >::middleRows(), and SparseMatrixBase< Derived >::middleRows().

◆ solve()

template<typename _MatrixType, unsigned int _Mode>
template<int Side, typename Other>
const internal::triangular_solve_retval< Side, TriangularView< Derived, Mode >, Other > solve ( const MatrixBase< Other > & other) 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 if Side==OnTheLeft (the default), or the right-inverse-multiply other * inverse(*this) if Side==OnTheRight.

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:

#ifndef _MSC_VER
#warning deprecated
#endif
/*
Matrix3d m = Matrix3d::Zero();
m.part<Eigen::UpperTriangular>().setOnes();
cout << "Here is the matrix m:" << endl << m << endl;
Matrix3d n = Matrix3d::Ones();
n.part<Eigen::LowerTriangular>() *= 2;
cout << "Here is the matrix n:" << endl << n << endl;
cout << "And now here is m.inverse()*n, taking advantage of the fact that"
" m is upper-triangular:" << endl
<< m.marked<Eigen::UpperTriangular>().solveTriangular(n);
*/

Output:

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 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.

References Eigen::Lower, Eigen::OnTheLeft, Eigen::OnTheRight, Eigen::RowMajorBit, Eigen::Upper, and Eigen::ZeroDiag.

◆ transpose() [1/2]

template<typename _MatrixType, unsigned int _Mode>
TriangularView< Transpose< MatrixType >, TransposeMode > transpose ( )
inline

◆ transpose() [2/2]

template<typename _MatrixType, unsigned int _Mode>
const TriangularView< Transpose< MatrixType >, TransposeMode > transpose ( ) const
inline

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