11 #ifndef EIGEN_DENSEBASE_H 12 #define EIGEN_DENSEBASE_H 20 static inline void check_DenseIndex_is_signed() {
21 EIGEN_STATIC_ASSERT(NumTraits<DenseIndex>::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE);
42 #ifndef EIGEN_PARSED_BY_DOXYGEN
43 :
public DenseCoeffsBase<Derived>
45 :
public DenseCoeffsBase<Derived,DirectWriteAccessors>
46 #endif // not EIGEN_PARSED_BY_DOXYGEN 53 typedef Eigen::InnerIterator<Derived> InnerIterator;
55 typedef typename internal::traits<Derived>::StorageKind StorageKind;
63 typedef typename internal::traits<Derived>::StorageIndex
StorageIndex;
66 typedef typename internal::traits<Derived>::Scalar
Scalar;
74 typedef DenseCoeffsBase<Derived> Base;
77 using Base::const_cast_derived;
81 using Base::rowIndexByOuterInner;
82 using Base::colIndexByOuterInner;
84 using Base::coeffByOuterInner;
85 using Base::operator();
86 using Base::operator[];
92 using Base::innerStride;
93 using Base::outerStride;
94 using Base::rowStride;
95 using Base::colStride;
96 typedef typename Base::CoeffReturnType CoeffReturnType;
113 SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
114 internal::traits<Derived>::ColsAtCompileTime>::ret),
142 internal::traits<Derived>::MaxColsAtCompileTime>::ret),
154 || internal::traits<Derived>::MaxColsAtCompileTime == 1,
160 Flags = internal::traits<Derived>::Flags,
170 InnerStrideAtCompileTime = internal::inner_stride_at_compile_time<Derived>::ret,
171 OuterStrideAtCompileTime = internal::outer_stride_at_compile_time<Derived>::ret
174 typedef typename internal::find_best_packet<Scalar,SizeAtCompileTime>::type PacketScalar;
176 enum { IsPlainObjectBase = 0 };
181 internal::traits<Derived>::RowsAtCompileTime,
182 internal::traits<Derived>::ColsAtCompileTime,
184 internal::traits<Derived>::MaxRowsAtCompileTime,
185 internal::traits<Derived>::MaxColsAtCompileTime
191 internal::traits<Derived>::RowsAtCompileTime,
192 internal::traits<Derived>::ColsAtCompileTime,
194 internal::traits<Derived>::MaxRowsAtCompileTime,
195 internal::traits<Derived>::MaxColsAtCompileTime
204 typedef typename internal::conditional<internal::is_same<typename internal::traits<Derived>::XprKind,
MatrixXpr >
::value,
243 EIGEN_ONLY_USED_FOR_DEBUG(newSize);
244 eigen_assert(newSize == this->
size()
245 &&
"DenseBase::resize() does not actually allow to resize.");
254 EIGEN_ONLY_USED_FOR_DEBUG(
rows);
255 EIGEN_ONLY_USED_FOR_DEBUG(
cols);
256 eigen_assert(
rows == this->
rows() && cols == this->
cols()
257 &&
"DenseBase::resize() does not actually allow to resize.");
260 #ifndef EIGEN_PARSED_BY_DOXYGEN 270 #endif // not EIGEN_PARSED_BY_DOXYGEN 273 template<
typename OtherDerived>
274 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
280 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
283 template<
typename OtherDerived>
287 template<
typename OtherDerived>
291 template<
typename OtherDerived>
295 template<
typename OtherDerived>
297 Derived&
operator=(
const ReturnByValue<OtherDerived>& func);
302 template<
typename OtherDerived>
310 template<
unsigned int Added,
unsigned int Removed>
315 template<
typename OtherDerived>
328 EIGEN_DEVICE_FUNC
static const ConstantReturnType
330 EIGEN_DEVICE_FUNC
static const ConstantReturnType
332 EIGEN_DEVICE_FUNC
static const ConstantReturnType
335 EIGEN_DEVICE_FUNC
static const SequentialLinSpacedReturnType
337 EIGEN_DEVICE_FUNC
static const RandomAccessLinSpacedReturnType
339 EIGEN_DEVICE_FUNC
static const SequentialLinSpacedReturnType
341 EIGEN_DEVICE_FUNC
static const RandomAccessLinSpacedReturnType
344 template<
typename CustomNullaryOp> EIGEN_DEVICE_FUNC
347 template<
typename CustomNullaryOp> EIGEN_DEVICE_FUNC
350 template<
typename CustomNullaryOp> EIGEN_DEVICE_FUNC
352 NullaryExpr(
const CustomNullaryOp& func);
355 EIGEN_DEVICE_FUNC
static const ConstantReturnType
Zero(
Index size);
356 EIGEN_DEVICE_FUNC
static const ConstantReturnType
Zero();
358 EIGEN_DEVICE_FUNC
static const ConstantReturnType
Ones(
Index size);
359 EIGEN_DEVICE_FUNC
static const ConstantReturnType
Ones();
365 EIGEN_DEVICE_FUNC Derived&
setZero();
366 EIGEN_DEVICE_FUNC Derived&
setOnes();
369 template<
typename OtherDerived> EIGEN_DEVICE_FUNC
373 bool isMuchSmallerThan(
const RealScalar& other,
375 template<
typename OtherDerived> EIGEN_DEVICE_FUNC
384 inline bool hasNaN()
const;
387 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
388 Derived& operator*=(
const Scalar& other);
389 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
390 Derived& operator/=(
const Scalar& other);
392 typedef typename internal::add_const_on_value_type<typename internal::eval<Derived>::type>::type EvalReturnType;
401 EIGEN_STRONG_INLINE EvalReturnType
eval()
const 406 return typename internal::eval<Derived>::type(
derived());
412 template<
typename OtherDerived>
416 EIGEN_STATIC_ASSERT(!OtherDerived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY);
418 call_assignment(
derived(), other.const_cast_derived(), internal::swap_assign_op<Scalar>());
424 template<
typename OtherDerived>
428 eigen_assert(
rows()==other.rows() &&
cols()==other.cols());
429 call_assignment(
derived(), other.derived(), internal::swap_assign_op<Scalar>());
435 template<
bool Enable> EIGEN_DEVICE_FUNC
436 inline const typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf()
const;
437 template<
bool Enable> EIGEN_DEVICE_FUNC
438 inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf();
442 EIGEN_DEVICE_FUNC
Scalar trace()
const;
446 EIGEN_DEVICE_FUNC
typename internal::traits<Derived>::Scalar
minCoeff()
const;
447 EIGEN_DEVICE_FUNC
typename internal::traits<Derived>::Scalar
maxCoeff()
const;
449 template<
typename IndexType> EIGEN_DEVICE_FUNC
450 typename internal::traits<Derived>::Scalar
minCoeff(IndexType*
row, IndexType*
col)
const;
451 template<
typename IndexType> EIGEN_DEVICE_FUNC
452 typename internal::traits<Derived>::Scalar
maxCoeff(IndexType*
row, IndexType*
col)
const;
453 template<
typename IndexType> EIGEN_DEVICE_FUNC
454 typename internal::traits<Derived>::Scalar
minCoeff(IndexType* index)
const;
455 template<
typename IndexType> EIGEN_DEVICE_FUNC
456 typename internal::traits<Derived>::Scalar
maxCoeff(IndexType* index)
const;
458 template<
typename BinaryOp>
460 Scalar redux(
const BinaryOp& func)
const;
462 template<
typename Visitor>
464 void visit(Visitor& func)
const;
482 EIGEN_STATIC_ASSERT_SIZE_1x1(Derived)
483 eigen_assert(this->
rows() == 1 && this->
cols() == 1);
487 EIGEN_DEVICE_FUNC
bool all()
const;
488 EIGEN_DEVICE_FUNC
bool any()
const;
507 EIGEN_DEVICE_FUNC RowwiseReturnType
rowwise();
519 EIGEN_DEVICE_FUNC ColwiseReturnType
colwise();
524 static const RandomReturnType
Random();
526 template<
typename ThenDerived,
typename ElseDerived>
531 template<
typename ThenDerived>
535 template<
typename ElseDerived>
539 template<
int p> RealScalar lpNorm()
const;
541 template<
int RowFactor,
int ColFactor>
561 EIGEN_DEVICE_FUNC ReverseReturnType
reverse();
570 #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase 571 #define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL 572 #define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND) 573 # include "../plugins/BlockMethods.h" 574 # ifdef EIGEN_DENSEBASE_PLUGIN 575 # include EIGEN_DENSEBASE_PLUGIN 577 #undef EIGEN_CURRENT_STORAGE_BASE_CLASS 578 #undef EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL 579 #undef EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF 582 template<
typename Dest>
584 inline void evalTo(Dest& )
const 586 EIGEN_STATIC_ASSERT((internal::is_same<Dest,void>::value),THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS);
596 #ifdef EIGEN_INTERNAL_DEBUGGING 599 INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION)
604 EIGEN_DEVICE_FUNC
explicit DenseBase(
int);
611 #endif // EIGEN_DENSEBASE_H Generic expression of a matrix where all coefficients are defined by a functor.
Definition: CwiseNullaryOp.h:60
Scalar sum() const
Definition: Redux.h:449
const Replicate< Derived, Dynamic, Dynamic > replicate(Index rowFactor, Index colFactor) const
Definition: DenseBase.h:554
bool isZero(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: CwiseNullaryOp.h:481
ConstReverseReturnType reverse() const
Definition: DenseBase.h:564
ColXpr col(Index i)
Definition: DenseBase.h:839
Index innerSize() const
Definition: DenseBase.h:230
Enforce aligned packet loads and stores regardless of what is requested.
Definition: ForceAlignedAccess.h:34
Definition: DenseBase.h:100
internal::traits< Derived >::Scalar Scalar
Definition: DenseBase.h:66
Definition: Constants.h:320
bool allFinite() const
Definition: BooleanRedux.h:153
Definition: DenseBase.h:119
Expression of the transpose of a matrix.
Definition: Transpose.h:52
static const SequentialLinSpacedReturnType LinSpaced(Sequential_t, Index size, const Scalar &low, const Scalar &high)
Definition: CwiseNullaryOp.h:224
Derived & setRandom()
Definition: Random.h:131
Namespace containing all symbols from the Eigen library.
Definition: Core:306
Scalar value_type
Definition: DenseBase.h:71
Derived & operator=(const DenseBase< OtherDerived > &other)
Definition: Assign.h:39
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:150
RowXpr row(Index i)
Definition: DenseBase.h:860
Definition: DenseBase.h:160
Definition: DenseBase.h:113
Pseudo expression providing partial reduction operations.
Definition: ForwardDeclarations.h:245
const WithFormat< Derived > format(const IOFormat &fmt) const
Definition: DenseBase.h:473
Definition: DenseBase.h:141
Derived & derived()
Definition: EigenBase.h:45
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:38
const unsigned int RowMajorBit
Definition: Constants.h:61
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:41
CommaInitializer< Derived > operator<<(const Scalar &s)
Definition: CommaInitializer.h:144
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
Definition: DenseBase.h:186
const NestByValue< Derived > nestByValue() const
Definition: NestByValue.h:103
static const RandomReturnType Random()
Definition: Random.h:113
TransposeReturnType transpose()
Definition: Transpose.h:172
static const ConstantReturnType Constant(Index rows, Index cols, const Scalar &value)
Definition: CwiseNullaryOp.h:174
void resize(Index newSize)
Definition: DenseBase.h:241
Helper class used by the comma initializer operator.
Definition: CommaInitializer.h:28
internal::traits< Derived >::StorageIndex StorageIndex
The type used to store indices.
Definition: DenseBase.h:63
Definition: EigenBase.h:29
Definition: Constants.h:506
Index nonZeros() const
Definition: DenseBase.h:210
bool hasNaN() const
Definition: BooleanRedux.h:139
const Replicate< Derived, RowFactor, ColFactor > replicate() const
Definition: Replicate.h:119
Definition: Constants.h:324
Index size() const
Definition: EigenBase.h:66
void visit(Visitor &func) const
Definition: Visitor.h:107
static const ConstantReturnType Zero()
Definition: CwiseNullaryOp.h:467
Index rows() const
Definition: EigenBase.h:59
void fill(const Scalar &value)
Definition: CwiseNullaryOp.h:315
Definition: DenseBase.h:165
bool all() const
Definition: BooleanRedux.h:81
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
Dense storage base class for matrices and arrays.
Definition: PlainObjectBase.h:95
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:61
Definition: DenseBase.h:153
bool isConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: CwiseNullaryOp.h:305
Definition: DenseBase.h:130
EIGEN_DEPRECATED const Derived & flagged() const
Definition: DenseBase.h:312
Scalar prod() const
Definition: Redux.h:483
bool any() const
Definition: BooleanRedux.h:105
Expression which must be nested by value.
Definition: NestByValue.h:34
void swap(const DenseBase< OtherDerived > &other)
Definition: DenseBase.h:414
Definition: DenseBase.h:106
ConstColwiseReturnType colwise() const
Definition: DenseBase.h:516
ReverseReturnType reverse()
Definition: Reverse.h:118
static const ConstantReturnType Ones()
Definition: CwiseNullaryOp.h:597
Derived & setLinSpaced(Index size, const Scalar &low, const Scalar &high)
Sets a linearly spaced vector.
Definition: CwiseNullaryOp.h:383
DenseBase()
Definition: DenseBase.h:591
internal::conditional< internal::is_same< typename internal::traits< Derived >::XprKind, MatrixXpr >::value, PlainMatrix, PlainArray >::type PlainObject
The plain matrix or array type corresponding to this expression.
Definition: DenseBase.h:205
ConstRowwiseReturnType rowwise() const
Definition: DenseBase.h:504
Index cols() const
Definition: EigenBase.h:62
Derived & setZero()
Definition: CwiseNullaryOp.h:499
internal::traits< Derived >::Scalar maxCoeff() const
Definition: Redux.h:436
Index count() const
Definition: BooleanRedux.h:129
General-purpose arrays with easy API for coefficient-wise operations.
Definition: Array.h:45
Definition: Constants.h:322
bool isApproxToConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: CwiseNullaryOp.h:290
Index rows() const
Definition: EigenBase.h:59
Derived & setOnes()
Definition: CwiseNullaryOp.h:625
void reverseInPlace()
Definition: Reverse.h:139
Derived & setConstant(const Scalar &value)
Definition: CwiseNullaryOp.h:325
const Select< Derived, ThenDerived, ElseDerived > select(const DenseBase< ThenDerived > &thenMatrix, const DenseBase< ElseDerived > &elseMatrix) const
Definition: Select.h:124
CoeffReturnType value() const
Definition: DenseBase.h:480
EvalReturnType eval() const
Definition: DenseBase.h:401
void transposeInPlace()
Definition: Transpose.h:284
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:178
Index cols() const
Definition: EigenBase.h:62
Expression of the reverse of a vector or matrix.
Definition: Reverse.h:63
bool isOnes(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: CwiseNullaryOp.h:612
internal::traits< Derived >::Scalar minCoeff() const
Definition: Redux.h:426
Scalar mean() const
Definition: Redux.h:462
Index outerSize() const
Definition: DenseBase.h:218
void resize(Index rows, Index cols)
Definition: DenseBase.h:252
void swap(PlainObjectBase< OtherDerived > &other)
Definition: DenseBase.h:426
Expression of a coefficient wise version of the C++ ternary operator ?:
Definition: Select.h:52
bool isApprox(const DenseBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: Fuzzy.h:103