11#ifndef EIGEN_DENSEBASE_H
12#define EIGEN_DENSEBASE_H
14#include "./InternalHeaderCheck.h"
19EIGEN_STATIC_ASSERT(NumTraits<DenseIndex>::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE)
37#ifndef EIGEN_PARSED_BY_DOXYGEN
38 :
public DenseCoeffsBase<Derived, internal::accessors_level<Derived>::value>
48 typedef Eigen::InnerIterator<Derived> InnerIterator;
50 typedef typename internal::traits<Derived>::StorageKind StorageKind;
58 typedef typename internal::traits<Derived>::StorageIndex
StorageIndex;
61 typedef typename internal::traits<Derived>::Scalar
Scalar;
69 typedef DenseCoeffsBase<Derived, internal::accessors_level<Derived>::value> Base;
72 using Base::const_cast_derived;
76 using Base::rowIndexByOuterInner;
77 using Base::colIndexByOuterInner;
79 using Base::coeffByOuterInner;
80 using Base::operator();
81 using Base::operator[];
87 using Base::innerStride;
88 using Base::outerStride;
89 using Base::rowStride;
90 using Base::colStride;
91 typedef typename Base::CoeffReturnType CoeffReturnType;
95 RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
101 ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
108 SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
109 internal::traits<Derived>::ColsAtCompileTime>::ret),
114 MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime,
125 MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime,
136 MaxSizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::MaxRowsAtCompileTime,
137 internal::traits<Derived>::MaxColsAtCompileTime>::ret),
148 IsVectorAtCompileTime = internal::traits<Derived>::RowsAtCompileTime == 1
149 || internal::traits<Derived>::ColsAtCompileTime == 1,
155 NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0 : bool(IsVectorAtCompileTime) ? 1 : 2,
160 Flags = internal::traits<Derived>::Flags,
167 InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? int(SizeAtCompileTime)
168 : int(IsRowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime),
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,
212 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
215 return IsVectorAtCompileTime ? 1
216 : int(IsRowMajor) ? this->rows() : this->cols();
224 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
227 return IsVectorAtCompileTime ? this->size()
228 : int(IsRowMajor) ? this->cols() : this->rows();
238 EIGEN_ONLY_USED_FOR_DEBUG(newSize);
239 eigen_assert(newSize == this->size()
240 &&
"DenseBase::resize() does not actually allow to resize.");
249 EIGEN_ONLY_USED_FOR_DEBUG(rows);
250 EIGEN_ONLY_USED_FOR_DEBUG(cols);
251 eigen_assert(rows == this->rows() && cols == this->cols()
252 &&
"DenseBase::resize() does not actually allow to resize.");
255#ifndef EIGEN_PARSED_BY_DOXYGEN
268 template<
typename OtherDerived>
269 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
275 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
276 Derived& operator=(
const DenseBase& other);
278 template<
typename OtherDerived>
282 template<
typename OtherDerived>
286 template<
typename OtherDerived>
290 template<
typename OtherDerived>
292 Derived& operator=(
const ReturnByValue<OtherDerived>& func);
296 template<
typename OtherDerived>
298 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC
304 template<
unsigned int Added,
unsigned int Removed>
308 {
return derived(); }
310 template<
typename OtherDerived>
316 TransposeReturnType transpose();
317 typedef typename internal::add_const<Transpose<const Derived> >::type ConstTransposeReturnType;
319 ConstTransposeReturnType transpose()
const;
321 void transposeInPlace();
323 EIGEN_DEVICE_FUNC
static const ConstantReturnType
324 Constant(
Index rows,
Index cols,
const Scalar& value);
325 EIGEN_DEVICE_FUNC
static const ConstantReturnType
326 Constant(
Index size,
const Scalar& value);
327 EIGEN_DEVICE_FUNC
static const ConstantReturnType
328 Constant(
const Scalar& value);
330 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC
static const RandomAccessLinSpacedReturnType
331 LinSpaced(Sequential_t,
Index size,
const Scalar& low,
const Scalar& high);
332 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC
static const RandomAccessLinSpacedReturnType
333 LinSpaced(Sequential_t,
const Scalar& low,
const Scalar& high);
335 EIGEN_DEVICE_FUNC
static const RandomAccessLinSpacedReturnType
336 LinSpaced(
Index size,
const Scalar& low,
const Scalar& high);
337 EIGEN_DEVICE_FUNC
static const RandomAccessLinSpacedReturnType
338 LinSpaced(
const Scalar& low,
const Scalar& high);
340 template<
typename CustomNullaryOp> EIGEN_DEVICE_FUNC
342 NullaryExpr(
Index rows,
Index cols,
const CustomNullaryOp& func);
343 template<
typename CustomNullaryOp> EIGEN_DEVICE_FUNC
345 NullaryExpr(
Index size,
const CustomNullaryOp& func);
346 template<
typename CustomNullaryOp> EIGEN_DEVICE_FUNC
348 NullaryExpr(
const CustomNullaryOp& func);
350 EIGEN_DEVICE_FUNC
static const ConstantReturnType Zero(
Index rows,
Index cols);
351 EIGEN_DEVICE_FUNC
static const ConstantReturnType Zero(
Index size);
352 EIGEN_DEVICE_FUNC
static const ConstantReturnType Zero();
353 EIGEN_DEVICE_FUNC
static const ConstantReturnType Ones(
Index rows,
Index cols);
354 EIGEN_DEVICE_FUNC
static const ConstantReturnType Ones(
Index size);
355 EIGEN_DEVICE_FUNC
static const ConstantReturnType Ones();
357 EIGEN_DEVICE_FUNC
void fill(
const Scalar& value);
358 EIGEN_DEVICE_FUNC Derived& setConstant(
const Scalar& value);
359 EIGEN_DEVICE_FUNC Derived& setLinSpaced(
Index size,
const Scalar& low,
const Scalar& high);
360 EIGEN_DEVICE_FUNC Derived& setLinSpaced(
const Scalar& low,
const Scalar& high);
361 EIGEN_DEVICE_FUNC Derived& setZero();
362 EIGEN_DEVICE_FUNC Derived& setOnes();
363 EIGEN_DEVICE_FUNC Derived& setRandom();
365 template<
typename OtherDerived> EIGEN_DEVICE_FUNC
369 bool isMuchSmallerThan(
const RealScalar& other,
371 template<
typename OtherDerived> EIGEN_DEVICE_FUNC
380 EIGEN_DEVICE_FUNC
inline bool hasNaN()
const;
381 EIGEN_DEVICE_FUNC
inline bool allFinite()
const;
383 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
384 Derived& operator*=(
const Scalar& other);
385 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
386 Derived& operator/=(
const Scalar& other);
388 typedef typename internal::add_const_on_value_type<typename internal::eval<Derived>::type>::type EvalReturnType;
397 EIGEN_STRONG_INLINE EvalReturnType
eval()
const
402 return typename internal::eval<Derived>::type(derived());
408 template<
typename OtherDerived>
409 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
412 EIGEN_STATIC_ASSERT(!OtherDerived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY);
413 eigen_assert(rows()==other.
rows() && cols()==other.
cols());
414 call_assignment(derived(), other.const_cast_derived(), internal::swap_assign_op<Scalar>());
420 template<
typename OtherDerived>
421 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
424 eigen_assert(rows()==other.rows() && cols()==other.cols());
425 call_assignment(derived(), other.derived(), internal::swap_assign_op<Scalar>());
431 template<
bool Enable> EIGEN_DEVICE_FUNC
432 inline const typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf()
const;
433 template<
bool Enable> EIGEN_DEVICE_FUNC
434 inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf();
436 EIGEN_DEVICE_FUNC Scalar sum()
const;
437 EIGEN_DEVICE_FUNC Scalar mean()
const;
438 EIGEN_DEVICE_FUNC Scalar trace()
const;
440 EIGEN_DEVICE_FUNC Scalar prod()
const;
442 template<
int NaNPropagation>
443 EIGEN_DEVICE_FUNC
typename internal::traits<Derived>::Scalar minCoeff()
const;
444 template<
int NaNPropagation>
445 EIGEN_DEVICE_FUNC
typename internal::traits<Derived>::Scalar maxCoeff()
const;
452 EIGEN_DEVICE_FUNC
inline typename internal::traits<Derived>::Scalar minCoeff()
const {
453 return minCoeff<PropagateFast>();
455 EIGEN_DEVICE_FUNC
inline typename internal::traits<Derived>::Scalar maxCoeff()
const {
456 return maxCoeff<PropagateFast>();
459 template<
int NaNPropagation,
typename IndexType>
461 typename internal::traits<Derived>::Scalar minCoeff(IndexType* row, IndexType* col)
const;
462 template<
int NaNPropagation,
typename IndexType>
464 typename internal::traits<Derived>::Scalar maxCoeff(IndexType* row, IndexType* col)
const;
465 template<
int NaNPropagation,
typename IndexType>
467 typename internal::traits<Derived>::Scalar minCoeff(IndexType* index)
const;
468 template<
int NaNPropagation,
typename IndexType>
470 typename internal::traits<Derived>::Scalar maxCoeff(IndexType* index)
const;
473 template<
typename IndexType>
474 EIGEN_DEVICE_FUNC
inline
475 typename internal::traits<Derived>::Scalar minCoeff(IndexType* row, IndexType* col)
const {
476 return minCoeff<PropagateFast>(row, col);
478 template<
typename IndexType>
479 EIGEN_DEVICE_FUNC
inline
480 typename internal::traits<Derived>::Scalar maxCoeff(IndexType* row, IndexType* col)
const {
481 return maxCoeff<PropagateFast>(row, col);
483 template<
typename IndexType>
484 EIGEN_DEVICE_FUNC
inline
485 typename internal::traits<Derived>::Scalar minCoeff(IndexType* index)
const {
486 return minCoeff<PropagateFast>(index);
488 template<
typename IndexType>
489 EIGEN_DEVICE_FUNC
inline
490 typename internal::traits<Derived>::Scalar maxCoeff(IndexType* index)
const {
491 return maxCoeff<PropagateFast>(index);
494 template<
typename BinaryOp>
496 Scalar redux(
const BinaryOp& func)
const;
498 template<
typename Visitor>
500 void visit(Visitor& func)
const;
518 EIGEN_STATIC_ASSERT_SIZE_1x1(Derived)
519 eigen_assert(this->rows() == 1 && this->cols() == 1);
520 return derived().coeff(0,0);
523 EIGEN_DEVICE_FUNC
bool all()
const;
524 EIGEN_DEVICE_FUNC
bool any()
const;
525 EIGEN_DEVICE_FUNC
Index count()
const;
543 EIGEN_DEVICE_FUNC RowwiseReturnType rowwise();
555 EIGEN_DEVICE_FUNC ColwiseReturnType colwise();
558 static const RandomReturnType Random(
Index rows,
Index cols);
559 static const RandomReturnType Random(
Index size);
560 static const RandomReturnType Random();
562 template<
typename ThenDerived,
typename ElseDerived>
567 template<
typename ThenDerived>
571 template<
typename ElseDerived>
575 template<
int p> RealScalar lpNorm()
const;
577 template<
int RowFactor,
int ColFactor>
597 EIGEN_DEVICE_FUNC ReverseReturnType reverse();
604 EIGEN_DEVICE_FUNC
void reverseInPlace();
606 #ifdef EIGEN_PARSED_BY_DOXYGEN
615 internal::pointer_based_stl_iterator<Derived>,
616 internal::generic_randaccess_stl_iterator<Derived>
617 >::type iterator_type;
620 internal::pointer_based_stl_iterator<const Derived>,
621 internal::generic_randaccess_stl_iterator<const Derived>
622 >::type const_iterator_type;
626 typedef typename internal::conditional< IsVectorAtCompileTime,
631 typedef typename internal::conditional< IsVectorAtCompileTime,
644#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase
645#define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
646#define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND)
647#define EIGEN_DOC_UNARY_ADDONS(X,Y)
648# include "../plugins/CommonCwiseUnaryOps.h"
649# include "../plugins/BlockMethods.h"
650# include "../plugins/IndexedViewMethods.h"
651# include "../plugins/ReshapedMethods.h"
652# ifdef EIGEN_DENSEBASE_PLUGIN
653# include EIGEN_DENSEBASE_PLUGIN
655#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
656#undef EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
657#undef EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF
658#undef EIGEN_DOC_UNARY_ADDONS
661 template<
typename Dest>
663 inline void evalTo(Dest& )
const
665 EIGEN_STATIC_ASSERT((internal::is_same<Dest,void>::value),THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS);
669 EIGEN_DEFAULT_COPY_CONSTRUCTOR(
DenseBase)
676#ifdef EIGEN_INTERNAL_DEBUGGING
677 EIGEN_STATIC_ASSERT((internal::check_implication(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1,
int(IsRowMajor))
678 && internal::check_implication(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1,
int(!IsRowMajor))),
679 INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION)
684 EIGEN_DEVICE_FUNC
explicit DenseBase(
int);
General-purpose arrays with easy API for coefficient-wise operations.
Definition: Array.h:49
Generic expression of a matrix where all coefficients are defined by a functor.
Definition: CwiseNullaryOp.h:63
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:42
EIGEN_CONSTEXPR Index outerSize() const
Definition: DenseBase.h:213
const WithFormat< Derived > format(const IOFormat &fmt) const
Definition: DenseBase.h:509
void resize(Index rows, Index cols)
Definition: DenseBase.h:247
internal::traits< Derived >::StorageIndex StorageIndex
The type used to store indices.
Definition: DenseBase.h:58
void resize(Index newSize)
Definition: DenseBase.h:236
random_access_iterator_type const_iterator
Definition: DenseBase.h:612
void swap(PlainObjectBase< OtherDerived > &other)
Definition: DenseBase.h:422
ConstColwiseReturnType colwise() const
Definition: DenseBase.h:552
EIGEN_CONSTEXPR Index innerSize() const
Definition: DenseBase.h:225
internal::traits< Derived >::Scalar Scalar
Definition: DenseBase.h:61
const Replicate< Derived, Dynamic, Dynamic > replicate(Index rowFactor, Index colFactor) const
Definition: DenseBase.h:590
CoeffReturnType value() const
Definition: DenseBase.h:516
Scalar value_type
Definition: DenseBase.h:66
ConstReverseReturnType reverse() const
Definition: DenseBase.h:600
ConstRowwiseReturnType rowwise() const
Definition: DenseBase.h:540
EvalReturnType eval() const
Definition: DenseBase.h:397
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:205
EIGEN_DEPRECATED const Derived & flagged() const
Definition: DenseBase.h:307
EIGEN_DEPRECATED Derived & lazyAssign(const DenseBase< OtherDerived > &other)
random_access_iterator_type iterator
Definition: DenseBase.h:610
void swap(const DenseBase< OtherDerived > &other)
Definition: DenseBase.h:410
Base class providing direct read/write coefficient access to matrices and arrays.
Definition: DenseCoeffsBase.h:559
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: EigenBase.h:65
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: EigenBase.h:62
Enforce aligned packet loads and stores regardless of what is requested.
Definition: ForceAlignedAccess.h:38
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:182
Expression which must be nested by value.
Definition: NestByValue.h:42
Dense storage base class for matrices and arrays.
Definition: PlainObjectBase.h:102
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:65
Expression of the reverse of a vector or matrix.
Definition: Reverse.h:67
Expression of a coefficient wise version of the C++ ternary operator ?:
Definition: Select.h:56
Expression of the transpose of a matrix.
Definition: Transpose.h:56
Pseudo expression providing broadcasting and partial reduction operations.
Definition: VectorwiseOp.h:189
static const lastp1_t end
Definition: IndexedViewHelper.h:183
static const Eigen::internal::all_t all
Definition: IndexedViewHelper.h:189
@ ColMajor
Definition: Constants.h:321
@ RowMajor
Definition: Constants.h:323
@ AutoAlign
Definition: Constants.h:325
const unsigned int DirectAccessBit
Definition: Constants.h:157
const unsigned int RowMajorBit
Definition: Constants.h:68
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:59
Helper class used by the comma initializer operator.
Definition: CommaInitializer.h:31
Definition: EigenBase.h:32
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:41
Definition: Constants.h:524
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:235