Eigen::DiagonalBase< Derived > Class Template Reference

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

#include <DiagonalMatrix.h>

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

Public Types

enum  {
  RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime , ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime , MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime , MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime ,
  IsVectorAtCompileTime = 0 , Flags = NoPreferredStorageOrderBit
}
 
typedef internal::traits< Derived >::DiagonalVectorType DiagonalVectorType
 
typedef DiagonalVectorType::Scalar Scalar
 
typedef DiagonalVectorType::RealScalar RealScalar
 
typedef internal::traits< Derived >::StorageKind StorageKind
 
typedef internal::traits< Derived >::StorageIndex StorageIndex
 
typedef Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTime, 0, MaxRowsAtCompileTime, MaxColsAtCompileTimeDenseMatrixType
 
typedef DenseMatrixType DenseType
 
typedef DiagonalMatrix< Scalar, DiagonalVectorType::SizeAtCompileTime, DiagonalVectorType::MaxSizeAtCompileTime > PlainObject
 
template<typename OtherDerived >
using DiagonalProductReturnType = DiagonalWrapper< const EIGEN_CWISE_BINARY_RETURN_TYPE(DiagonalVectorType, typename OtherDerived::DiagonalVectorType, product)>
 
using DiagonalInverseReturnType = DiagonalWrapper< const CwiseUnaryOp< internal::scalar_inverse_op< Scalar >, const DiagonalVectorType > >
 
using DiagonalScaleReturnType = DiagonalWrapper< const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DiagonalVectorType, Scalar, product)>
 
using ScaleDiagonalReturnType = DiagonalWrapper< const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar, DiagonalVectorType, product)>
 
template<typename OtherDerived >
using DiagonalSumReturnType = DiagonalWrapper< const EIGEN_CWISE_BINARY_RETURN_TYPE(DiagonalVectorType, typename OtherDerived::DiagonalVectorType, sum)>
 
template<typename OtherDerived >
using DiagonalDifferenceReturnType = DiagonalWrapper< const EIGEN_CWISE_BINARY_RETURN_TYPE(DiagonalVectorType, typename OtherDerived::DiagonalVectorType, difference)>
 
- 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

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

Friends

EIGEN_DEVICE_FUNC friend const ScaleDiagonalReturnType operator* (const Scalar &scalar, const DiagonalBase &other)
 

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

Member Typedef Documentation

◆ DenseMatrixType

◆ DenseType

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

◆ DiagonalDifferenceReturnType

template<typename Derived >
template<typename OtherDerived >
using Eigen::DiagonalBase< Derived >::DiagonalDifferenceReturnType = DiagonalWrapper<const EIGEN_CWISE_BINARY_RETURN_TYPE( DiagonalVectorType, typename OtherDerived::DiagonalVectorType, difference)>

◆ DiagonalInverseReturnType

◆ DiagonalProductReturnType

template<typename Derived >
template<typename OtherDerived >
using Eigen::DiagonalBase< Derived >::DiagonalProductReturnType = DiagonalWrapper<const EIGEN_CWISE_BINARY_RETURN_TYPE( DiagonalVectorType, typename OtherDerived::DiagonalVectorType, product)>

◆ DiagonalScaleReturnType

◆ DiagonalSumReturnType

template<typename Derived >
template<typename OtherDerived >
using Eigen::DiagonalBase< Derived >::DiagonalSumReturnType = DiagonalWrapper<const EIGEN_CWISE_BINARY_RETURN_TYPE( DiagonalVectorType, typename OtherDerived::DiagonalVectorType, sum)>

◆ DiagonalVectorType

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

◆ PlainObject

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

◆ RealScalar

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

◆ Scalar

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

◆ ScaleDiagonalReturnType

template<typename Derived >
using Eigen::DiagonalBase< Derived >::ScaleDiagonalReturnType = DiagonalWrapper<const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar, DiagonalVectorType, product)>

◆ StorageIndex

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

◆ StorageKind

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

Member Enumeration Documentation

◆ anonymous enum

template<typename Derived >
anonymous enum
Enumerator
RowsAtCompileTime 
ColsAtCompileTime 
MaxRowsAtCompileTime 
MaxColsAtCompileTime 
IsVectorAtCompileTime 
Flags 
41  {
42  RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
43  ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
44  MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime,
45  MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime,
48  };
@ ColsAtCompileTime
Definition: DiagonalMatrix.h:43
@ RowsAtCompileTime
Definition: DiagonalMatrix.h:42
@ MaxRowsAtCompileTime
Definition: DiagonalMatrix.h:44
@ MaxColsAtCompileTime
Definition: DiagonalMatrix.h:45
@ IsVectorAtCompileTime
Definition: DiagonalMatrix.h:46
const unsigned int NoPreferredStorageOrderBit
Definition: Constants.h:182
Extend namespace for flags.
Definition: fsi_chan_precond_driver.cc:56

Member Function Documentation

◆ coeff()

template<typename Derived >
EIGEN_DEVICE_FUNC Scalar Eigen::DiagonalBase< Derived >::coeff ( Index  row,
Index  col 
) const
inline
Returns
the value of the coefficient as if *this was a dense matrix.
73  {
74  eigen_assert(row >= 0 && col >= 0 && row < rows() && col <= cols());
75  return row == col ? diagonal().coeff(row) : Scalar(0);
76  }
#define eigen_assert(x)
Definition: Macros.h:910
m col(1)
m row(1)
DiagonalVectorType::Scalar Scalar
Definition: DiagonalMatrix.h:36
EIGEN_DEVICE_FUNC const DiagonalVectorType & diagonal() const
Definition: DiagonalMatrix.h:68
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const
Definition: DiagonalMatrix.h:81
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const
Definition: DiagonalMatrix.h:79

References col(), Eigen::DiagonalBase< Derived >::cols(), Eigen::DiagonalBase< Derived >::diagonal(), eigen_assert, row(), and Eigen::DiagonalBase< Derived >::rows().

◆ cols()

◆ derived() [1/2]

template<typename Derived >
EIGEN_DEVICE_FUNC Derived& Eigen::DiagonalBase< Derived >::derived ( )
inline
Returns
a const reference to the derived object.
59 { return *static_cast<Derived*>(this); }

◆ derived() [2/2]

◆ diagonal() [1/2]

template<typename Derived >
EIGEN_DEVICE_FUNC DiagonalVectorType& Eigen::DiagonalBase< Derived >::diagonal ( )
inline
Returns
a const reference to the derived object's vector of diagonal coefficients.
70 { return derived().diagonal(); }
EIGEN_DEVICE_FUNC const Derived & derived() const
Definition: DiagonalMatrix.h:57

References Eigen::DiagonalBase< Derived >::derived().

◆ diagonal() [2/2]

◆ inverse()

template<typename Derived >
EIGEN_DEVICE_FUNC const DiagonalInverseReturnType Eigen::DiagonalBase< Derived >::inverse ( ) const
inline
Returns
the inverse *this. Computed as the coefficient-wise inverse of the diagonal.
105  {
106  return diagonal().cwiseInverse().asDiagonal();
107  }

References Eigen::DiagonalBase< Derived >::diagonal().

◆ operator*() [1/3]

template<typename Derived >
template<typename OtherDerived >
EIGEN_DEVICE_FUNC 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
97  {
98  return diagonal().cwiseProduct(other.diagonal()).asDiagonal();
99  }

References Eigen::DiagonalBase< Derived >::diagonal().

◆ operator*() [2/3]

template<typename Derived >
template<typename MatrixDerived >
EIGEN_DEVICE_FUNC 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
86  {
87  return Product<Derived, MatrixDerived, LazyProduct>(derived(), matrix.derived());
88  }
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor >, 0, Eigen::OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: common.h:85

References Eigen::DiagonalBase< Derived >::derived(), and matrix().

◆ operator*() [3/3]

template<typename Derived >
EIGEN_DEVICE_FUNC const DiagonalScaleReturnType Eigen::DiagonalBase< Derived >::operator* ( const Scalar scalar) const
inline
Returns
the product of *this by the scalar scalar
113  {
114  return (diagonal() * scalar).asDiagonal();
115  }

References Eigen::DiagonalBase< Derived >::diagonal().

◆ operator+()

template<typename Derived >
template<typename OtherDerived >
EIGEN_DEVICE_FUNC const DiagonalSumReturnType<OtherDerived> Eigen::DiagonalBase< Derived >::operator+ ( const DiagonalBase< OtherDerived > &  other) const
inline
Returns
the sum of *this and the diagonal matrix other
133  {
134  return (diagonal() + other.diagonal()).asDiagonal();
135  }

References Eigen::DiagonalBase< Derived >::diagonal().

◆ operator-()

template<typename Derived >
template<typename OtherDerived >
EIGEN_DEVICE_FUNC const DiagonalDifferenceReturnType<OtherDerived> Eigen::DiagonalBase< Derived >::operator- ( const DiagonalBase< OtherDerived > &  other) const
inline
Returns
the difference of *this and the diagonal matrix other
144  {
145  return (diagonal() - other.diagonal()).asDiagonal();
146  }

References Eigen::DiagonalBase< Derived >::diagonal().

◆ rows()

◆ toDenseMatrix()

template<typename Derived >
EIGEN_DEVICE_FUNC 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.
65 { return derived(); }

References Eigen::DiagonalBase< Derived >::derived().

Friends And Related Function Documentation

◆ operator*

template<typename Derived >
EIGEN_DEVICE_FUNC friend const ScaleDiagonalReturnType operator* ( const Scalar scalar,
const DiagonalBase< Derived > &  other 
)
friend
Returns
the product of a scalar and the diagonal matrix other
122  {
123  return (scalar * other.diagonal()).asDiagonal();
124  }

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