Eigen  3.4.90 (git rev 5a9f66fb35d03a4da9ef8976e67a61b30aa16dcf)
 
Loading...
Searching...
No Matches
DenseBase.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2007-2010 Benoit Jacob <[email protected]>
5// Copyright (C) 2008-2010 Gael Guennebaud <[email protected]>
6//
7// This Source Code Form is subject to the terms of the Mozilla
8// Public License v. 2.0. If a copy of the MPL was not distributed
9// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10
11#ifndef EIGEN_DENSEBASE_H
12#define EIGEN_DENSEBASE_H
13
14// IWYU pragma: private
15#include "./InternalHeaderCheck.h"
16
17namespace Eigen {
18
19// The index type defined by EIGEN_DEFAULT_DENSE_INDEX_TYPE must be a signed type.
20EIGEN_STATIC_ASSERT(NumTraits<DenseIndex>::IsSigned, THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE)
21
22
37template <typename Derived>
39#ifndef EIGEN_PARSED_BY_DOXYGEN
40 : public DenseCoeffsBase<Derived, internal::accessors_level<Derived>::value>
41#else
42 : public DenseCoeffsBase<Derived, DirectWriteAccessors>
43#endif // not EIGEN_PARSED_BY_DOXYGEN
44{
45 public:
49 typedef Eigen::InnerIterator<Derived> InnerIterator;
50
51 typedef typename internal::traits<Derived>::StorageKind StorageKind;
52
59 typedef typename internal::traits<Derived>::StorageIndex StorageIndex;
60
62 typedef typename internal::traits<Derived>::Scalar Scalar;
63
68
69 typedef typename NumTraits<Scalar>::Real RealScalar;
70 typedef DenseCoeffsBase<Derived, internal::accessors_level<Derived>::value> Base;
71
72 using Base::coeff;
73 using Base::coeffByOuterInner;
74 using Base::colIndexByOuterInner;
75 using Base::cols;
76 using Base::const_cast_derived;
77 using Base::derived;
78 using Base::rowIndexByOuterInner;
79 using Base::rows;
80 using Base::size;
81 using Base::operator();
82 using Base::operator[];
83 using Base::colStride;
84 using Base::innerStride;
85 using Base::outerStride;
86 using Base::rowStride;
87 using Base::stride;
88 using Base::w;
89 using Base::x;
90 using Base::y;
91 using Base::z;
92 typedef typename Base::CoeffReturnType CoeffReturnType;
93
94 enum {
95
96 RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
102 ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
108 SizeAtCompileTime = (internal::size_of_xpr_at_compile_time<Derived>::ret),
113 MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime,
124 MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime,
135 MaxSizeAtCompileTime = internal::size_at_compile_time(internal::traits<Derived>::MaxRowsAtCompileTime,
136 internal::traits<Derived>::MaxColsAtCompileTime),
148 internal::traits<Derived>::RowsAtCompileTime == 1 || internal::traits<Derived>::ColsAtCompileTime == 1,
154 NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0
155 : bool(IsVectorAtCompileTime) ? 1
156 : 2,
161 Flags = internal::traits<Derived>::Flags,
168 InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? int(SizeAtCompileTime)
169 : int(IsRowMajor) ? int(ColsAtCompileTime)
170 : int(RowsAtCompileTime),
171
172 InnerStrideAtCompileTime = internal::inner_stride_at_compile_time<Derived>::ret,
173 OuterStrideAtCompileTime = internal::outer_stride_at_compile_time<Derived>::ret
174 };
175
176 typedef typename internal::find_best_packet<Scalar, SizeAtCompileTime>::type PacketScalar;
177
178 enum { IsPlainObjectBase = 0 };
179
182 typedef Matrix<typename internal::traits<Derived>::Scalar, internal::traits<Derived>::RowsAtCompileTime,
183 internal::traits<Derived>::ColsAtCompileTime,
184 AutoAlign | (internal::traits<Derived>::Flags & RowMajorBit ? RowMajor : ColMajor),
185 internal::traits<Derived>::MaxRowsAtCompileTime, internal::traits<Derived>::MaxColsAtCompileTime>
187
190 typedef Array<typename internal::traits<Derived>::Scalar, internal::traits<Derived>::RowsAtCompileTime,
191 internal::traits<Derived>::ColsAtCompileTime,
192 AutoAlign | (internal::traits<Derived>::Flags & RowMajorBit ? RowMajor : ColMajor),
193 internal::traits<Derived>::MaxRowsAtCompileTime, internal::traits<Derived>::MaxColsAtCompileTime>
195
202 typedef std::conditional_t<internal::is_same<typename internal::traits<Derived>::XprKind, MatrixXpr>::value,
205
211 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerSize() const {
212 return IsVectorAtCompileTime ? 1 : int(IsRowMajor) ? this->rows() : this->cols();
213 }
214
220 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index innerSize() const {
221 return IsVectorAtCompileTime ? this->size() : int(IsRowMajor) ? this->cols() : this->rows();
222 }
223
228 EIGEN_DEVICE_FUNC void resize(Index newSize) {
229 EIGEN_ONLY_USED_FOR_DEBUG(newSize);
230 eigen_assert(newSize == this->size() && "DenseBase::resize() does not actually allow to resize.");
231 }
236 EIGEN_DEVICE_FUNC void resize(Index rows, Index cols) {
237 EIGEN_ONLY_USED_FOR_DEBUG(rows);
238 EIGEN_ONLY_USED_FOR_DEBUG(cols);
239 eigen_assert(rows == this->rows() && cols == this->cols() &&
240 "DenseBase::resize() does not actually allow to resize.");
241 }
242
243#ifndef EIGEN_PARSED_BY_DOXYGEN
247 EIGEN_DEPRECATED typedef CwiseNullaryOp<internal::linspaced_op<Scalar>, PlainObject> SequentialLinSpacedReturnType;
249 typedef CwiseNullaryOp<internal::linspaced_op<Scalar>, PlainObject> RandomAccessLinSpacedReturnType;
251 typedef CwiseNullaryOp<internal::equalspaced_op<Scalar>, PlainObject> RandomAccessEqualSpacedReturnType;
254 internal::traits<Derived>::ColsAtCompileTime, 1>
255 EigenvaluesReturnType;
256
257#endif // not EIGEN_PARSED_BY_DOXYGEN
258
260 template <typename OtherDerived>
261 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase<OtherDerived>& other);
262
266 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase& other);
267
268 template <typename OtherDerived>
269 EIGEN_DEVICE_FUNC Derived& operator=(const EigenBase<OtherDerived>& other);
270
271 template <typename OtherDerived>
272 EIGEN_DEVICE_FUNC Derived& operator+=(const EigenBase<OtherDerived>& other);
273
274 template <typename OtherDerived>
275 EIGEN_DEVICE_FUNC Derived& operator-=(const EigenBase<OtherDerived>& other);
276
277 template <typename OtherDerived>
278 EIGEN_DEVICE_FUNC Derived& operator=(const ReturnByValue<OtherDerived>& func);
279
282 template <typename OtherDerived>
284 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC Derived& lazyAssign(const DenseBase<OtherDerived>& other);
285
286 EIGEN_DEVICE_FUNC CommaInitializer<Derived> operator<<(const Scalar& s);
287
288 template <unsigned int Added, unsigned int Removed>
290 EIGEN_DEPRECATED const Derived& flagged() const {
291 return derived();
292 }
293
294 template <typename OtherDerived>
295 EIGEN_DEVICE_FUNC CommaInitializer<Derived> operator<<(const DenseBase<OtherDerived>& other);
296
297 typedef Transpose<Derived> TransposeReturnType;
298 EIGEN_DEVICE_FUNC TransposeReturnType transpose();
299 typedef Transpose<const Derived> ConstTransposeReturnType;
300 EIGEN_DEVICE_FUNC const ConstTransposeReturnType transpose() const;
301 EIGEN_DEVICE_FUNC void transposeInPlace();
302
303 EIGEN_DEVICE_FUNC static const ConstantReturnType Constant(Index rows, Index cols, const Scalar& value);
304 EIGEN_DEVICE_FUNC static const ConstantReturnType Constant(Index size, const Scalar& value);
305 EIGEN_DEVICE_FUNC static const ConstantReturnType Constant(const Scalar& value);
306
307 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(Sequential_t, Index size,
308 const Scalar& low,
309 const Scalar& high);
310 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(Sequential_t,
311 const Scalar& low,
312 const Scalar& high);
313
314 EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(Index size, const Scalar& low,
315 const Scalar& high);
316 EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(const Scalar& low, const Scalar& high);
317
318 EIGEN_DEVICE_FUNC static const RandomAccessEqualSpacedReturnType EqualSpaced(Index size, const Scalar& low,
319 const Scalar& step);
320 EIGEN_DEVICE_FUNC static const RandomAccessEqualSpacedReturnType EqualSpaced(const Scalar& low, const Scalar& step);
321
322 template <typename CustomNullaryOp>
324 const CustomNullaryOp& func);
325 template <typename CustomNullaryOp>
327 const CustomNullaryOp& func);
328 template <typename CustomNullaryOp>
329 EIGEN_DEVICE_FUNC static const CwiseNullaryOp<CustomNullaryOp, PlainObject> NullaryExpr(const CustomNullaryOp& func);
330
331 EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(Index rows, Index cols);
332 EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(Index size);
333 EIGEN_DEVICE_FUNC static const ConstantReturnType Zero();
334 EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(Index rows, Index cols);
335 EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(Index size);
336 EIGEN_DEVICE_FUNC static const ConstantReturnType Ones();
337
338 EIGEN_DEVICE_FUNC void fill(const Scalar& value);
339 EIGEN_DEVICE_FUNC Derived& setConstant(const Scalar& value);
340 EIGEN_DEVICE_FUNC Derived& setLinSpaced(Index size, const Scalar& low, const Scalar& high);
341 EIGEN_DEVICE_FUNC Derived& setLinSpaced(const Scalar& low, const Scalar& high);
342 EIGEN_DEVICE_FUNC Derived& setEqualSpaced(Index size, const Scalar& low, const Scalar& step);
343 EIGEN_DEVICE_FUNC Derived& setEqualSpaced(const Scalar& low, const Scalar& step);
344 EIGEN_DEVICE_FUNC Derived& setZero();
345 EIGEN_DEVICE_FUNC Derived& setOnes();
346 EIGEN_DEVICE_FUNC Derived& setRandom();
347
348 template <typename OtherDerived>
349 EIGEN_DEVICE_FUNC bool isApprox(const DenseBase<OtherDerived>& other,
350 const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
351 EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const RealScalar& other,
352 const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
353 template <typename OtherDerived>
354 EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const DenseBase<OtherDerived>& other,
355 const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
356
357 EIGEN_DEVICE_FUNC bool isApproxToConstant(const Scalar& value,
358 const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
359 EIGEN_DEVICE_FUNC bool isConstant(const Scalar& value,
360 const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
361 EIGEN_DEVICE_FUNC bool isZero(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
362 EIGEN_DEVICE_FUNC bool isOnes(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
363
364 EIGEN_DEVICE_FUNC inline bool hasNaN() const;
365 EIGEN_DEVICE_FUNC inline bool allFinite() const;
366
367 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator*=(const Scalar& other);
368 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator/=(const Scalar& other);
369
370 typedef internal::add_const_on_value_type_t<typename internal::eval<Derived>::type> EvalReturnType;
379 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EvalReturnType eval() const {
380 // Even though MSVC does not honor strong inlining when the return type
381 // is a dynamic matrix, we desperately need strong inlining for fixed
382 // size types on MSVC.
383 return typename internal::eval<Derived>::type(derived());
384 }
385
389 template <typename OtherDerived>
390 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void swap(const DenseBase<OtherDerived>& other) {
391 EIGEN_STATIC_ASSERT(!OtherDerived::IsPlainObjectBase, THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY);
392 eigen_assert(rows() == other.rows() && cols() == other.cols());
393 call_assignment(derived(), other.const_cast_derived(), internal::swap_assign_op<Scalar>());
394 }
395
399 template <typename OtherDerived>
400 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void swap(PlainObjectBase<OtherDerived>& other) {
401 eigen_assert(rows() == other.rows() && cols() == other.cols());
402 call_assignment(derived(), other.derived(), internal::swap_assign_op<Scalar>());
403 }
404
405 EIGEN_DEVICE_FUNC inline const NestByValue<Derived> nestByValue() const;
406 EIGEN_DEVICE_FUNC inline const ForceAlignedAccess<Derived> forceAlignedAccess() const;
407 EIGEN_DEVICE_FUNC inline ForceAlignedAccess<Derived> forceAlignedAccess();
408 template <bool Enable>
409 EIGEN_DEVICE_FUNC inline const std::conditional_t<Enable, ForceAlignedAccess<Derived>, Derived&>
410 forceAlignedAccessIf() const;
411 template <bool Enable>
412 EIGEN_DEVICE_FUNC inline std::conditional_t<Enable, ForceAlignedAccess<Derived>, Derived&> forceAlignedAccessIf();
413
414 EIGEN_DEVICE_FUNC Scalar sum() const;
415 EIGEN_DEVICE_FUNC Scalar mean() const;
416 EIGEN_DEVICE_FUNC Scalar trace() const;
417
418 EIGEN_DEVICE_FUNC Scalar prod() const;
419
420 template <int NaNPropagation>
421 EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar minCoeff() const;
422 template <int NaNPropagation>
423 EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar maxCoeff() const;
424
425 // By default, the fastest version with undefined NaN propagation semantics is
426 // used.
427 // TODO(rmlarsen): Replace with default template argument when we move to
428 // c++11 or beyond.
429 EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Scalar minCoeff() const {
431 }
432 EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Scalar maxCoeff() const {
434 }
435
436 template <int NaNPropagation, typename IndexType>
437 EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar minCoeff(IndexType* row, IndexType* col) const;
438 template <int NaNPropagation, typename IndexType>
439 EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar maxCoeff(IndexType* row, IndexType* col) const;
440 template <int NaNPropagation, typename IndexType>
441 EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar minCoeff(IndexType* index) const;
442 template <int NaNPropagation, typename IndexType>
443 EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar maxCoeff(IndexType* index) const;
444
445 // TODO(rmlarsen): Replace these methods with a default template argument.
446 template <typename IndexType>
447 EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Scalar minCoeff(IndexType* row, IndexType* col) const {
448 return minCoeff<PropagateFast>(row, col);
449 }
450 template <typename IndexType>
451 EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Scalar maxCoeff(IndexType* row, IndexType* col) const {
452 return maxCoeff<PropagateFast>(row, col);
453 }
454 template <typename IndexType>
455 EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Scalar minCoeff(IndexType* index) const {
456 return minCoeff<PropagateFast>(index);
457 }
458 template <typename IndexType>
459 EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Scalar maxCoeff(IndexType* index) const {
460 return maxCoeff<PropagateFast>(index);
461 }
462
463 template <typename BinaryOp>
464 EIGEN_DEVICE_FUNC Scalar redux(const BinaryOp& func) const;
465
466 template <typename Visitor>
467 EIGEN_DEVICE_FUNC void visit(Visitor& func) const;
468
476 inline const WithFormat<Derived> format(const IOFormat& fmt) const { return WithFormat<Derived>(derived(), fmt); }
477
479 EIGEN_DEVICE_FUNC CoeffReturnType value() const {
480 EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) eigen_assert(this->rows() == 1 && this->cols() == 1);
481 return derived().coeff(0, 0);
482 }
483
484 EIGEN_DEVICE_FUNC bool all() const;
485 EIGEN_DEVICE_FUNC bool any() const;
486 EIGEN_DEVICE_FUNC Index count() const;
487
488 typedef VectorwiseOp<Derived, Horizontal> RowwiseReturnType;
489 typedef const VectorwiseOp<const Derived, Horizontal> ConstRowwiseReturnType;
490 typedef VectorwiseOp<Derived, Vertical> ColwiseReturnType;
491 typedef const VectorwiseOp<const Derived, Vertical> ConstColwiseReturnType;
492
500 // Code moved here due to a CUDA compiler bug
501 EIGEN_DEVICE_FUNC inline ConstRowwiseReturnType rowwise() const { return ConstRowwiseReturnType(derived()); }
502 EIGEN_DEVICE_FUNC RowwiseReturnType rowwise();
503
511 EIGEN_DEVICE_FUNC inline ConstColwiseReturnType colwise() const { return ConstColwiseReturnType(derived()); }
512 EIGEN_DEVICE_FUNC ColwiseReturnType colwise();
513
515 static const RandomReturnType Random(Index rows, Index cols);
516 static const RandomReturnType Random(Index size);
517 static const RandomReturnType Random();
518
519 template <typename ThenDerived, typename ElseDerived>
520 inline EIGEN_DEVICE_FUNC
522 typename DenseBase<ElseDerived>::Scalar, Scalar>,
523 ThenDerived, ElseDerived, Derived>
524 select(const DenseBase<ThenDerived>& thenMatrix, const DenseBase<ElseDerived>& elseMatrix) const;
525
526 template <typename ThenDerived>
527 inline EIGEN_DEVICE_FUNC
529 typename DenseBase<ThenDerived>::Scalar, Scalar>,
530 ThenDerived, typename DenseBase<ThenDerived>::ConstantReturnType, Derived>
531 select(const DenseBase<ThenDerived>& thenMatrix, const typename DenseBase<ThenDerived>::Scalar& elseScalar) const;
532
533 template <typename ElseDerived>
534 inline EIGEN_DEVICE_FUNC
536 typename DenseBase<ElseDerived>::Scalar, Scalar>,
537 typename DenseBase<ElseDerived>::ConstantReturnType, ElseDerived, Derived>
538 select(const typename DenseBase<ElseDerived>::Scalar& thenScalar, const DenseBase<ElseDerived>& elseMatrix) const;
539
540 template <int p>
541 RealScalar lpNorm() const;
542
543 template <int RowFactor, int ColFactor>
544 EIGEN_DEVICE_FUNC const Replicate<Derived, RowFactor, ColFactor> replicate() const;
553 // Code moved here due to a CUDA compiler bug
554 EIGEN_DEVICE_FUNC const Replicate<Derived, Dynamic, Dynamic> replicate(Index rowFactor, Index colFactor) const {
555 return Replicate<Derived, Dynamic, Dynamic>(derived(), rowFactor, colFactor);
556 }
557
558 typedef Reverse<Derived, BothDirections> ReverseReturnType;
559 typedef const Reverse<const Derived, BothDirections> ConstReverseReturnType;
560 EIGEN_DEVICE_FUNC ReverseReturnType reverse();
562 // Code moved here due to a CUDA compiler bug
563 EIGEN_DEVICE_FUNC ConstReverseReturnType reverse() const { return ConstReverseReturnType(derived()); }
564 EIGEN_DEVICE_FUNC void reverseInPlace();
565
566#ifdef EIGEN_PARSED_BY_DOXYGEN
570 typedef random_access_iterator_type iterator;
572 typedef random_access_iterator_type const_iterator;
573#else
574 typedef std::conditional_t<(Flags & DirectAccessBit) == DirectAccessBit,
575 internal::pointer_based_stl_iterator<Derived>,
576 internal::generic_randaccess_stl_iterator<Derived> >
577 iterator_type;
578
579 typedef std::conditional_t<(Flags & DirectAccessBit) == DirectAccessBit,
580 internal::pointer_based_stl_iterator<const Derived>,
581 internal::generic_randaccess_stl_iterator<const Derived> >
582 const_iterator_type;
583
584 // Stl-style iterators are supported only for vectors.
585
586 typedef std::conditional_t<IsVectorAtCompileTime, iterator_type, void> iterator;
587
588 typedef std::conditional_t<IsVectorAtCompileTime, const_iterator_type, void> const_iterator;
589#endif
590
591 inline iterator begin();
592 inline const_iterator begin() const;
593 inline const_iterator cbegin() const;
594 inline iterator end();
595 inline const_iterator end() const;
596 inline const_iterator cend() const;
597
598#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase
599#define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
600#define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND)
601#define EIGEN_DOC_UNARY_ADDONS(X, Y)
602#include "../plugins/CommonCwiseUnaryOps.inc"
603#include "../plugins/BlockMethods.inc"
604#include "../plugins/IndexedViewMethods.inc"
605#include "../plugins/ReshapedMethods.inc"
606#ifdef EIGEN_DENSEBASE_PLUGIN
607#include EIGEN_DENSEBASE_PLUGIN
608#endif
609#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
610#undef EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
611#undef EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF
612#undef EIGEN_DOC_UNARY_ADDONS
613
614 // disable the use of evalTo for dense objects with a nice compilation error
615 template <typename Dest>
616 EIGEN_DEVICE_FUNC inline void evalTo(Dest&) const {
617 EIGEN_STATIC_ASSERT((internal::is_same<Dest, void>::value),
618 THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS);
619 }
620
621 protected:
622 EIGEN_DEFAULT_COPY_CONSTRUCTOR(DenseBase)
624#ifdef EIGEN_INTERNAL_DEBUGGING
625 EIGEN_DEVICE_FUNC constexpr DenseBase() {
626 /* Just checks for self-consistency of the flags.
627 * Only do it when debugging Eigen, as this borders on paranoia and could slow compilation down
628 */
629 EIGEN_STATIC_ASSERT(
630 (internal::check_implication(MaxRowsAtCompileTime == 1 && MaxColsAtCompileTime != 1, int(IsRowMajor)) &&
631 internal::check_implication(MaxColsAtCompileTime == 1 && MaxRowsAtCompileTime != 1, int(!IsRowMajor))),
632 INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION)
633 }
634#else
635 EIGEN_DEVICE_FUNC constexpr DenseBase() = default;
636#endif
637
638 private:
639 EIGEN_DEVICE_FUNC explicit DenseBase(int);
640 EIGEN_DEVICE_FUNC DenseBase(int, int);
641 template <typename OtherDerived>
642 EIGEN_DEVICE_FUNC explicit DenseBase(const DenseBase<OtherDerived>&);
643};
644
645} // end namespace Eigen
646
647#endif // EIGEN_DENSEBASE_H
General-purpose arrays with easy API for coefficient-wise operations.
Definition Array.h:48
Generic expression of a matrix where all coefficients are defined by a functor.
Definition CwiseNullaryOp.h:64
Generic expression where a coefficient-wise ternary operator is applied to two expressions.
Definition CwiseTernaryOp.h:86
Base class for all dense matrices, vectors, and arrays.
Definition DenseBase.h:44
EIGEN_CONSTEXPR Index outerSize() const
Definition DenseBase.h:211
internal::traits< Derived >::Scalar minCoeff() const
Definition Redux.h:457
CommaInitializer< Derived > operator<<(const Scalar &s)
Definition CommaInitializer.h:135
const WithFormat< Derived > format(const IOFormat &fmt) const
Definition DenseBase.h:476
static EIGEN_DEPRECATED const RandomAccessLinSpacedReturnType LinSpaced(Sequential_t, Index size, const Scalar &low, const Scalar &high)
Definition CwiseNullaryOp.h:236
bool isConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:326
Scalar mean() const
Definition Redux.h:491
Derived & setOnes()
Definition CwiseNullaryOp.h:688
void resize(Index rows, Index cols)
Definition DenseBase.h:236
std::conditional_t< internal::is_same< typename internal::traits< Derived >::XprKind, MatrixXpr >::value, PlainMatrix, PlainArray > PlainObject
The plain matrix or array type corresponding to this expression.
Definition DenseBase.h:204
static const ConstantReturnType Ones()
Definition CwiseNullaryOp.h:663
internal::traits< Derived >::StorageIndex StorageIndex
The type used to store indices.
Definition DenseBase.h:59
void resize(Index newSize)
Definition DenseBase.h:228
random_access_iterator_type const_iterator
Definition DenseBase.h:572
static const CwiseNullaryOp< CustomNullaryOp, PlainObject > NullaryExpr(Index rows, Index cols, const CustomNullaryOp &func)
Definition CwiseNullaryOp.h:108
ReverseReturnType reverse()
Definition Reverse.h:110
const NestByValue< Derived > nestByValue() const
Definition NestByValue.h:74
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
void visit(Visitor &func) const
Definition Visitor.h:382
static const ConstantReturnType Zero()
Definition CwiseNullaryOp.h:520
TransposeReturnType transpose()
Definition Transpose.h:160
void swap(PlainObjectBase< OtherDerived > &other)
Definition DenseBase.h:400
iterator begin()
Definition StlIterators.h:565
ConstColwiseReturnType colwise() const
Definition DenseBase.h:511
EIGEN_CONSTEXPR Index innerSize() const
Definition DenseBase.h:220
Derived & setLinSpaced(Index size, const Scalar &low, const Scalar &high)
Sets a linearly spaced vector.
Definition CwiseNullaryOp.h:427
internal::traits< Derived >::Scalar Scalar
Definition DenseBase.h:62
const Replicate< Derived, RowFactor, ColFactor > replicate() const
Definition Replicate.h:109
static const ConstantReturnType Constant(Index rows, Index cols, const Scalar &value)
Definition CwiseNullaryOp.h:182
const Replicate< Derived, Dynamic, Dynamic > replicate(Index rowFactor, Index colFactor) const
Definition DenseBase.h:554
internal::traits< Derived >::Scalar maxCoeff() const
Definition Redux.h:470
CoeffReturnType value() const
Definition DenseBase.h:479
Scalar value_type
Definition DenseBase.h:67
void fill(const Scalar &value)
Definition CwiseNullaryOp.h:335
ConstReverseReturnType reverse() const
Definition DenseBase.h:563
constexpr DenseBase()=default
ConstRowwiseReturnType rowwise() const
Definition DenseBase.h:501
bool isOnes(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:676
EvalReturnType eval() const
Definition DenseBase.h:379
Derived & operator=(const DenseBase< OtherDerived > &other)
Definition Assign.h:39
Index count() const
Definition Visitor.h:765
bool any() const
Definition Visitor.h:752
Derived & setConstant(const Scalar &value)
Definition CwiseNullaryOp.h:345
Derived & setRandom()
Definition Random.h:129
void transposeInPlace()
Definition Transpose.h:318
@ IsVectorAtCompileTime
Definition DenseBase.h:147
@ SizeAtCompileTime
Definition DenseBase.h:108
@ MaxSizeAtCompileTime
Definition DenseBase.h:135
@ IsRowMajor
Definition DenseBase.h:166
@ NumDimensions
Definition DenseBase.h:154
@ Flags
Definition DenseBase.h:161
@ ColsAtCompileTime
Definition DenseBase.h:102
@ MaxColsAtCompileTime
Definition DenseBase.h:124
@ MaxRowsAtCompileTime
Definition DenseBase.h:113
@ RowsAtCompileTime
Definition DenseBase.h:96
void reverseInPlace()
Definition Reverse.h:129
Scalar sum() const
Definition Redux.h:481
EIGEN_DEPRECATED const Derived & flagged() const
Definition DenseBase.h:290
bool all() const
Definition Visitor.h:739
iterator end()
Definition StlIterators.h:591
static const RandomReturnType Random()
Definition Random.h:112
bool isApprox(const DenseBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition Fuzzy.h:89
const_iterator cbegin() const
Definition StlIterators.h:581
const_iterator cend() const
Definition StlIterators.h:607
Scalar prod() const
Definition Redux.h:510
EIGEN_DEPRECATED Derived & lazyAssign(const DenseBase< OtherDerived > &other)
bool allFinite() const
Definition Visitor.h:783
Derived & setZero()
Definition CwiseNullaryOp.h:549
bool isZero(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:533
random_access_iterator_type iterator
Definition DenseBase.h:570
bool isApproxToConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:314
void swap(const DenseBase< OtherDerived > &other)
Definition DenseBase.h:390
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition EigenBase.h:61
Derived & derived()
Definition EigenBase.h:49
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition EigenBase.h:59
EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT
Definition EigenBase.h:64
Enforce aligned packet loads and stores regardless of what is requested.
Definition ForceAlignedAccess.h:37
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:186
Expression which must be nested by value.
Definition NestByValue.h:39
Dense storage base class for matrices and arrays.
Definition PlainObjectBase.h:121
Expression of the multiple replication of a matrix or vector.
Definition Replicate.h:64
Expression of the reverse of a vector or matrix.
Definition Reverse.h:65
Expression of the transpose of a matrix.
Definition Transpose.h:56
Pseudo expression providing broadcasting and partial reduction operations.
Definition VectorwiseOp.h:192
Pseudo expression providing matrix output with given format.
Definition IO.h:101
@ ColMajor
Definition Constants.h:318
@ RowMajor
Definition Constants.h:320
@ AutoAlign
Definition Constants.h:322
const unsigned int DirectAccessBit
Definition Constants.h:159
const unsigned int RowMajorBit
Definition Constants.h:70
Namespace containing all symbols from the Eigen library.
Definition Core:137
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:83
Helper class used by the comma initializer operator.
Definition CommaInitializer.h:31
Definition EigenBase.h:33
Stores a set of parameters controlling the way matrices are printed.
Definition IO.h:52
Definition Constants.h:531
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition Meta.h:523