11 #ifndef EIGEN_DIAGONALMATRIX_H    12 #define EIGEN_DIAGONALMATRIX_H    16 #ifndef EIGEN_PARSED_BY_DOXYGEN    17 template<
typename Derived>
    22     typedef typename DiagonalVectorType::Scalar 
Scalar;
    23     typedef typename DiagonalVectorType::RealScalar 
RealScalar;
    41     inline const Derived& 
derived()
 const { 
return *
static_cast<const Derived*
>(
this); }
    43     inline Derived& 
derived() { 
return *
static_cast<Derived*
>(
this); }
    49     inline const DiagonalVectorType& 
diagonal()
 const { 
return derived().diagonal(); }
    58     template<
typename MatrixDerived>
    68     inline const InverseReturnType
   104 template<
typename _Scalar, 
int SizeAtCompileTime, 
int MaxSizeAtCompileTime>
   106  : 
traits<Matrix<_Scalar,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> >
   115 template<
typename _Scalar, 
int SizeAtCompileTime, 
int MaxSizeAtCompileTime>
   117   : 
public DiagonalBase<DiagonalMatrix<_Scalar,SizeAtCompileTime,MaxSizeAtCompileTime> >
   120     #ifndef EIGEN_PARSED_BY_DOXYGEN   136     inline const DiagonalVectorType& 
diagonal()
 const { 
return m_diagonal; }
   139     inline DiagonalVectorType& 
diagonal() { 
return m_diagonal; }
   155     inline DiagonalMatrix(
const Scalar& x, 
const Scalar& y, 
const Scalar& z) : m_diagonal(x,y,z) {}
   158     template<
typename OtherDerived>
   162     #ifndef EIGEN_PARSED_BY_DOXYGEN   168     template<
typename OtherDerived>
   174     template<
typename OtherDerived>
   182     #ifndef EIGEN_PARSED_BY_DOXYGEN   199     inline void setZero() { m_diagonal.setZero(); }
   226 template<
typename _DiagonalVectorType>
   230   typedef typename DiagonalVectorType::Scalar 
Scalar;
   244 template<
typename _DiagonalVectorType>
   249     #ifndef EIGEN_PARSED_BY_DOXYGEN   256     explicit inline DiagonalWrapper(DiagonalVectorType& a_diagonal) : m_diagonal(a_diagonal) {}
   260     const DiagonalVectorType& 
diagonal()
 const { 
return m_diagonal; }
   275 template<
typename Derived>
   290 template<
typename Derived>
   298     if(absOnDiagonal > maxAbsOnDiagonal) maxAbsOnDiagonal = absOnDiagonal;
   301     for(
Index i = 0; i < j; ++i)
   303       if(!internal::isMuchSmallerThan(coeff(i, j), maxAbsOnDiagonal, prec)) 
return false;
   304       if(!internal::isMuchSmallerThan(coeff(j, i), maxAbsOnDiagonal, prec)) 
return false;
   318 template< 
typename DstXprType, 
typename SrcXprType, 
typename Functor>
   323     Index dstRows = src.rows();
   324     Index dstCols = src.cols();
   325     if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
   326       dst.resize(dstRows, dstCols);
   329     dst.diagonal() = src.diagonal();
   333   { dst.diagonal() += src.diagonal(); }
   336   { dst.diagonal() -= src.diagonal(); }
   343 #endif // EIGEN_DIAGONALMATRIX_H EIGEN_DEVICE_FUNC Index cols() const
DiagonalMatrix< Scalar, DiagonalVectorType::SizeAtCompileTime, DiagonalVectorType::MaxSizeAtCompileTime > PlainObject
EIGEN_DEVICE_FUNC const Product< Derived, MatrixDerived, LazyProduct > operator*(const MatrixBase< MatrixDerived > &matrix) const
EIGEN_DEVICE_FUNC const DiagonalVectorType & diagonal() const
DiagonalVectorType::StorageIndex StorageIndex
DiagonalShape StorageKind
_DiagonalVectorType DiagonalVectorType
Expression of the product of two arbitrary matrices or vectors. 
DenseMatrixType DenseType
DiagonalVectorType::Scalar Scalar
EIGEN_DEVICE_FUNC const DiagonalVectorType & diagonal() const
EIGEN_DEVICE_FUNC friend const DiagonalWrapper< const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar, DiagonalVectorType, product) > operator*(const Scalar &scalar, const DiagonalBase &other)
EIGEN_DEVICE_FUNC Derived & derived()
static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op< typename DstXprType::Scalar, typename SrcXprType::Scalar > &)
const unsigned int LvalueBit
Represents a diagonal matrix with its storage. 
EIGEN_DEVICE_FUNC const InverseReturnType inverse() const
EIGEN_DEVICE_FUNC DiagonalMatrix()
DiagonalVectorType::Scalar Scalar
EIGEN_DEVICE_FUNC const DiagonalVectorType & diagonal() const
EIGEN_DEVICE_FUNC DiagonalMatrix(const Scalar &x, const Scalar &y)
Eigen::Index Index
The interface type of indices. 
EIGEN_DEVICE_FUNC Index rows() const
internal::traits< Derived >::DiagonalVectorType DiagonalVectorType
static void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op< typename DstXprType::Scalar, typename SrcXprType::Scalar > &)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
EIGEN_DEVICE_FUNC DiagonalMatrix(Index dim)
internal::traits< DiagonalMatrix >::StorageIndex StorageIndex
EIGEN_DEVICE_FUNC void setIdentity(Index size)
DiagonalWrapper< const CwiseUnaryOp< internal::scalar_inverse_op< Scalar >, const DiagonalVectorType > > InverseReturnType
DiagonalVectorType m_diagonal
EIGEN_DEVICE_FUNC DiagonalMatrix & operator=(const DiagonalMatrix &other)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API. 
internal::traits< DiagonalMatrix >::StorageKind StorageKind
bool isDiagonal(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
const DiagonalMatrix & Nested
EIGEN_DEVICE_FUNC DiagonalMatrix & operator=(const DiagonalBase< OtherDerived > &other)
DiagonalVectorType::RealScalar RealScalar
EIGEN_DEVICE_FUNC const DiagonalWrapper< const Derived > asDiagonal() const
EIGEN_DEVICE_FUNC void resize(Index size)
EIGEN_DEVICE_FUNC const CwiseInverseReturnType cwiseInverse() const
Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTime, 0, MaxRowsAtCompileTime, MaxColsAtCompileTime > DenseMatrixType
internal::traits< Derived >::StorageKind StorageKind
EIGEN_DEVICE_FUNC DiagonalVectorType & diagonal()
NumTraits< Scalar >::Real RealScalar
DiagonalShape StorageKind
EIGEN_DEVICE_FUNC DiagonalVectorType & diagonal()
static void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op< typename DstXprType::Scalar, typename SrcXprType::Scalar > &)
EIGEN_DEVICE_FUNC const DiagonalWrapper< const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DiagonalVectorType, Scalar, product) > operator*(const Scalar &scalar) const
_DiagonalVectorType DiagonalVectorType
DiagonalVectorType::Nested m_diagonal
Expression of a diagonal matrix. 
traits< DiagonalVectorType >::XprKind XprKind
internal::traits< DiagonalMatrix >::DiagonalVectorType DiagonalVectorType
EIGEN_DEVICE_FUNC DiagonalMatrix(const Scalar &x, const Scalar &y, const Scalar &z)
EIGEN_DEVICE_FUNC DenseMatrixType toDenseMatrix() const
EIGEN_DEVICE_FUNC void setIdentity()
EIGEN_DEVICE_FUNC DiagonalMatrix(const MatrixBase< OtherDerived > &other)
The matrix class, also used for vectors and row-vectors. 
EIGEN_DEVICE_FUNC Index size() const
EIGEN_DEVICE_FUNC DiagonalMatrix(const DiagonalBase< OtherDerived > &other)
internal::traits< Derived >::StorageIndex StorageIndex
Base class for all dense matrices, vectors, and expressions. 
EIGEN_DEVICE_FUNC void setZero(Index size)
EIGEN_DEVICE_FUNC DiagonalWrapper(DiagonalVectorType &a_diagonal)
DiagonalMatrix(const DiagonalMatrix &other)
EIGEN_DEVICE_FUNC const Derived & derived() const
Matrix< _Scalar, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1 > DiagonalVectorType
const unsigned int NoPreferredStorageOrderBit
EIGEN_DEVICE_FUNC void setZero()