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); }
58 template<
typename MatrixDerived>
87 template<
typename OtherDerived>
89 #ifdef EIGEN_PARSED_BY_DOXYGEN
90 inline unspecified_expression_type
99 template<
typename OtherDerived>
101 #ifdef EIGEN_PARSED_BY_DOXYGEN
102 inline unspecified_expression_type
128 template<
typename _Scalar,
int SizeAtCompileTime,
int MaxSizeAtCompileTime>
130 :
traits<Matrix<_Scalar,SizeAtCompileTime,SizeAtCompileTime,0,MaxSizeAtCompileTime,MaxSizeAtCompileTime> >
139 template<
typename _Scalar,
int SizeAtCompileTime,
int MaxSizeAtCompileTime>
141 :
public DiagonalBase<DiagonalMatrix<_Scalar,SizeAtCompileTime,MaxSizeAtCompileTime> >
144 #ifndef EIGEN_PARSED_BY_DOXYGEN
192 template <
typename... ArgTypes>
206 template<
typename OtherDerived>
210 #ifndef EIGEN_PARSED_BY_DOXYGEN
216 template<
typename OtherDerived>
222 template<
typename OtherDerived>
230 #ifndef EIGEN_PARSED_BY_DOXYGEN
274 template<
typename _DiagonalVectorType>
278 typedef typename DiagonalVectorType::Scalar
Scalar;
283 RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
284 ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
285 MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime,
286 MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime,
292 template<
typename _DiagonalVectorType>
297 #ifndef EIGEN_PARSED_BY_DOXYGEN
323 template<
typename Derived>
338 template<
typename Derived>
341 if(cols() != rows())
return false;
343 for(
Index j = 0; j < cols(); ++j)
346 if(absOnDiagonal > maxAbsOnDiagonal) maxAbsOnDiagonal = absOnDiagonal;
348 for(
Index j = 0; j < cols(); ++j)
349 for(
Index i = 0; i < j; ++i)
366 template<
typename DstXprType,
typename SrcXprType,
typename Functor>
371 Index dstRows = src.rows();
372 Index dstCols = src.cols();
373 if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
374 dst.resize(dstRows, dstCols);
377 dst.diagonal() = src.diagonal();
381 { dst.diagonal() += src.diagonal(); }
384 { dst.diagonal() -= src.diagonal(); }
#define EIGEN_CWISE_BINARY_RETURN_TYPE(LHS, RHS, OPNAME)
Definition: Macros.h:1326
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
#define EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(EXPR, SCALAR, OPNAME)
Definition: Macros.h:1347
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
#define EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(SCALAR, EXPR, OPNAME)
Definition: Macros.h:1351
EIGEN_DEVICE_FUNC const CwiseInverseReturnType cwiseInverse() const
Definition: MatrixCwiseUnaryOps.h:84
NumTraits< Scalar >::Real RealScalar
Definition: DenseBase.h:73
Definition: DiagonalMatrix.h:19
internal::traits< Derived >::StorageIndex StorageIndex
Definition: DiagonalMatrix.h:25
internal::traits< Derived >::StorageKind StorageKind
Definition: DiagonalMatrix.h:24
EIGEN_DEVICE_FUNC DiagonalVectorType & diagonal()
Definition: DiagonalMatrix.h:51
EIGEN_DEVICE_FUNC const DiagonalWrapper< const EIGEN_CWISE_BINARY_RETURN_TYPE(DiagonalVectorType, typename OtherDerived::DiagonalVectorType, sum) > operator+(const DiagonalBase< OtherDerived > &other) const
Definition: DiagonalMatrix.h:94
DiagonalMatrix< Scalar, DiagonalVectorType::SizeAtCompileTime, DiagonalVectorType::MaxSizeAtCompileTime > PlainObject
Definition: DiagonalMatrix.h:38
DiagonalVectorType::Scalar Scalar
Definition: DiagonalMatrix.h:22
internal::traits< Derived >::DiagonalVectorType DiagonalVectorType
Definition: DiagonalMatrix.h:21
EIGEN_DEVICE_FUNC Index rows() const
Definition: DiagonalMatrix.h:54
EIGEN_DEVICE_FUNC const Product< Derived, MatrixDerived, LazyProduct > operator*(const MatrixBase< MatrixDerived > &matrix) const
Definition: DiagonalMatrix.h:61
EIGEN_DEVICE_FUNC const Derived & derived() const
Definition: DiagonalMatrix.h:41
@ ColsAtCompileTime
Definition: DiagonalMatrix.h:29
@ RowsAtCompileTime
Definition: DiagonalMatrix.h:28
@ MaxRowsAtCompileTime
Definition: DiagonalMatrix.h:30
@ MaxColsAtCompileTime
Definition: DiagonalMatrix.h:31
@ Flags
Definition: DiagonalMatrix.h:33
@ IsVectorAtCompileTime
Definition: DiagonalMatrix.h:32
EIGEN_DEVICE_FUNC DenseMatrixType toDenseMatrix() const
Definition: DiagonalMatrix.h:46
Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTime, 0, MaxRowsAtCompileTime, MaxColsAtCompileTime > DenseMatrixType
Definition: DiagonalMatrix.h:36
EIGEN_DEVICE_FUNC const InverseReturnType inverse() const
Definition: DiagonalMatrix.h:69
EIGEN_DEVICE_FUNC Derived & derived()
Definition: DiagonalMatrix.h:43
DiagonalVectorType::RealScalar RealScalar
Definition: DiagonalMatrix.h:23
EIGEN_DEVICE_FUNC const DiagonalVectorType & diagonal() const
Definition: DiagonalMatrix.h:49
EIGEN_DEVICE_FUNC const DiagonalWrapper< const EIGEN_CWISE_BINARY_RETURN_TYPE(DiagonalVectorType, typename OtherDerived::DiagonalVectorType, difference) > operator-(const DiagonalBase< OtherDerived > &other) const
Definition: DiagonalMatrix.h:106
EIGEN_DEVICE_FUNC Index cols() const
Definition: DiagonalMatrix.h:56
DenseMatrixType DenseType
Definition: DiagonalMatrix.h:37
DiagonalWrapper< const CwiseUnaryOp< internal::scalar_inverse_op< Scalar >, const DiagonalVectorType > > InverseReturnType
Definition: DiagonalMatrix.h:66
EIGEN_DEVICE_FUNC friend const DiagonalWrapper< const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar, DiagonalVectorType, product) > operator*(const Scalar &scalar, const DiagonalBase &other)
Definition: DiagonalMatrix.h:82
EIGEN_DEVICE_FUNC const DiagonalWrapper< const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(DiagonalVectorType, Scalar, product) > operator*(const Scalar &scalar) const
Definition: DiagonalMatrix.h:76
Represents a diagonal matrix with its storage.
Definition: DiagonalMatrix.h:142
EIGEN_DEVICE_FUNC DiagonalMatrix & operator=(const DiagonalBase< OtherDerived > &other)
Definition: DiagonalMatrix.h:224
EIGEN_DEVICE_FUNC DiagonalMatrix(const Scalar &x, const Scalar &y)
Definition: DiagonalMatrix.h:175
internal::traits< DiagonalMatrix >::DiagonalVectorType DiagonalVectorType
Definition: DiagonalMatrix.h:145
EIGEN_DEVICE_FUNC DiagonalMatrix & operator=(const DiagonalMatrix &other)
Definition: DiagonalMatrix.h:235
EIGEN_DEVICE_FUNC DiagonalMatrix(const MatrixBase< OtherDerived > &other)
Definition: DiagonalMatrix.h:218
EIGEN_DEVICE_FUNC void setIdentity()
Definition: DiagonalMatrix.h:253
EIGEN_DEVICE_FUNC void setZero()
Definition: DiagonalMatrix.h:247
EIGEN_DEVICE_FUNC void resize(Index size)
Definition: DiagonalMatrix.h:244
EIGEN_DEVICE_FUNC DiagonalMatrix()
Definition: DiagonalMatrix.h:167
EIGEN_DEVICE_FUNC DiagonalMatrix(Index dim)
Definition: DiagonalMatrix.h:171
_Scalar Scalar
Definition: DiagonalMatrix.h:147
EIGEN_DEVICE_FUNC void setZero(Index size)
Definition: DiagonalMatrix.h:250
EIGEN_DEVICE_FUNC const DiagonalVectorType & diagonal() const
Definition: DiagonalMatrix.h:160
internal::traits< DiagonalMatrix >::StorageIndex StorageIndex
Definition: DiagonalMatrix.h:149
internal::traits< DiagonalMatrix >::StorageKind StorageKind
Definition: DiagonalMatrix.h:148
DiagonalMatrix(const DiagonalMatrix &other)
Definition: DiagonalMatrix.h:212
EIGEN_DEVICE_FUNC DiagonalMatrix(const DiagonalBase< OtherDerived > &other)
Definition: DiagonalMatrix.h:208
EIGEN_DEVICE_FUNC void setIdentity(Index size)
Definition: DiagonalMatrix.h:256
EIGEN_DEVICE_FUNC DiagonalVectorType & diagonal()
Definition: DiagonalMatrix.h:163
EIGEN_DEVICE_FUNC DiagonalMatrix(const Scalar &x, const Scalar &y, const Scalar &z)
Definition: DiagonalMatrix.h:179
DiagonalVectorType m_diagonal
Definition: DiagonalMatrix.h:154
const DiagonalMatrix & Nested
Definition: DiagonalMatrix.h:146
Expression of a diagonal matrix.
Definition: DiagonalMatrix.h:295
DiagonalWrapper Nested
Definition: DiagonalMatrix.h:299
DiagonalVectorType::Nested m_diagonal
Definition: DiagonalMatrix.h:311
EIGEN_DEVICE_FUNC DiagonalWrapper(DiagonalVectorType &a_diagonal)
Definition: DiagonalMatrix.h:304
EIGEN_DEVICE_FUNC const DiagonalVectorType & diagonal() const
Definition: DiagonalMatrix.h:308
_DiagonalVectorType DiagonalVectorType
Definition: DiagonalMatrix.h:298
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:50
EIGEN_DEVICE_FUNC const DiagonalWrapper< const Derived > asDiagonal() const
Definition: DiagonalMatrix.h:325
bool isDiagonal(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: DiagonalMatrix.h:339
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:180
Expression of the product of two arbitrary matrices or vectors.
Definition: Product.h:75
Definition: XprHelper.h:110
const unsigned int NoPreferredStorageOrderBit
Definition: Constants.h:178
const unsigned int LvalueBit
Definition: Constants.h:144
const Scalar & y
Definition: MathFunctions.h:821
EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
Definition: MathFunctions.h:1940
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE internal::enable_if< NumTraits< T >::IsSigned||NumTraits< T >::IsComplex, typename NumTraits< T >::Real >::type abs(const T &x)
Definition: MathFunctions.h:1509
Namespace containing all symbols from the Eigen library.
Definition: LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
Flags
Special flags for archives.
Definition: cereal.hpp:185
Definition: document.h:416
Definition: Constants.h:528
Definition: Constants.h:531
Definition: EigenBase.h:30
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:39
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT
Definition: EigenBase.h:67
Diagonal2Dense Kind
Definition: DiagonalMatrix.h:363
Definition: AssignEvaluator.h:817
static void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op< typename DstXprType::Scalar, typename SrcXprType::Scalar > &)
Definition: DiagonalMatrix.h:383
static void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op< typename DstXprType::Scalar, typename SrcXprType::Scalar > &)
Definition: DiagonalMatrix.h:380
static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op< typename DstXprType::Scalar, typename SrcXprType::Scalar > &)
Definition: DiagonalMatrix.h:369
Definition: AssignEvaluator.h:824
Definition: DiagonalMatrix.h:361
Definition: AssignmentFunctors.h:46
Definition: AssignmentFunctors.h:21
DiagonalShape Shape
Definition: DiagonalMatrix.h:359
Definition: CoreEvaluators.h:29
Definition: AssignmentFunctors.h:67
DiagonalShape StorageKind
Definition: DiagonalMatrix.h:133
Matrix< _Scalar, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1 > DiagonalVectorType
Definition: DiagonalMatrix.h:132
DiagonalShape StorageKind
Definition: DiagonalMatrix.h:280
DiagonalVectorType::Scalar Scalar
Definition: DiagonalMatrix.h:278
_DiagonalVectorType DiagonalVectorType
Definition: DiagonalMatrix.h:277
DiagonalVectorType::StorageIndex StorageIndex
Definition: DiagonalMatrix.h:279
traits< DiagonalVectorType >::XprKind XprKind
Definition: DiagonalMatrix.h:281
Definition: ForwardDeclarations.h:17