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
46 #endif // not EIGEN_PARSED_BY_DOXYGEN 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;
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 };
191 internal::traits<Derived>::RowsAtCompileTime,
192 internal::traits<Derived>::ColsAtCompileTime,
220 return IsVectorAtCompileTime ? 1
221 : int(IsRowMajor) ? this->rows() : this->cols();
232 return IsVectorAtCompileTime ? this->size()
233 : int(IsRowMajor) ? this->cols() : this->rows();
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
281 Derived& operator=(
const DenseBase& other);
283 template<
typename OtherDerived>
287 template<
typename OtherDerived>
291 template<
typename OtherDerived>
295 template<
typename OtherDerived>
302 template<
typename OtherDerived>
310 template<
unsigned int Added,
unsigned int Removed>
313 {
return derived(); }
315 template<
typename OtherDerived>
321 TransposeReturnType transpose();
324 ConstTransposeReturnType transpose()
const;
326 void transposeInPlace();
328 EIGEN_DEVICE_FUNC
static const ConstantReturnType
330 EIGEN_DEVICE_FUNC
static const ConstantReturnType
331 Constant(
Index size,
const Scalar& value);
332 EIGEN_DEVICE_FUNC
static const ConstantReturnType
333 Constant(
const Scalar& value);
335 EIGEN_DEVICE_FUNC
static const SequentialLinSpacedReturnType
336 LinSpaced(Sequential_t,
Index size,
const Scalar& low,
const Scalar& high);
337 EIGEN_DEVICE_FUNC
static const RandomAccessLinSpacedReturnType
338 LinSpaced(
Index size,
const Scalar& low,
const Scalar& high);
339 EIGEN_DEVICE_FUNC
static const SequentialLinSpacedReturnType
340 LinSpaced(Sequential_t,
const Scalar& low,
const Scalar& high);
341 EIGEN_DEVICE_FUNC
static const RandomAccessLinSpacedReturnType
342 LinSpaced(
const Scalar& low,
const Scalar& high);
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);
354 EIGEN_DEVICE_FUNC
static const ConstantReturnType Zero(
Index rows,
Index cols);
355 EIGEN_DEVICE_FUNC
static const ConstantReturnType Zero(
Index size);
356 EIGEN_DEVICE_FUNC
static const ConstantReturnType Zero();
357 EIGEN_DEVICE_FUNC
static const ConstantReturnType Ones(
Index rows,
Index cols);
358 EIGEN_DEVICE_FUNC
static const ConstantReturnType Ones(
Index size);
359 EIGEN_DEVICE_FUNC
static const ConstantReturnType Ones();
361 EIGEN_DEVICE_FUNC
void fill(
const Scalar& value);
362 EIGEN_DEVICE_FUNC Derived& setConstant(
const Scalar& value);
363 EIGEN_DEVICE_FUNC Derived& setLinSpaced(
Index size,
const Scalar& low,
const Scalar& high);
364 EIGEN_DEVICE_FUNC Derived& setLinSpaced(
const Scalar& low,
const Scalar& high);
365 EIGEN_DEVICE_FUNC Derived& setZero();
366 EIGEN_DEVICE_FUNC Derived& setOnes();
367 EIGEN_DEVICE_FUNC Derived& setRandom();
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;
385 inline bool allFinite()
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);
401 EIGEN_STRONG_INLINE EvalReturnType
eval()
const 412 template<
typename OtherDerived>
416 EIGEN_STATIC_ASSERT(!OtherDerived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY);
417 eigen_assert(rows()==other.rows() && cols()==other.cols());
424 template<
typename OtherDerived>
428 eigen_assert(rows()==other.rows() && cols()==other.cols());
435 template<
bool Enable> EIGEN_DEVICE_FUNC
437 template<
bool Enable> EIGEN_DEVICE_FUNC
438 inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf();
440 EIGEN_DEVICE_FUNC Scalar sum()
const;
441 EIGEN_DEVICE_FUNC Scalar mean()
const;
442 EIGEN_DEVICE_FUNC Scalar trace()
const;
444 EIGEN_DEVICE_FUNC Scalar prod()
const;
449 template<
typename IndexType> EIGEN_DEVICE_FUNC
451 template<
typename IndexType> EIGEN_DEVICE_FUNC
453 template<
typename IndexType> EIGEN_DEVICE_FUNC
455 template<
typename IndexType> EIGEN_DEVICE_FUNC
458 template<
typename BinaryOp>
460 Scalar redux(
const BinaryOp&
func)
const;
462 template<
typename Visitor>
464 void visit(Visitor&
func)
const;
472 EIGEN_STATIC_ASSERT_SIZE_1x1(Derived)
473 eigen_assert(this->rows() == 1 && this->cols() == 1);
474 return derived().coeff(0,0);
494 EIGEN_DEVICE_FUNC
inline ConstRowwiseReturnType
rowwise()
const {
495 return ConstRowwiseReturnType(derived());
497 EIGEN_DEVICE_FUNC RowwiseReturnType rowwise();
506 EIGEN_DEVICE_FUNC
inline ConstColwiseReturnType
colwise()
const {
507 return ConstColwiseReturnType(derived());
509 EIGEN_DEVICE_FUNC ColwiseReturnType colwise();
512 static const RandomReturnType Random(
Index rows,
Index cols);
513 static const RandomReturnType Random(
Index size);
514 static const RandomReturnType Random();
516 template<
typename ThenDerived,
typename ElseDerived>
521 template<
typename ThenDerived>
525 template<
typename ElseDerived>
529 template<
int p> RealScalar lpNorm()
const;
531 template<
int RowFactor,
int ColFactor>
551 EIGEN_DEVICE_FUNC ReverseReturnType reverse();
554 EIGEN_DEVICE_FUNC ConstReverseReturnType
reverse()
const 556 return ConstReverseReturnType(derived());
558 EIGEN_DEVICE_FUNC
void reverseInPlace();
560 #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase 561 #define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL 562 #define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND) 563 # include "../plugins/BlockMethods.h" 564 # ifdef EIGEN_DENSEBASE_PLUGIN 565 # include EIGEN_DENSEBASE_PLUGIN 567 #undef EIGEN_CURRENT_STORAGE_BASE_CLASS 568 #undef EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL 569 #undef EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF 572 template<
typename Dest>
574 inline void evalTo(Dest& )
const 586 #ifdef EIGEN_INTERNAL_DEBUGGING 587 EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1,
int(IsRowMajor))
588 && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1,
int(!IsRowMajor))),
589 INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION)
594 EIGEN_DEVICE_FUNC
explicit DenseBase(
int);
601 #endif // EIGEN_DENSEBASE_H Generic expression of a matrix where all coefficients are defined by a functor.
Definition: CwiseNullaryOp.h:60
EIGEN_DEVICE_FUNC ConstReverseReturnType reverse() const
This is the const version of reverse().
Definition: DenseBase.h:554
Enforce aligned packet loads and stores regardless of what is requested.
Definition: ForceAlignedAccess.h:34
internal::traits< Derived >::Scalar Scalar
The numeric type of the expression' coefficients, e.g.
Definition: DenseBase.h:66
Storage order is column major (see TopicStorageOrders).
Definition: Constants.h:320
EIGEN_DEVICE_FUNC DenseBase()
Default constructor.
Definition: DenseBase.h:581
EIGEN_DEVICE_FUNC Index outerSize() const
Definition: DenseBase.h:218
Definition: AssignmentFunctors.h:142
EIGEN_DEVICE_FUNC ConstColwiseReturnType colwise() const
Definition: DenseBase.h:506
Expression of the transpose of a matrix.
Definition: Transpose.h:52
EIGEN_DEVICE_FUNC void swap(const DenseBase< OtherDerived > &other)
swaps *this with the expression other.
Definition: DenseBase.h:414
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:85
Scalar value_type
The numeric type of the expression' coefficients, e.g.
Definition: DenseBase.h:71
EIGEN_DEVICE_FUNC CoeffReturnType value() const
Definition: DenseBase.h:470
Holds information about the various numeric (i.e.
Definition: NumTraits.h:150
Definition: ForwardDeclarations.h:54
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:241
Pseudo expression providing partial reduction operations.
Definition: ForwardDeclarations.h:245
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:61
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:41
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
Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor Matrix...
Definition: EigenBase.h:28
The type used to identify a matrix expression.
Definition: Constants.h:506
Definition: ReturnByValue.h:50
Align the matrix itself if it is vectorizable fixed-size.
Definition: Constants.h:324
EIGEN_DEVICE_FUNC const Replicate< Derived, Dynamic, Dynamic > replicate(Index rowFactor, Index colFactor) const
Definition: DenseBase.h:544
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:92
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:61
EIGEN_DEVICE_FUNC ConstRowwiseReturnType rowwise() const
Definition: DenseBase.h:494
EIGEN_DEVICE_FUNC Index nonZeros() const
Definition: DenseBase.h:210
EIGEN_DEPRECATED const Derived & flagged() const
Definition: DenseBase.h:312
Expression which must be nested by value.
Definition: NestByValue.h:34
EIGEN_DEVICE_FUNC void swap(PlainObjectBase< OtherDerived > &other)
swaps *this with the matrix or array other.
Definition: DenseBase.h:426
EIGEN_DEVICE_FUNC Index innerSize() const
Definition: DenseBase.h:230
Definition: benchGeometry.cpp:23
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:252
Definition: BandTriangularSolver.h:13
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
General-purpose arrays with easy API for coefficient-wise operations.
Definition: Array.h:45
Storage order is row major (see TopicStorageOrders).
Definition: Constants.h:322
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EvalReturnType eval() const
Definition: DenseBase.h:401
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:178
Expression of the reverse of a vector or matrix.
Definition: Reverse.h:63
Definition: ForwardDeclarations.h:17
Definition: XprHelper.h:312
Definition: XprHelper.h:261
Eigen::InnerIterator< Derived > InnerIterator
Inner iterator type to iterate over the coefficients of a row or column.
Definition: DenseBase.h:53
Expression of a coefficient wise version of the C++ ternary operator ?:
Definition: Select.h:52
An InnerIterator allows to loop over the element of any matrix expression.
Definition: CoreIterators.h:33