template<typename _MatrixType, unsigned int _Mode>
TriangularViewImpl<_MatrixType, _Mode, Dense> class
Base class for a triangular part in a dense matrix.
Contents
- Reference
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.
Base classes
-
template<typename Derived>class TriangularBase
- Base class for triangular part in a matrix.
Public functions
- auto coeff(Index row, Index col) const -> Scalar
- auto coeffRef(Index row, Index col) -> Scalar&
-
template<typename DenseDerived>void evalToLazy(MatrixBase<DenseDerived>& other) const
- void fill(const Scalar& value)
- auto innerStride() const -> Index
-
template<typename OtherDerived>auto operator*(const MatrixBase<OtherDerived>& rhs) const -> const Product<TriangularViewType, OtherDerived>
- auto operator*=(const typename internal::traits<MatrixType>::Scalar& other) -> TriangularViewType&
-
template<typename Other>auto operator+=(const DenseBase<Other>& other) -> TriangularViewType&
-
template<typename Other>auto operator-=(const DenseBase<Other>& other) -> TriangularViewType&
- auto operator/=(const typename internal::traits<MatrixType>::Scalar& other) -> TriangularViewType&
-
template<typename OtherDerived>auto operator=(const TriangularBase<OtherDerived>& other) -> TriangularViewType&
-
template<typename OtherDerived>auto operator=(const MatrixBase<OtherDerived>& other) -> TriangularViewType&
- auto outerStride() const -> Index
- auto setConstant(const Scalar& value) -> TriangularViewType&
- auto setOnes() -> TriangularViewType&
- auto setZero() -> TriangularViewType&
-
template<int Side, typename Other>auto solve(const MatrixBase<Other>& other) const -> const internal::triangular_solve_retval<Side, TriangularViewType, Other>
-
template<int Side, typename OtherDerived>void solveInPlace(const MatrixBase<OtherDerived>& other) const
-
template<typename OtherDerived>void swap(TriangularBase<OtherDerived>& other)
-
template<typename OtherDerived>void swap(MatrixBase<OtherDerived> const& other) deprecated
Friends
-
template<typename OtherDerived>auto operator*(const MatrixBase<OtherDerived>& lhs, const TriangularViewImpl& rhs) -> const Product<OtherDerived, TriangularViewType>
Function documentation
template<typename _MatrixType, unsigned int _Mode>
template<typename DenseDerived>
void Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: 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.
template<typename _MatrixType, unsigned int _Mode>
void Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: fill(const Scalar& value)
template<typename _MatrixType, unsigned int _Mode>
Index Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: innerStride() const
Returns | the inner-stride of the underlying dense matrix |
---|
template<typename _MatrixType, unsigned int _Mode>
template<typename OtherDerived>
const Product<TriangularViewType, OtherDerived> Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: operator*(const MatrixBase<OtherDerived>& rhs) const
Efficient triangular matrix times vector/matrix product
template<typename _MatrixType, unsigned int _Mode>
TriangularViewType& Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: operator*=(const typename internal::traits<MatrixType>::Scalar& other)
template<typename _MatrixType, unsigned int _Mode>
template<typename Other>
TriangularViewType& Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: operator+=(const DenseBase<Other>& other)
template<typename _MatrixType, unsigned int _Mode>
template<typename Other>
TriangularViewType& Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: operator-=(const DenseBase<Other>& other)
template<typename _MatrixType, unsigned int _Mode>
TriangularViewType& Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: operator/=(const typename internal::traits<MatrixType>::Scalar& other)
template<typename _MatrixType, unsigned int _Mode>
template<typename OtherDerived>
TriangularViewType& Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: operator=(const TriangularBase<OtherDerived>& other)
Assigns a triangular matrix to a triangular part of a dense matrix
template<typename _MatrixType, unsigned int _Mode>
template<typename OtherDerived>
TriangularViewType& Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: operator=(const MatrixBase<OtherDerived>& other)
Shortcut for *this = other.other.triangularView<(*this)::Mode>()
template<typename _MatrixType, unsigned int _Mode>
Index Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: outerStride() const
Returns | the outer-stride of the underlying dense matrix |
---|
template<typename _MatrixType, unsigned int _Mode>
TriangularViewType& Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: setConstant(const Scalar& value)
template<typename _MatrixType, unsigned int _Mode>
TriangularViewType& Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: setOnes()
template<typename _MatrixType, unsigned int _Mode>
TriangularViewType& Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: setZero()
template<typename _MatrixType, unsigned int _Mode>
template<int Side, typename Other>
const internal::triangular_solve_retval<Side, TriangularViewType, Other> Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: 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.
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);
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.
template<typename _MatrixType, unsigned int _Mode>
template<int Side, typename OtherDerived>
void Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: solveInPlace(const MatrixBase<OtherDerived>& other) const
"in-place" version of TriangularView::solve() where the result is written in other
Note that the template parameter Side
can be omitted, in which case Side==OnTheLeft
See TriangularView:solve() for the details.
template<typename _MatrixType, unsigned int _Mode>
template<typename OtherDerived>
void Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: swap(TriangularBase<OtherDerived>& other)
Swaps the coefficients of the common triangular parts of two matrices
template<typename _MatrixType, unsigned int _Mode>
template<typename OtherDerived>
void Eigen:: TriangularViewImpl<_MatrixType, _Mode, Dense><_MatrixType, _Mode>:: swap(MatrixBase<OtherDerived> const& other)
(*this).swap(other.triangularView<(*this)::Mode>())
template<typename _MatrixType, unsigned int _Mode>
template<typename OtherDerived>
const Product<OtherDerived, TriangularViewType> operator*(const MatrixBase<OtherDerived>& lhs,
const TriangularViewImpl& rhs)
Efficient vector/matrix times triangular matrix product