Eigen  5.0.1
 
Loading...
Searching...
No Matches
Eigen::TriangularViewImpl< MatrixType_, Mode_, Dense > Class Template Reference

#include <Eigen/src/Core/TriangularMatrix.h>

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 are available for dense expressions only.

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

Public Member Functions

void evalToLazy (MatrixBase< DenseDerived > &other) const
 
void inverseInPlace ()
 
const Product< TriangularViewType, Inverse< OtherDerived > > operator* (const InverseImpl< OtherDerived, PermutationStorage > &rhs) const
 
const Product< TriangularViewType, OtherDerived > operator* (const PermutationBase< OtherDerived > &rhs) const
 
const Product< TriangularViewType, OtherDerived > operator* (const TriangularBase< OtherDerived > &rhs) const
 
TriangularViewType & operator*= (const typename internal::traits< MatrixType >::Scalar &other)
 
template<typename Other>
TriangularViewType & operator+= (const DenseBase< Other > &other)
 
template<typename Other>
TriangularViewType & operator-= (const DenseBase< Other > &other)
 
TriangularViewType & operator/= (const typename internal::traits< MatrixType >::Scalar &other)
 
template<typename OtherDerived>
TriangularViewType & operator= (const MatrixBase< OtherDerived > &other)
 
template<typename OtherDerived>
TriangularViewType & operator= (const TriangularBase< OtherDerived > &other)
 
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_ > >
const AdjointReturnType adjoint () const
 
Scalar coeff (Index row, Index col) const
 
Scalar & coeffRef (Index row, Index col)
 
const ConjugateReturnType conjugate () const
 
std::conditional_t< Cond, ConjugateReturnType, ConstView > conjugateIf () const
 
void copyCoeff (Index row, Index col, Other &other)
 
void evalTo (MatrixBase< DenseDerived > &other) const
 
void evalToLazy (MatrixBase< DenseDerived > &other) const
 
void fill (const Scalar &value)
 
Scalar & operator() (Index row, Index col)
 
Scalar operator() (Index row, Index col) const
 
const Product< TriangularView< MatrixType_, Mode_ >, Inverse< OtherDerived > > operator* (const InverseImpl< OtherDerived, PermutationStorage > &rhs) const
 
const Product< TriangularView< MatrixType_, Mode_ >, OtherDerived > operator* (const PermutationBase< OtherDerived > &rhs) const
 
const Product< TriangularView< MatrixType_, Mode_ >, OtherDerived > operator* (const TriangularBase< OtherDerived > &rhs) const
 
auto operator+ (const DiagonalBase< OtherDerived > &other) const
 
auto operator- (const DiagonalBase< OtherDerived > &other) const
 
TriangularView< MatrixType_, Mode_ > & setConstant (const Scalar &value)
 
TriangularView< MatrixType_, Mode_ > & setIdentity ()
 
TriangularView< MatrixType_, Mode_ > & setOnes ()
 
TriangularView< MatrixType_, Mode_ > & setRandom ()
 
TriangularView< MatrixType_, Mode_ > & setZero ()
 
TransposeReturnType transpose ()
 
const ConstTransposeReturnType transpose () const
 
- Public Member Functions inherited from Eigen::EigenBase< TriangularView< MatrixType_, Mode_ > >
constexpr Index cols () const noexcept
 
constexpr TriangularView< MatrixType_, Mode_ > & derived ()
 
constexpr const TriangularView< MatrixType_, Mode_ > & derived () const
 
constexpr Index rows () const noexcept
 
constexpr Index size () const noexcept
 

Additional Inherited Members

- Public Types inherited from Eigen::TriangularBase< TriangularView< MatrixType_, Mode_ > >
- Public Types inherited from Eigen::EigenBase< TriangularView< MatrixType_, Mode_ > >
using Index
 The interface type of indices.
 

Member Function Documentation

◆ evalToLazy()

template<typename MatrixType_, unsigned int Mode_>
void Eigen::TriangularBase< TriangularViewType >::evalToLazy ( MatrixBase< DenseDerived > & other) const

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

◆ inverseInPlace()

template<typename MatrixType_, unsigned int Mode_>
void Eigen::TriangularViewImpl< MatrixType_, Mode_, Dense >::inverseInPlace ( )

Replaces the referenced triangular part by its inverse.

*this must be square and invertible; as with solveInPlace(), no check is made and a zero on the diagonal yields a non-finite result. The opposite triangle is neither read nor written, and with a UnitDiag mode the diagonal itself is left alone as well.

This is the operation of the *TRTRI LAPACK routines. It costs n^3/3 flops, where solving against an explicit identity right hand side costs n^3, and its only scratch is one block-sized panel of at most 128x128 coefficients, independent of the matrix size.

See also
TriangularView::solveInPlace(), MatrixBase::inverse()

◆ operator*() [1/3]

template<typename MatrixType_, unsigned int Mode_>
const Product< TriangularViewType, Inverse< OtherDerived > > Eigen::TriangularBase< TriangularViewType >::operator* ( const InverseImpl< OtherDerived, PermutationStorage > & rhs) const
inline
Returns
the dense matrix expression of *this with the inverse permutation rhs applied to its columns.

◆ operator*() [2/3]

template<typename MatrixType_, unsigned int Mode_>
const Product< TriangularViewType, OtherDerived > Eigen::TriangularBase< TriangularViewType >::operator* ( const PermutationBase< OtherDerived > & rhs) const
inline
Returns
the dense matrix expression of *this with the permutation rhs applied to its columns.

◆ operator*() [3/3]

template<typename MatrixType_, unsigned int Mode_>
const Product< TriangularViewType, OtherDerived > Eigen::TriangularBase< TriangularViewType >::operator* ( const TriangularBase< OtherDerived > & rhs) const
inline
Returns
the dense matrix product of *this by the triangular or self-adjoint view rhs.

The right factor is evaluated into a dense temporary and the product runs the kernel of *this times a dense matrix. The result is a plain dense expression even when the structure would be preserved, as for two upper triangular factors.

◆ 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
See also
MatrixBase::operator+=()

◆ operator-=()

template<typename MatrixType_, unsigned int Mode_>
template<typename Other>
TriangularViewType & Eigen::TriangularViewImpl< MatrixType_, Mode_, Dense >::operator-= ( const DenseBase< Other > & other)
inline
See also
MatrixBase::operator-=()

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

◆ 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 a lower (resp. upper) triangular matrix.

Example:

// SPDX-FileCopyrightText: The Eigen Authors
// SPDX-License-Identifier: MPL-2.0
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);
TriangularView< MatrixType_, Mode_ > & setOnes()
Definition TriangularMatrix.h:132
const internal::triangular_solve_retval< Side, TriangularViewType, Other > solve(const MatrixBase< Other > &other) const
@ Lower
Definition Constants.h:212
@ Upper
Definition Constants.h:214
Matrix< double, 3, 3 > Matrix3d
3×3 matrix of type double.
Definition Matrix.h:489

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>())

◆ 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 files: