11#ifndef EIGEN_DENSEBASE_H
12#define EIGEN_DENSEBASE_H
20static inline void check_DenseIndex_is_signed() {
21 EIGEN_STATIC_ASSERT(NumTraits<DenseIndex>::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE);
44 typename NumTraits<typename internal::traits<Derived>::Scalar>::Real,
45 DenseCoeffsBase<Derived> >
75 typedef typename NumTraits<Scalar>::Real
RealScalar;
78 using Base::operator*;
79 using Base::operator/;
81 using Base::const_cast_derived;
85 using Base::rowIndexByOuterInner;
86 using Base::colIndexByOuterInner;
88 using Base::coeffByOuterInner;
89 using Base::operator();
90 using Base::operator[];
96 using Base::innerStride;
97 using Base::outerStride;
98 using Base::rowStride;
99 using Base::colStride;
100 typedef typename Base::CoeffReturnType CoeffReturnType;
174 InnerStrideAtCompileTime = internal::inner_stride_at_compile_time<Derived>::ret,
175 OuterStrideAtCompileTime = internal::outer_stride_at_compile_time<Derived>::ret
178 typedef typename internal::find_best_packet<Scalar,SizeAtCompileTime>::type PacketScalar;
180 enum { IsPlainObjectBase = 0 };
225 : int(
IsRowMajor) ? this->rows() : this->cols();
237 : int(
IsRowMajor) ? this->cols() : this->rows();
247 EIGEN_ONLY_USED_FOR_DEBUG(
newSize);
248 eigen_assert(
newSize == this->size()
249 &&
"DenseBase::resize() does not actually allow to resize.");
258 EIGEN_ONLY_USED_FOR_DEBUG(rows);
259 EIGEN_ONLY_USED_FOR_DEBUG(cols);
260 eigen_assert(rows == this->rows() && cols == this->cols()
261 &&
"DenseBase::resize() does not actually allow to resize.");
264#ifndef EIGEN_PARSED_BY_DOXYGEN
277 template<
typename OtherDerived>
287 template<
typename OtherDerived>
291 template<
typename OtherDerived>
295 template<
typename OtherDerived>
299 template<
typename OtherDerived>
306 template<
typename OtherDerived>
314 template<
unsigned int Added,
unsigned int Removed>
317 {
return derived(); }
319 template<
typename OtherDerived>
328 ConstTransposeReturnType
transpose()
const;
377 bool isMuchSmallerThan(
const RealScalar& other,
388 inline bool hasNaN()
const;
392 inline Derived& operator*=(
const Scalar& other);
394 inline Derived& operator/=(
const Scalar& other);
405 EIGEN_STRONG_INLINE EvalReturnType
eval()
const
416 template<
typename OtherDerived>
420 EIGEN_STATIC_ASSERT(!OtherDerived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY);
421 eigen_assert(rows()==other.rows() && cols()==other.cols());
428 template<
typename OtherDerived>
432 eigen_assert(rows()==other.rows() && cols()==other.cols());
462 template<
typename BinaryOp>
464 Scalar redux(
const BinaryOp& func)
const;
466 template<
typename Visitor>
476 EIGEN_STATIC_ASSERT_SIZE_1x1(Derived)
477 eigen_assert(this->rows() == 1 && this->cols() == 1);
478 return derived().coeff(0,0);
516 static const RandomReturnType
Random(Index rows, Index cols);
517 static const RandomReturnType
Random(Index size);
518 static const RandomReturnType
Random();
520 template<
typename ThenDerived,
typename ElseDerived>
525 template<
typename ThenDerived>
529 template<
typename ElseDerived>
533 template<
int p> RealScalar lpNorm()
const;
535 template<
int RowFactor,
int ColFactor>
564#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase
565# include "../plugins/BlockMethods.h"
566# ifdef EIGEN_DENSEBASE_PLUGIN
567# include EIGEN_DENSEBASE_PLUGIN
569#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
573 template<
typename Dest>
575 inline void evalTo(
Dest& )
const
587#ifdef EIGEN_INTERNAL_DEBUGGING
590 INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION)
Base class for all dense matrices, vectors, and arrays.
Definition DenseBase.h:49
EIGEN_DEVICE_FUNC Derived & setZero()
Sets all coefficients in this expression to zero.
Definition CwiseNullaryOp.h:504
EIGEN_DEVICE_FUNC CommaInitializer< Derived > operator<<(const Scalar &s)
Convenient operator to set the coefficients of a matrix.
Definition CommaInitializer.h:147
EIGEN_DEVICE_FUNC void resize(Index newSize)
Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods...
Definition DenseBase.h:245
const WithFormat< Derived > format(const IOFormat &fmt) const
Definition IO.h:121
EIGEN_DEVICE_FUNC Scalar prod() const
Definition Redux.h:472
EIGEN_DEVICE_FUNC bool isConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
This is just an alias for isApproxToConstant().
Definition CwiseNullaryOp.h:316
EIGEN_DEVICE_FUNC Derived & operator=(const DenseBase< OtherDerived > &other)
Copies other into *this.
static EIGEN_DEVICE_FUNC const SequentialLinSpacedReturnType LinSpaced(Sequential_t, Index size, const Scalar &low, const Scalar &high)
Sets a linearly space vector.
Definition CwiseNullaryOp.h:245
Index count() const
Definition BooleanRedux.h:129
internal::traits< Derived >::StorageIndex StorageIndex
The type used to store indices.
Definition DenseBase.h:65
EIGEN_DEVICE_FUNC ReverseReturnType reverse()
Definition Reverse.h:118
EIGEN_DEVICE_FUNC const NestByValue< Derived > nestByValue() const
Definition NestByValue.h:104
EIGEN_DEVICE_FUNC void fill(const Scalar &value)
Alias for setConstant(): sets all coefficients in this expression to val.
Definition CwiseNullaryOp.h:326
Eigen::InnerIterator< Derived > InnerIterator
Inner iterator type to iterate over the coefficients of a row or column.
Definition DenseBase.h:55
EIGEN_DEVICE_FUNC Scalar sum() const
Definition Redux.h:445
EIGEN_DEVICE_FUNC Index innerSize() const
Definition DenseBase.h:234
EIGEN_DEVICE_FUNC Derived & setConstant(const Scalar &value)
Sets all coefficients in this expression to value.
Definition CwiseNullaryOp.h:336
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EvalReturnType eval() const
Definition DenseBase.h:405
internal::traits< Derived >::Scalar Scalar
The numeric type of the expression' coefficients, e.g.
Definition DenseBase.h:68
const Select< Derived, ThenDerived, ElseDerived > select(const DenseBase< ThenDerived > &thenMatrix, const DenseBase< ElseDerived > &elseMatrix) const
Definition Select.h:124
EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar minCoeff() const
Definition Redux.h:424
EIGEN_DEVICE_FUNC void visit(Visitor &func) const
Applies the visitor visitor to the whole coefficients of the matrix or vector.
Definition Visitor.h:107
static EIGEN_DEVICE_FUNC const ConstantReturnType Ones()
Definition CwiseNullaryOp.h:602
EIGEN_DEVICE_FUNC Scalar mean() const
Definition Redux.h:458
EIGEN_DEVICE_FUNC CoeffReturnType value() const
Definition DenseBase.h:474
Scalar value_type
The numeric type of the expression' coefficients, e.g.
Definition DenseBase.h:73
EIGEN_DEVICE_FUNC ConstColwiseReturnType colwise() const
Definition DenseBase.h:510
EIGEN_DEVICE_FUNC Derived & setOnes()
Sets all coefficients in this expression to one.
Definition CwiseNullaryOp.h:630
Matrix< typename internal::traits< Derived >::Scalar, internal::traits< Derived >::RowsAtCompileTime, internal::traits< Derived >::ColsAtCompileTime, AutoAlign|(internal::traits< Derived >::Flags &RowMajorBit ? RowMajor :ColMajor), internal::traits< Derived >::MaxRowsAtCompileTime, internal::traits< Derived >::MaxColsAtCompileTime > PlainMatrix
The plain matrix type corresponding to this expression.
Definition DenseBase.h:190
EIGEN_DEVICE_FUNC bool isOnes(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:617
EIGEN_DEVICE_FUNC void swap(PlainObjectBase< OtherDerived > &other)
swaps *this with the matrix or array other.
Definition DenseBase.h:430
static EIGEN_DEVICE_FUNC const ConstantReturnType Constant(Index rows, Index cols, const Scalar &value)
Definition CwiseNullaryOp.h:182
bool hasNaN() const
Definition BooleanRedux.h:139
@ IsVectorAtCompileTime
This is set to true if either the number of rows or the number of columns is known at compile-time to...
Definition DenseBase.h:157
@ SizeAtCompileTime
This is equal to the number of coefficients, i.e.
Definition DenseBase.h:117
@ MaxSizeAtCompileTime
This value is equal to the maximum possible number of coefficients that this expression might have.
Definition DenseBase.h:145
@ IsRowMajor
True if this expression has row-major storage order.
Definition DenseBase.h:169
@ Flags
This stores expression Flags flags which may or may not be inherited by new expressions constructed f...
Definition DenseBase.h:164
@ ColsAtCompileTime
The number of columns at compile-time.
Definition DenseBase.h:110
@ MaxColsAtCompileTime
This value is equal to the maximum possible number of columns that this expression might have.
Definition DenseBase.h:134
@ MaxRowsAtCompileTime
This value is equal to the maximum possible number of rows that this expression might have.
Definition DenseBase.h:123
@ RowsAtCompileTime
The number of rows at compile-time.
Definition DenseBase.h:104
EIGEN_DEVICE_FUNC void swap(const DenseBase< OtherDerived > &other)
swaps *this with the expression other.
Definition DenseBase.h:418
bool any() const
Definition BooleanRedux.h:105
EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar maxCoeff() const
Definition Redux.h:434
EIGEN_DEVICE_FUNC Derived & setRandom()
Sets all coefficients in this expression to random values.
Definition Random.h:132
EIGEN_DEVICE_FUNC void transposeInPlace()
This is the "in place" version of transpose(): it replaces *this by its own transpose.
Definition Transpose.h:278
EIGEN_DEVICE_FUNC TransposeReturnType transpose()
Definition Transpose.h:166
static EIGEN_DEVICE_FUNC const ConstantReturnType Zero()
Definition CwiseNullaryOp.h:472
EIGEN_DEVICE_FUNC Index nonZeros() const
Definition DenseBase.h:214
EIGEN_DEVICE_FUNC Index outerSize() const
Definition DenseBase.h:222
internal::conditional< internal::is_same< typenameinternal::traits< Derived >::XprKind, MatrixXpr >::value, PlainMatrix, PlainArray >::type PlainObject
The plain matrix or array type corresponding to this expression.
Definition DenseBase.h:209
EIGEN_DEVICE_FUNC ConstReverseReturnType reverse() const
This is the const version of reverse().
Definition DenseBase.h:558
EIGEN_DEVICE_FUNC void reverseInPlace()
This is the "in place" version of reverse: it reverses *this.
Definition Reverse.h:139
EIGEN_DEPRECATED const Derived & flagged() const
Definition DenseBase.h:316
bool all() const
Definition BooleanRedux.h:81
static const RandomReturnType Random()
Definition Random.h:114
EIGEN_DEVICE_FUNC DenseBase()
Default constructor.
Definition DenseBase.h:582
EIGEN_DEVICE_FUNC Derived & setLinSpaced(Index size, const Scalar &low, const Scalar &high)
Sets a linearly space vector.
Definition CwiseNullaryOp.h:391
EIGEN_DEVICE_FUNC void resize(Index rows, Index cols)
Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods...
Definition DenseBase.h:256
bool allFinite() const
Definition BooleanRedux.h:153
EIGEN_DEVICE_FUNC bool isZero(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:486
EIGEN_DEVICE_FUNC Derived & lazyAssign(const DenseBase< OtherDerived > &other)
\ínternal Copies other into *this without evaluating other.
EIGEN_DEVICE_FUNC ConstRowwiseReturnType rowwise() const
Definition DenseBase.h:498
EIGEN_DEVICE_FUNC bool isApproxToConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:301
EIGEN_DEVICE_FUNC const Replicate< Derived, Dynamic, Dynamic > replicate(Index rowFactor, Index colFactor) const
Definition DenseBase.h:548
Definition ForwardDeclarations.h:54
Pseudo expression representing a solving operation.
Definition Solve.h:63
@ ColMajor
Storage order is column major (see TopicStorageOrders).
Definition Constants.h:320
@ RowMajor
Storage order is row major (see TopicStorageOrders).
Definition Constants.h:322
@ AutoAlign
Align the matrix itself if it is vectorizable fixed-size.
Definition Constants.h:324
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:61
The type used to identify a matrix expression.
Definition Constants.h:505
Holds information about the various numeric (i.e.
Definition NumTraits.h:108
Definition XprHelper.h:272
Definition XprHelper.h:222
Definition XprHelper.h:458
Definition AssignmentFunctors.h:140
Definition ForwardDeclarations.h:17