Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime > Class Template Reference

Represents a diagonal matrix with its storage. More...

+ Inheritance diagram for Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >:

Public Types

typedef DiagonalWrapper< const CwiseNullaryOp< internal::scalar_constant_op< Scalar >, DiagonalVectorType > > InitializeReturnType
 
- Public Types inherited from Eigen::DiagonalBase< DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime > >
enum  
 
typedef Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTime, 0, MaxRowsAtCompileTime, MaxColsAtCompileTimeDenseMatrixType
 
typedef DenseMatrixType DenseType
 
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 > >
 
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)>
 
using DiagonalSumReturnType = DiagonalWrapper< const CwiseBinaryOp< internal::scalar_sum_op< DiagonalVectorType ::Scalar, typename OtherDerived::DiagonalVectorType ::Scalar >, const DiagonalVectorType, const typename OtherDerived::DiagonalVectorType > >
 
typedef internal::traits< DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime > >::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< DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime > >::StorageIndex StorageIndex
 
typedef internal::traits< DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime > >::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

DiagonalVectorTypediagonal ()
 
const DiagonalVectorTypediagonal () const
 
 DiagonalMatrix ()
 
template<typename OtherDerived >
 DiagonalMatrix (const DiagonalBase< OtherDerived > &other)
 
template<typename OtherDerived >
 DiagonalMatrix (const MatrixBase< OtherDerived > &other)
 
template<typename... ArgTypes>
 DiagonalMatrix (const Scalar &a0, const Scalar &a1, const Scalar &a2, const ArgTypes &... args)
 Construct a diagonal matrix with fixed size from an arbitrary number of coefficients. More...
 
 DiagonalMatrix (const Scalar &x, const Scalar &y)
 
 DiagonalMatrix (const Scalar &x, const Scalar &y, const Scalar &z)
 
 DiagonalMatrix (const std::initializer_list< std::initializer_list< Scalar >> &list)
 Constructs a DiagonalMatrix and initializes it by elements given by an initializer list of initializer lists [c++11] More...
 
 DiagonalMatrix (DiagonalVectorType &&diag)
 Constructs a DiagonalMatrix from an r-value diagonal vector type. More...
 
 DiagonalMatrix (Index dim)
 
template<typename OtherDerived >
DiagonalMatrixoperator= (const DiagonalBase< OtherDerived > &other)
 
void resize (Index size)
 
void setIdentity ()
 
void setIdentity (Index size)
 
void setZero ()
 
void setZero (Index size)
 
- Public Member Functions inherited from Eigen::DiagonalBase< DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime > >
Scalar coeff (Index row, Index col) const
 
EIGEN_CONSTEXPR Index cols () const
 
DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime > & derived ()
 
const DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime > & derived () const
 
DiagonalVectorTypediagonal ()
 
const DiagonalVectorTypediagonal () const
 
const DiagonalInverseReturnType inverse () const
 
const DiagonalProductReturnType< OtherDerived > operator* (const DiagonalBase< OtherDerived > &other) const
 
const Product< DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >, MatrixDerived, LazyProduct > operator* (const MatrixBase< MatrixDerived > &matrix) const
 
const DiagonalScaleReturnType operator* (const Scalar &scalar) const
 
const DiagonalSumReturnType< OtherDerived > operator+ (const DiagonalBase< OtherDerived > &other) const
 
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
 

Static Public Member Functions

static const InitializeReturnType Identity ()
 
static const InitializeReturnType Identity (Index size)
 
static const InitializeReturnType Zero ()
 
static const InitializeReturnType Zero (Index size)
 

Protected Attributes

DiagonalVectorType m_diagonal
 

Detailed Description

template<typename Scalar_, int SizeAtCompileTime, int MaxSizeAtCompileTime>
class Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >

Represents a diagonal matrix with its storage.

Template Parameters
Scalar_the type of coefficients
SizeAtCompileTimethe dimension of the matrix, or Dynamic
MaxSizeAtCompileTimethe dimension of the matrix, or Dynamic. This parameter is optional and defaults to SizeAtCompileTime. Most of the time, you do not need to specify it.
See also
class DiagonalBase, class DiagonalWrapper

Definition at line 183 of file DiagonalMatrix.h.

Member Typedef Documentation

◆ InitializeReturnType

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
typedef DiagonalWrapper<const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, DiagonalVectorType> > Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::InitializeReturnType

Definition at line 286 of file DiagonalMatrix.h.

Constructor & Destructor Documentation

◆ DiagonalMatrix() [1/9]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::DiagonalMatrix ( )
inline

Default constructor without initialization

Definition at line 210 of file DiagonalMatrix.h.

210 {}

◆ DiagonalMatrix() [2/9]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::DiagonalMatrix ( Index  dim)
inlineexplicit

Constructs a diagonal matrix with given dimension

Definition at line 214 of file DiagonalMatrix.h.

214 : m_diagonal(dim) {}
DiagonalVectorType m_diagonal

◆ DiagonalMatrix() [3/9]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::DiagonalMatrix ( const Scalar x,
const Scalar y 
)
inline

2D constructor.

Definition at line 218 of file DiagonalMatrix.h.

218 : m_diagonal(x,y) {}
const Scalar & y

◆ DiagonalMatrix() [4/9]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::DiagonalMatrix ( const Scalar x,
const Scalar y,
const Scalar z 
)
inline

3D constructor.

Definition at line 222 of file DiagonalMatrix.h.

222 : m_diagonal(x,y,z) {}

◆ DiagonalMatrix() [5/9]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
template<typename... ArgTypes>
Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::DiagonalMatrix ( const Scalar a0,
const Scalar a1,
const Scalar a2,
const ArgTypes &...  args 
)
inline

Construct a diagonal matrix with fixed size from an arbitrary number of coefficients.

Warning
To construct a diagonal matrix of fixed size, the number of values passed to this constructor must match the fixed dimension of *this.
See also
DiagonalMatrix(const Scalar&, const Scalar&)
DiagonalMatrix(const Scalar&, const Scalar&, const Scalar&)

Definition at line 234 of file DiagonalMatrix.h.

235  : m_diagonal(a0, a1, a2, args...) {}

◆ DiagonalMatrix() [6/9]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::DiagonalMatrix ( const std::initializer_list< std::initializer_list< Scalar >> &  list)
inlineexplicit

Constructs a DiagonalMatrix and initializes it by elements given by an initializer list of initializer lists [c++11]

Definition at line 241 of file DiagonalMatrix.h.

242  : m_diagonal(list) {}

◆ DiagonalMatrix() [7/9]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::DiagonalMatrix ( DiagonalVectorType &&  diag)
inlineexplicit

Constructs a DiagonalMatrix from an r-value diagonal vector type.

Definition at line 246 of file DiagonalMatrix.h.

246 : m_diagonal(std::move(diag)) {}

◆ DiagonalMatrix() [8/9]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
template<typename OtherDerived >
Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::DiagonalMatrix ( const DiagonalBase< OtherDerived > &  other)
inline

Copy constructor.

Definition at line 251 of file DiagonalMatrix.h.

251 : m_diagonal(other.diagonal()) {}

◆ DiagonalMatrix() [9/9]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
template<typename OtherDerived >
Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::DiagonalMatrix ( const MatrixBase< OtherDerived > &  other)
inlineexplicit

generic constructor from expression of the diagonal coefficients

Definition at line 261 of file DiagonalMatrix.h.

261  : m_diagonal(other)
262  {}

Member Function Documentation

◆ diagonal() [1/2]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
DiagonalVectorType& Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::diagonal ( )
inline
Returns
a reference to the stored vector of diagonal coefficients.

Definition at line 206 of file DiagonalMatrix.h.

206 { return m_diagonal; }

◆ diagonal() [2/2]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
const DiagonalVectorType& Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::diagonal ( ) const
inline

const version of diagonal().

Definition at line 203 of file DiagonalMatrix.h.

203 { return m_diagonal; }

◆ Identity() [1/2]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
static const InitializeReturnType Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::Identity ( )
inlinestatic

Initializes a identity matrix of size SizeAtCompileTime

Definition at line 296 of file DiagonalMatrix.h.

296 { return DiagonalVectorType::Ones().asDiagonal(); }

◆ Identity() [2/2]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
static const InitializeReturnType Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::Identity ( Index  size)
inlinestatic

Initializes a identity matrix of size dim

Definition at line 299 of file DiagonalMatrix.h.

299 { return DiagonalVectorType::Ones(size).asDiagonal(); }
EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT
Definition: EigenBase.h:69

◆ operator=()

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
template<typename OtherDerived >
DiagonalMatrix& Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::operator= ( const DiagonalBase< OtherDerived > &  other)
inline

Copy operator.

Definition at line 267 of file DiagonalMatrix.h.

268  {
269  m_diagonal = other.diagonal();
270  return *this;
271  }

◆ resize()

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
void Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::resize ( Index  size)
inline

Resizes to given size.

Definition at line 303 of file DiagonalMatrix.h.

303 { m_diagonal.resize(size); }

◆ setIdentity() [1/2]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
void Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::setIdentity ( )
inline

Sets this matrix to be the identity matrix of the current size.

Definition at line 312 of file DiagonalMatrix.h.

312 { m_diagonal.setOnes(); }

◆ setIdentity() [2/2]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
void Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::setIdentity ( Index  size)
inline

Sets this matrix to be the identity matrix of the given size.

Definition at line 315 of file DiagonalMatrix.h.

315 { m_diagonal.setOnes(size); }

◆ setZero() [1/2]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
void Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::setZero ( )
inline

Sets all coefficients to zero.

Definition at line 306 of file DiagonalMatrix.h.

306 { m_diagonal.setZero(); }

◆ setZero() [2/2]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
void Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::setZero ( Index  size)
inline

Resizes and sets all coefficients to zero.

Definition at line 309 of file DiagonalMatrix.h.

309 { m_diagonal.setZero(size); }

◆ Zero() [1/2]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
static const InitializeReturnType Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::Zero ( )
inlinestatic

Initializes a diagonal matrix of size SizeAtCompileTime with coefficients set to zero

Definition at line 290 of file DiagonalMatrix.h.

290 { return DiagonalVectorType::Zero().asDiagonal(); }

◆ Zero() [2/2]

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
static const InitializeReturnType Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::Zero ( Index  size)
inlinestatic

Initializes a diagonal matrix of size dim with coefficients set to zero

Definition at line 293 of file DiagonalMatrix.h.

293 { return DiagonalVectorType::Zero(size).asDiagonal(); }

Member Data Documentation

◆ m_diagonal

template<typename Scalar_ , int SizeAtCompileTime, int MaxSizeAtCompileTime>
DiagonalVectorType Eigen::DiagonalMatrix< Scalar_, SizeAtCompileTime, MaxSizeAtCompileTime >::m_diagonal
protected

Definition at line 197 of file DiagonalMatrix.h.


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