Eigen::DiagonalBase< Derived > Class Template Reference

Base class for diagonal matrices and expressions. More...

+ Inheritance diagram for Eigen::DiagonalBase< Derived >:

Public Types

enum  {
  RowsAtCompileTime ,
  ColsAtCompileTime ,
  MaxRowsAtCompileTime ,
  MaxColsAtCompileTime ,
  IsVectorAtCompileTime ,
  Flags
}
 
typedef Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTime, 0, MaxRowsAtCompileTime, MaxColsAtCompileTimeDenseMatrixType
 
typedef DenseMatrixType DenseType
 
template<typename OtherDerived >
using DiagonalDifferenceReturnType = DiagonalWrapper< const CwiseBinaryOp< internal::scalar_difference_op< DiagonalVectorType ::Scalar, typename OtherDerived::DiagonalVectorType ::Scalar >, const DiagonalVectorType, const typename OtherDerived::DiagonalVectorType > >
 
using DiagonalInverseReturnType = DiagonalWrapper< const CwiseUnaryOp< internal::scalar_inverse_op< Scalar >, const DiagonalVectorType > >
 
template<typename OtherDerived >
using DiagonalProductReturnType = DiagonalWrapper< const CwiseBinaryOp< internal::scalar_product_op< DiagonalVectorType ::Scalar, typename OtherDerived::DiagonalVectorType ::Scalar >, const DiagonalVectorType, const typename OtherDerived::DiagonalVectorType > >
 
using DiagonalScaleReturnType = DiagonalWrapper< const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DiagonalVectorType, Scalar, product)>
 
template<typename OtherDerived >
using DiagonalSumReturnType = DiagonalWrapper< const CwiseBinaryOp< internal::scalar_sum_op< DiagonalVectorType ::Scalar, typename OtherDerived::DiagonalVectorType ::Scalar >, const DiagonalVectorType, const typename OtherDerived::DiagonalVectorType > >
 
typedef internal::traits< Derived >::DiagonalVectorType DiagonalVectorType
 
typedef DiagonalMatrix< Scalar, DiagonalVectorType::SizeAtCompileTime, DiagonalVectorType::MaxSizeAtCompileTime > PlainObject
 
typedef DiagonalVectorType::RealScalar RealScalar
 
typedef DiagonalVectorType::Scalar Scalar
 
using ScaleDiagonalReturnType = DiagonalWrapper< const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar, DiagonalVectorType, product)>
 
typedef internal::traits< Derived >::StorageIndex StorageIndex
 
typedef internal::traits< Derived >::StorageKind StorageKind
 
- Public Types inherited from Eigen::EigenBase< Derived >
typedef Eigen::Index Index
 The interface type of indices. More...
 
typedef internal::traits< Derived >::StorageKind StorageKind
 

Public Member Functions

Scalar coeff (Index row, Index col) const
 
EIGEN_CONSTEXPR Index cols () const
 
Derived & derived ()
 
const Derived & derived () const
 
DiagonalVectorTypediagonal ()
 
const DiagonalVectorTypediagonal () const
 
const DiagonalInverseReturnType inverse () const
 
template<typename OtherDerived >
const DiagonalProductReturnType< OtherDerived > operator* (const DiagonalBase< OtherDerived > &other) const
 
template<typename MatrixDerived >
const Product< Derived, MatrixDerived, LazyProductoperator* (const MatrixBase< MatrixDerived > &matrix) const
 
const DiagonalScaleReturnType operator* (const Scalar &scalar) const
 
template<typename OtherDerived >
const DiagonalSumReturnType< OtherDerived > operator+ (const DiagonalBase< OtherDerived > &other) const
 
template<typename OtherDerived >
const DiagonalDifferenceReturnType< OtherDerived > operator- (const DiagonalBase< OtherDerived > &other) const
 
EIGEN_CONSTEXPR Index rows () const
 
DenseMatrixType toDenseMatrix () const
 
- Public Member Functions inherited from Eigen::EigenBase< Derived >
template<typename Dest >
void addTo (Dest &dst) const
 
template<typename Dest >
void applyThisOnTheLeft (Dest &dst) const
 
template<typename Dest >
void applyThisOnTheRight (Dest &dst) const
 
EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
Derived & const_cast_derived () const
 
const Derived & const_derived () const
 
Derived & derived ()
 
const Derived & derived () const
 
template<typename Dest >
void evalTo (Dest &dst) const
 
EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 
EIGEN_CONSTEXPR Index size () const EIGEN_NOEXCEPT
 
template<typename Dest >
void subTo (Dest &dst) const
 

Detailed Description

template<typename Derived>
class Eigen::DiagonalBase< Derived >

Base class for diagonal matrices and expressions.

This is the base class that is inherited by diagonal matrix and related expression types, which internally use a vector for storing the diagonal entries. Diagonal types always represent square matrices.

Template Parameters
Derivedis the derived type, a DiagonalMatrix or DiagonalWrapper.
See also
class DiagonalMatrix, class DiagonalWrapper

Definition at line 32 of file DiagonalMatrix.h.

Member Typedef Documentation

◆ DenseMatrixType

Definition at line 50 of file DiagonalMatrix.h.

◆ DenseType

template<typename Derived >
typedef DenseMatrixType Eigen::DiagonalBase< Derived >::DenseType

Definition at line 51 of file DiagonalMatrix.h.

◆ DiagonalDifferenceReturnType

template<typename Derived >
template<typename OtherDerived >
using Eigen::DiagonalBase< Derived >::DiagonalDifferenceReturnType = DiagonalWrapper<const CwiseBinaryOp< internal::scalar_difference_op < DiagonalVectorType ::Scalar, typename OtherDerived::DiagonalVectorType ::Scalar>, const DiagonalVectorType , const typename OtherDerived::DiagonalVectorType > >

Definition at line 146 of file DiagonalMatrix.h.

◆ DiagonalInverseReturnType

template<typename Derived >
using Eigen::DiagonalBase< Derived >::DiagonalInverseReturnType = DiagonalWrapper<const CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const DiagonalVectorType> >

Definition at line 109 of file DiagonalMatrix.h.

◆ DiagonalProductReturnType

template<typename Derived >
template<typename OtherDerived >
using Eigen::DiagonalBase< Derived >::DiagonalProductReturnType = DiagonalWrapper<const CwiseBinaryOp< internal::scalar_product_op < DiagonalVectorType ::Scalar, typename OtherDerived::DiagonalVectorType ::Scalar>, const DiagonalVectorType , const typename OtherDerived::DiagonalVectorType > >

Definition at line 99 of file DiagonalMatrix.h.

◆ DiagonalScaleReturnType

Definition at line 116 of file DiagonalMatrix.h.

◆ DiagonalSumReturnType

template<typename Derived >
template<typename OtherDerived >
using Eigen::DiagonalBase< Derived >::DiagonalSumReturnType = DiagonalWrapper<const CwiseBinaryOp< internal::scalar_sum_op < DiagonalVectorType ::Scalar, typename OtherDerived::DiagonalVectorType ::Scalar>, const DiagonalVectorType , const typename OtherDerived::DiagonalVectorType > >

Definition at line 135 of file DiagonalMatrix.h.

◆ DiagonalVectorType

template<typename Derived >
typedef internal::traits<Derived>::DiagonalVectorType Eigen::DiagonalBase< Derived >::DiagonalVectorType

Definition at line 35 of file DiagonalMatrix.h.

◆ PlainObject

template<typename Derived >
typedef DiagonalMatrix<Scalar,DiagonalVectorType::SizeAtCompileTime,DiagonalVectorType::MaxSizeAtCompileTime> Eigen::DiagonalBase< Derived >::PlainObject

Definition at line 52 of file DiagonalMatrix.h.

◆ RealScalar

template<typename Derived >
typedef DiagonalVectorType::RealScalar Eigen::DiagonalBase< Derived >::RealScalar

Definition at line 37 of file DiagonalMatrix.h.

◆ Scalar

template<typename Derived >
typedef DiagonalVectorType::Scalar Eigen::DiagonalBase< Derived >::Scalar

Definition at line 36 of file DiagonalMatrix.h.

◆ ScaleDiagonalReturnType

Definition at line 125 of file DiagonalMatrix.h.

◆ StorageIndex

template<typename Derived >
typedef internal::traits<Derived>::StorageIndex Eigen::DiagonalBase< Derived >::StorageIndex

Definition at line 39 of file DiagonalMatrix.h.

◆ StorageKind

template<typename Derived >
typedef internal::traits<Derived>::StorageKind Eigen::DiagonalBase< Derived >::StorageKind

Definition at line 38 of file DiagonalMatrix.h.

Member Enumeration Documentation

◆ anonymous enum

template<typename Derived >
anonymous enum
Enumerator
RowsAtCompileTime 
ColsAtCompileTime 
MaxRowsAtCompileTime 
MaxColsAtCompileTime 
IsVectorAtCompileTime 
Flags 

Definition at line 41 of file DiagonalMatrix.h.

41  {
42  RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
43  ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
44  MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime,
45  MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime,
48  };
const unsigned int NoPreferredStorageOrderBit
Definition: Constants.h:180

Member Function Documentation

◆ coeff()

template<typename Derived >
Scalar Eigen::DiagonalBase< Derived >::coeff ( Index  row,
Index  col 
) const
inline
Returns
the value of the coefficient as if *this was a dense matrix.

Definition at line 77 of file DiagonalMatrix.h.

77  {
78  eigen_assert(row >= 0 && col >= 0 && row < rows() && col <= cols());
79  return row == col ? diagonal().coeff(row) : Scalar(0);
80  }
RowXpr row(Index i)
This is the const version of row(). *‍/.
ColXpr col(Index i)
This is the const version of col().
#define eigen_assert(x)
Definition: Macros.h:902
EIGEN_CONSTEXPR Index cols() const
DiagonalVectorType::Scalar Scalar
const DiagonalVectorType & diagonal() const
EIGEN_CONSTEXPR Index rows() const

◆ cols()

template<typename Derived >
EIGEN_CONSTEXPR Index Eigen::DiagonalBase< Derived >::cols ( void  ) const
inline
Returns
the number of columns.

Definition at line 87 of file DiagonalMatrix.h.

87 { return diagonal().size(); }

◆ derived() [1/2]

template<typename Derived >
Derived& Eigen::DiagonalBase< Derived >::derived ( )
inline
Returns
a const reference to the derived object.

Definition at line 59 of file DiagonalMatrix.h.

59 { return *static_cast<Derived*>(this); }

◆ derived() [2/2]

template<typename Derived >
const Derived& Eigen::DiagonalBase< Derived >::derived ( ) const
inline
Returns
a reference to the derived object.

Definition at line 56 of file DiagonalMatrix.h.

56 { return *static_cast<const Derived*>(this); }

◆ diagonal() [1/2]

template<typename Derived >
DiagonalVectorType& Eigen::DiagonalBase< Derived >::diagonal ( )
inline
Returns
a const reference to the derived object's vector of diagonal coefficients.

Definition at line 73 of file DiagonalMatrix.h.

73 { return derived().diagonal(); }
const Derived & derived() const

◆ diagonal() [2/2]

template<typename Derived >
const DiagonalVectorType& Eigen::DiagonalBase< Derived >::diagonal ( ) const
inline
Returns
a reference to the derived object's vector of diagonal coefficients.

Definition at line 70 of file DiagonalMatrix.h.

70 { return derived().diagonal(); }

◆ inverse()

template<typename Derived >
const DiagonalInverseReturnType Eigen::DiagonalBase< Derived >::inverse ( ) const
inline
Returns
the inverse *this. Computed as the coefficient-wise inverse of the diagonal.

Definition at line 114 of file DiagonalMatrix.h.

114 { return diagonal().cwiseInverse().asDiagonal(); }

◆ operator*() [1/3]

template<typename Derived >
template<typename OtherDerived >
const DiagonalProductReturnType<OtherDerived> Eigen::DiagonalBase< Derived >::operator* ( const DiagonalBase< OtherDerived > &  other) const
inline
Returns
the diagonal matrix product of *this by the diagonal matrix other

Definition at line 104 of file DiagonalMatrix.h.

105  {
106  return diagonal().cwiseProduct(other.diagonal()).asDiagonal();
107  }

◆ operator*() [2/3]

template<typename Derived >
template<typename MatrixDerived >
const Product<Derived,MatrixDerived,LazyProduct> Eigen::DiagonalBase< Derived >::operator* ( const MatrixBase< MatrixDerived > &  matrix) const
inline
Returns
the diagonal matrix product of *this by the dense matrix, matrix

Definition at line 93 of file DiagonalMatrix.h.

94  {
95  return Product<Derived, MatrixDerived, LazyProduct>(derived(),matrix.derived());
96  }

◆ operator*() [3/3]

template<typename Derived >
const DiagonalScaleReturnType Eigen::DiagonalBase< Derived >::operator* ( const Scalar scalar) const
inline
Returns
the product of *this by the scalar scalar

Definition at line 121 of file DiagonalMatrix.h.

121  {
122  return (diagonal() * scalar).asDiagonal();
123  }

◆ operator+()

template<typename Derived >
template<typename OtherDerived >
const DiagonalSumReturnType<OtherDerived> Eigen::DiagonalBase< Derived >::operator+ ( const DiagonalBase< OtherDerived > &  other) const
inline
Returns
the sum of *this and the diagonal matrix other

Definition at line 140 of file DiagonalMatrix.h.

141  {
142  return (diagonal() + other.diagonal()).asDiagonal();
143  }

◆ operator-()

template<typename Derived >
template<typename OtherDerived >
const DiagonalDifferenceReturnType<OtherDerived> Eigen::DiagonalBase< Derived >::operator- ( const DiagonalBase< OtherDerived > &  other) const
inline
Returns
the difference of *this and the diagonal matrix other

Definition at line 151 of file DiagonalMatrix.h.

152  {
153  return (diagonal() - other.diagonal()).asDiagonal();
154  }

◆ rows()

template<typename Derived >
EIGEN_CONSTEXPR Index Eigen::DiagonalBase< Derived >::rows ( void  ) const
inline
Returns
the number of rows.

Definition at line 84 of file DiagonalMatrix.h.

84 { return diagonal().size(); }

◆ toDenseMatrix()

template<typename Derived >
DenseMatrixType Eigen::DiagonalBase< Derived >::toDenseMatrix ( ) const
inline

Constructs a dense matrix from *this. Note, this directly returns a dense matrix type, not an expression.

Returns
A dense matrix, with its diagonal entries set from the the derived object.

Definition at line 66 of file DiagonalMatrix.h.

66 { return derived(); }

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