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 internal::special_scalar_op_base<Derived, typename internal::traits<Derived>::Scalar,
44 typename NumTraits<typename internal::traits<Derived>::Scalar>::Real,
45 DenseCoeffsBase<Derived> >
47 :
public DenseCoeffsBase<Derived>
48 #endif // not EIGEN_PARSED_BY_DOXYGEN
54 typedef typename internal::traits<Derived>::StorageKind StorageKind;
60 typedef typename internal::traits<Derived>::Index
Index;
62 typedef typename internal::traits<Derived>::Scalar Scalar;
63 typedef typename internal::packet_traits<Scalar>::type PacketScalar;
65 typedef internal::special_scalar_op_base<Derived,Scalar,RealScalar, DenseCoeffsBase<Derived> > Base;
67 using Base::operator*;
69 using Base::const_cast_derived;
73 using Base::rowIndexByOuterInner;
74 using Base::colIndexByOuterInner;
76 using Base::coeffByOuterInner;
78 using Base::packetByOuterInner;
79 using Base::writePacket;
80 using Base::writePacketByOuterInner;
82 using Base::coeffRefByOuterInner;
83 using Base::copyCoeff;
84 using Base::copyCoeffByOuterInner;
85 using Base::copyPacket;
86 using Base::copyPacketByOuterInner;
87 using Base::operator();
88 using Base::operator[];
94 using Base::innerStride;
95 using Base::outerStride;
96 using Base::rowStride;
97 using Base::colStride;
98 typedef typename Base::CoeffReturnType CoeffReturnType;
115 SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
116 internal::traits<Derived>::ColsAtCompileTime>::ret),
144 internal::traits<Derived>::MaxColsAtCompileTime>::ret),
156 || internal::traits<Derived>::MaxColsAtCompileTime == 1,
162 Flags = internal::traits<Derived>::Flags,
177 InnerStrideAtCompileTime = internal::inner_stride_at_compile_time<Derived>::ret,
178 OuterStrideAtCompileTime = internal::outer_stride_at_compile_time<Derived>::ret
181 enum { ThisConstantIsPrivateInPlainObjectBase };
195 : int(
IsRowMajor) ? this->rows() : this->cols();
206 : int(
IsRowMajor) ? this->cols() : this->rows();
215 EIGEN_ONLY_USED_FOR_DEBUG(newSize);
216 eigen_assert(newSize == this->size()
217 &&
"DenseBase::resize() does not actually allow to resize.");
225 EIGEN_ONLY_USED_FOR_DEBUG(nbRows);
226 EIGEN_ONLY_USED_FOR_DEBUG(nbCols);
227 eigen_assert(nbRows == this->rows() && nbCols == this->cols()
228 &&
"DenseBase::resize() does not actually allow to resize.");
231 #ifndef EIGEN_PARSED_BY_DOXYGEN
242 #endif // not EIGEN_PARSED_BY_DOXYGEN
245 template<
typename OtherDerived>
253 template<
typename OtherDerived>
256 template<
typename OtherDerived>
259 template<
typename OtherDerived>
262 template<
typename OtherDerived>
263 Derived&
operator=(
const ReturnByValue<OtherDerived>& func);
266 template<
typename OtherDerived>
270 template<
typename OtherDerived>
271 Derived& lazyAssign(
const ReturnByValue<OtherDerived>& other);
275 template<
unsigned int Added,
unsigned int Removed>
276 const Flagged<Derived, Added, Removed>
flagged()
const;
278 template<
typename OtherDerived>
285 #ifndef EIGEN_NO_DEBUG
287 template<
typename OtherDerived>
288 void checkTransposeAliasing(
const OtherDerived& other)
const;
293 static const ConstantReturnType
295 static const ConstantReturnType
297 static const ConstantReturnType
300 static const SequentialLinSpacedReturnType
301 LinSpaced(Sequential_t,
Index size,
const Scalar& low,
const Scalar& high);
302 static const RandomAccessLinSpacedReturnType
304 static const SequentialLinSpacedReturnType
305 LinSpaced(Sequential_t,
const Scalar& low,
const Scalar& high);
306 static const RandomAccessLinSpacedReturnType
309 template<
typename CustomNullaryOp>
312 template<
typename CustomNullaryOp>
315 template<
typename CustomNullaryOp>
320 static const ConstantReturnType
Zero(
Index size);
321 static const ConstantReturnType
Zero();
323 static const ConstantReturnType
Ones(
Index size);
324 static const ConstantReturnType
Ones();
329 Derived&
setLinSpaced(
const Scalar& low,
const Scalar& high);
334 template<
typename OtherDerived>
337 bool isMuchSmallerThan(
const RealScalar& other,
339 template<
typename OtherDerived>
348 inline bool hasNaN()
const;
351 inline Derived& operator*=(
const Scalar& other);
352 inline Derived& operator/=(
const Scalar& other);
354 typedef typename internal::add_const_on_value_type<typename internal::eval<Derived>::type>::type EvalReturnType;
360 EIGEN_STRONG_INLINE EvalReturnType
eval()
const
365 return typename internal::eval<Derived>::type(derived());
371 template<
typename OtherDerived>
373 int = OtherDerived::ThisConstantIsPrivateInPlainObjectBase)
375 SwapWrapper<Derived>(derived()).lazyAssign(other.derived());
381 template<
typename OtherDerived>
384 SwapWrapper<Derived>(derived()).lazyAssign(other.derived());
391 template<
bool Enable>
inline const typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf()
const;
392 template<
bool Enable>
inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf();
396 Scalar trace()
const;
400 typename internal::traits<Derived>::Scalar
minCoeff()
const;
401 typename internal::traits<Derived>::Scalar
maxCoeff()
const;
403 template<
typename IndexType>
404 typename internal::traits<Derived>::Scalar
minCoeff(IndexType*
row, IndexType*
col)
const;
405 template<
typename IndexType>
406 typename internal::traits<Derived>::Scalar
maxCoeff(IndexType*
row, IndexType*
col)
const;
407 template<
typename IndexType>
408 typename internal::traits<Derived>::Scalar
minCoeff(IndexType* index)
const;
409 template<
typename IndexType>
410 typename internal::traits<Derived>::Scalar
maxCoeff(IndexType* index)
const;
412 template<
typename BinaryOp>
413 typename internal::result_of<BinaryOp(typename internal::traits<Derived>::Scalar)>::type
414 redux(
const BinaryOp& func)
const;
416 template<
typename Visitor>
417 void visit(Visitor& func)
const;
424 EIGEN_STATIC_ASSERT_SIZE_1x1(Derived)
425 eigen_assert(this->rows() == 1 && this->cols() == 1);
426 return derived().coeff(0,0);
430 bool any(
void)
const;
438 ConstRowwiseReturnType
rowwise()
const;
440 ConstColwiseReturnType
colwise()
const;
447 template<
typename ThenDerived,
typename ElseDerived>
452 template<
typename ThenDerived>
456 template<
typename ElseDerived>
460 template<
int p> RealScalar lpNorm()
const;
462 template<
int RowFactor,
int ColFactor>
471 ConstReverseReturnType
reverse()
const;
474 #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase
475 # include "../plugins/BlockMethods.h"
476 # ifdef EIGEN_DENSEBASE_PLUGIN
477 # include EIGEN_DENSEBASE_PLUGIN
479 #undef EIGEN_CURRENT_STORAGE_BASE_CLASS
481 #ifdef EIGEN2_SUPPORT
485 template<
int CRows,
int CCols>
487 template<
int CRows,
int CCols>
490 #endif // EIGEN2_SUPPORT
494 template<
typename Dest>
inline void evalTo(Dest& )
const
496 EIGEN_STATIC_ASSERT((internal::is_same<Dest,void>::value),THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS);
506 #ifdef EIGEN_INTERNAL_DEBUGGING
509 INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION)
521 #endif // EIGEN_DENSEBASE_H
Generic expression of a matrix where all coefficients are defined by a functor.
Definition: CwiseNullaryOp.h:49
void resize(Index newSize)
Definition: DenseBase.h:213
Derived & setRandom()
Definition: Random.h:110
RowXpr row(Index i)
Definition: DenseBase.h:750
static const CwiseNullaryOp< CustomNullaryOp, Derived > NullaryExpr(Index rows, Index cols, const CustomNullaryOp &func)
Definition: CwiseNullaryOp.h:117
const Select< Derived, ThenDerived, ElseDerived > select(const DenseBase< ThenDerived > &thenMatrix, const DenseBase< ElseDerived > &elseMatrix) const
Definition: Select.h:124
Enforce aligned packet loads and stores regardless of what is requested.
Definition: ForceAlignedAccess.h:34
Scalar mean() const
Definition: Redux.h:373
ReverseReturnType reverse()
Definition: Reverse.h:191
internal::traits< Derived >::Scalar minCoeff() const
Definition: Redux.h:339
bool isApprox(const DenseBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: Fuzzy.h:98
void visit(Visitor &func) const
Definition: Visitor.h:77
Index nonZeros() const
Definition: DenseBase.h:185
Scalar prod() const
Definition: Redux.h:387
void fill(const Scalar &value)
Definition: CwiseNullaryOp.h:322
Expression of the transpose of a matrix.
Definition: Transpose.h:57
Derived & setOnes()
Definition: CwiseNullaryOp.h:625
Derived & operator=(const DenseBase< OtherDerived > &other)
Definition: Assign.h:550
bool hasNaN() const
Definition: BooleanRedux.h:137
bool any(void) const
Definition: BooleanRedux.h:103
CornerType
Definition: Constants.h:201
void resize(Index nbRows, Index nbCols)
Definition: DenseBase.h:223
void swap(const DenseBase< OtherDerived > &other, int=OtherDerived::ThisConstantIsPrivateInPlainObjectBase)
Definition: DenseBase.h:372
DenseBase()
Definition: DenseBase.h:501
Derived & setZero()
Definition: CwiseNullaryOp.h:499
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:88
Index count() const
Definition: BooleanRedux.h:127
internal::traits< Derived >::Scalar maxCoeff() const
Definition: Redux.h:349
Pseudo expression providing partial reduction operations.
Definition: ForwardDeclarations.h:212
bool isZero(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: CwiseNullaryOp.h:482
ColXpr col(Index i)
Definition: DenseBase.h:733
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:41
Definition: DenseBase.h:162
bool all(void) const
Definition: BooleanRedux.h:79
bool allFinite() const
Definition: BooleanRedux.h:147
Helper class used by the comma initializer operator.
Definition: CommaInitializer.h:28
Definition: EigenBase.h:26
void swap(PlainObjectBase< OtherDerived > &other)
Definition: DenseBase.h:382
void reverseInPlace()
Definition: Reverse.h:217
Definition: DenseBase.h:172
bool isApproxToConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: CwiseNullaryOp.h:298
Definition: DenseBase.h:155
Derived & setLinSpaced(Index size, const Scalar &low, const Scalar &high)
Sets a linearly space vector.
Definition: CwiseNullaryOp.h:387
Definition: DenseBase.h:108
Derived & setConstant(const Scalar &value)
Definition: CwiseNullaryOp.h:332
CommaInitializer< Derived > operator<<(const Scalar &s)
Definition: CommaInitializer.h:138
Scalar sum() const
Definition: Redux.h:360
static const CwiseNullaryOp< internal::scalar_random_op< Scalar >, Derived > Random()
Definition: Random.h:97
Dense storage base class for matrices and arrays.
Definition: PlainObjectBase.h:85
const NestByValue< Derived > nestByValue() const
Definition: NestByValue.h:104
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:62
Index innerSize() const
Definition: DenseBase.h:203
Expression which must be nested by value.
Definition: NestByValue.h:35
Definition: DenseBase.h:167
Definition: DenseBase.h:132
internal::traits< Derived >::Index Index
The type of indices.
Definition: DenseBase.h:60
bool isConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: CwiseNullaryOp.h:312
void transposeInPlace()
Definition: Transpose.h:292
static const ConstantReturnType Ones()
Definition: CwiseNullaryOp.h:597
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:103
bool isOnes(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: CwiseNullaryOp.h:612
Definition: DenseBase.h:143
Eigen::Transpose< Derived > transpose()
Definition: Transpose.h:199
static const SequentialLinSpacedReturnType LinSpaced(Sequential_t, Index size, const Scalar &low, const Scalar &high)
Sets a linearly space vector.
Definition: CwiseNullaryOp.h:242
Index outerSize() const
Definition: DenseBase.h:192
static const ConstantReturnType Zero()
Definition: CwiseNullaryOp.h:468
Definition: DenseBase.h:115
const unsigned int RowMajorBit
Definition: Constants.h:53
CoeffReturnType value() const
Definition: DenseBase.h:422
const Flagged< Derived, Added, Removed > flagged() const
Definition: Flagged.h:133
const WithFormat< Derived > format(const IOFormat &fmt) const
Definition: IO.h:117
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
Expression of the reverse of a vector or matrix.
Definition: Reverse.h:70
ConstColwiseReturnType colwise() const
Definition: VectorwiseOp.h:599
Definition: DenseBase.h:102
Definition: DenseBase.h:121
ConstRowwiseReturnType rowwise() const
Definition: VectorwiseOp.h:624
static const ConstantReturnType Constant(Index rows, Index cols, const Scalar &value)
Definition: CwiseNullaryOp.h:179
EvalReturnType eval() const
Definition: DenseBase.h:360
Expression of a coefficient wise version of the C++ ternary operator ?:
Definition: Select.h:55
const Replicate< Derived, RowFactor, ColFactor > replicate() const
Definition: Replicate.h:139