11#ifndef EIGEN_DENSEBASE_H
12#define EIGEN_DENSEBASE_H
32#ifndef EIGEN_PARSED_BY_DOXYGEN
33 :
public internal::special_scalar_op_base<Derived,typename internal::traits<Derived>::Scalar,
34 typename NumTraits<typename internal::traits<Derived>::Scalar>::Real>
36 :
public DenseCoeffsBase<Derived>
40 using internal::special_scalar_op_base<Derived,
typename internal::traits<Derived>::Scalar,
45 typedef typename internal::traits<Derived>::StorageKind StorageKind;
51 typedef typename internal::traits<Derived>::Index
Index;
53 typedef typename internal::traits<Derived>::Scalar Scalar;
54 typedef typename internal::packet_traits<Scalar>::type PacketScalar;
55 typedef typename NumTraits<Scalar>::Real RealScalar;
57 typedef DenseCoeffsBase<Derived> Base;
59 using Base::const_cast_derived;
63 using Base::rowIndexByOuterInner;
64 using Base::colIndexByOuterInner;
66 using Base::coeffByOuterInner;
68 using Base::packetByOuterInner;
69 using Base::writePacket;
70 using Base::writePacketByOuterInner;
72 using Base::coeffRefByOuterInner;
73 using Base::copyCoeff;
74 using Base::copyCoeffByOuterInner;
75 using Base::copyPacket;
76 using Base::copyPacketByOuterInner;
77 using Base::operator();
78 using Base::operator[];
84 using Base::innerStride;
85 using Base::outerStride;
86 using Base::rowStride;
87 using Base::colStride;
88 typedef typename Base::CoeffReturnType CoeffReturnType;
105 SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
106 internal::traits<Derived>::ColsAtCompileTime>::ret),
134 internal::traits<Derived>::MaxColsAtCompileTime>::ret),
146 || internal::traits<Derived>::MaxColsAtCompileTime == 1,
152 Flags = internal::traits<Derived>::Flags,
167 InnerStrideAtCompileTime =
internal::inner_stride_at_compile_time<Derived>::ret,
168 OuterStrideAtCompileTime =
internal::outer_stride_at_compile_time<Derived>::ret
171 enum { ThisConstantIsPrivateInPlainObjectBase };
189 : int(
IsRowMajor) ? this->rows() : this->cols();
200 : int(
IsRowMajor) ? this->cols() : this->rows();
209 EIGEN_ONLY_USED_FOR_DEBUG(size);
210 eigen_assert(size == this->size()
211 &&
"DenseBase::resize() does not actually allow to resize.");
219 EIGEN_ONLY_USED_FOR_DEBUG(rows);
220 EIGEN_ONLY_USED_FOR_DEBUG(cols);
221 eigen_assert(rows == this->rows() && cols == this->cols()
222 &&
"DenseBase::resize() does not actually allow to resize.");
225#ifndef EIGEN_PARSED_BY_DOXYGEN
239 template<
typename OtherDerived>
247 template<
typename OtherDerived>
250 template<
typename OtherDerived>
253 template<
typename OtherDerived>
256 template<
typename OtherDerived>
257 Derived&
operator=(
const ReturnByValue<OtherDerived>& func);
259#ifndef EIGEN_PARSED_BY_DOXYGEN
261 template<
typename OtherDerived>
267 template<
unsigned int Added,
unsigned int Removed>
268 const Flagged<Derived, Added, Removed>
flagged()
const;
270 template<
typename OtherDerived>
275 ConstTransposeReturnType
transpose()
const;
277#ifndef EIGEN_NO_DEBUG
279 template<
typename OtherDerived>
280 void checkTransposeAliasing(
const OtherDerived& other)
const;
290 SegmentReturnType
segment(Index start, Index size);
291 typename DenseBase::ConstSegmentReturnType
segment(Index start, Index size)
const;
293 SegmentReturnType head(Index size);
294 typename DenseBase::ConstSegmentReturnType head(Index size)
const;
296 SegmentReturnType tail(Index size);
297 typename DenseBase::ConstSegmentReturnType tail(Index size)
const;
299 template<
int Size>
typename FixedSegmentReturnType<Size>::Type head();
300 template<
int Size>
typename ConstFixedSegmentReturnType<Size>::Type head()
const;
302 template<
int Size>
typename FixedSegmentReturnType<Size>::Type tail();
303 template<
int Size>
typename ConstFixedSegmentReturnType<Size>::Type
tail()
const;
305 template<
int Size>
typename FixedSegmentReturnType<Size>::Type
segment(
Index start);
306 template<
int Size>
typename ConstFixedSegmentReturnType<Size>::Type
segment(
Index start)
const;
308 static const ConstantReturnType
310 static const ConstantReturnType
312 static const ConstantReturnType
315 static const SequentialLinSpacedReturnType
316 LinSpaced(Sequential_t,
Index size,
const Scalar& low,
const Scalar& high);
317 static const RandomAccessLinSpacedReturnType
319 static const SequentialLinSpacedReturnType
320 LinSpaced(Sequential_t,
const Scalar& low,
const Scalar& high);
321 static const RandomAccessLinSpacedReturnType
322 LinSpaced(
const Scalar& low,
const Scalar& high);
324 template<
typename CustomNullaryOp>
327 template<
typename CustomNullaryOp>
330 template<
typename CustomNullaryOp>
335 static const ConstantReturnType
Zero(
Index size);
336 static const ConstantReturnType
Zero();
338 static const ConstantReturnType
Ones(
Index size);
339 static const ConstantReturnType
Ones();
344 Derived&
setLinSpaced(
const Scalar& low,
const Scalar& high);
349 template<
typename OtherDerived>
351 RealScalar prec = NumTraits<Scalar>::dummy_precision())
const;
352 bool isMuchSmallerThan(
const RealScalar& other,
353 RealScalar prec = NumTraits<Scalar>::dummy_precision())
const;
354 template<
typename OtherDerived>
356 RealScalar prec = NumTraits<Scalar>::dummy_precision())
const;
359 bool isConstant(
const Scalar&
value, RealScalar prec = NumTraits<Scalar>::dummy_precision())
const;
360 bool isZero(RealScalar prec = NumTraits<Scalar>::dummy_precision())
const;
361 bool isOnes(RealScalar prec = NumTraits<Scalar>::dummy_precision())
const;
363 inline Derived& operator*=(
const Scalar& other);
364 inline Derived& operator/=(
const Scalar& other);
366 typedef typename internal::add_const_on_value_type<typename internal::eval<Derived>::type>::type EvalReturnType;
372 EIGEN_STRONG_INLINE EvalReturnType
eval()
const
377 return typename internal::eval<Derived>::type(derived());
383 template<
typename OtherDerived>
385 int = OtherDerived::ThisConstantIsPrivateInPlainObjectBase)
387 SwapWrapper<Derived>(derived()).lazyAssign(other.derived());
393 template<
typename OtherDerived>
396 SwapWrapper<Derived>(derived()).lazyAssign(other.derived());
403 template<
bool Enable>
inline const typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf()
const;
404 template<
bool Enable>
inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf();
408 Scalar trace()
const;
412 typename internal::traits<Derived>::Scalar
minCoeff()
const;
413 typename internal::traits<Derived>::Scalar
maxCoeff()
const;
415 template<
typename IndexType>
416 typename internal::traits<Derived>::Scalar
minCoeff(IndexType*
row, IndexType*
col)
const;
417 template<
typename IndexType>
418 typename internal::traits<Derived>::Scalar
maxCoeff(IndexType*
row, IndexType*
col)
const;
419 template<
typename IndexType>
420 typename internal::traits<Derived>::Scalar
minCoeff(IndexType* index)
const;
421 template<
typename IndexType>
422 typename internal::traits<Derived>::Scalar
maxCoeff(IndexType* index)
const;
424 template<
typename BinaryOp>
425 typename internal::result_of<BinaryOp(
typename internal::traits<Derived>::Scalar)>::type
426 redux(
const BinaryOp& func)
const;
428 template<
typename Visitor>
429 void visit(Visitor& func)
const;
436 EIGEN_STATIC_ASSERT_SIZE_1x1(Derived)
437 eigen_assert(this->rows() == 1 && this->cols() == 1);
438 return derived().coeff(0,0);
444 bool any(
void) const;
452 ConstRowwiseReturnType
rowwise() const;
454 ConstColwiseReturnType
colwise() const;
461 template<typename ThenDerived,typename ElseDerived>
462 const
Select<Derived,ThenDerived,ElseDerived>
464 const
DenseBase<ElseDerived>& elseMatrix) const;
466 template<typename ThenDerived>
467 inline const
Select<Derived,ThenDerived, typename ThenDerived::ConstantReturnType>
468 select(const
DenseBase<ThenDerived>& thenMatrix, typename ThenDerived::Scalar elseScalar) const;
470 template<typename ElseDerived>
471 inline const
Select<Derived, typename ElseDerived::ConstantReturnType, ElseDerived >
472 select(typename ElseDerived::Scalar thenScalar, const
DenseBase<ElseDerived>& elseMatrix) const;
474 template<
int p> RealScalar lpNorm() const;
476 template<
int RowFactor,
int ColFactor>
483 ConstReverseReturnType
reverse() const;
486#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase
487# include "../plugins/BlockMethods.h"
488# ifdef EIGEN_DENSEBASE_PLUGIN
489# include EIGEN_DENSEBASE_PLUGIN
491#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
497 template<
int CRows,
int CCols>
499 template<
int CRows,
int CCols>
506 template<
typename Dest>
inline void evalTo(Dest& )
const
508 EIGEN_STATIC_ASSERT((internal::is_same<Dest,void>::value),THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS);
518#ifdef EIGEN_INTERNAL_DEBUGGING
521 INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION)
Expression of a fixed-size or dynamic-size block.
Definition Block.h:99
Generic expression of a matrix where all coefficients are defined by a functor.
Definition CwiseNullaryOp.h:51
Base class for all dense matrices, vectors, and arrays.
Definition DenseBase.h:38
bool isApprox(const DenseBase< OtherDerived > &other, RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
Definition Fuzzy.h:98
static const SequentialLinSpacedReturnType LinSpaced(Sequential_t, Index size, const Scalar &low, const Scalar &high)
Sets a linearly space vector.
Definition CwiseNullaryOp.h:242
Index count() const
Definition BooleanRedux.h:131
const WithFormat< Derived > format(const IOFormat &fmt) const
Definition IO.h:118
void resize(Index size)
Definition DenseBase.h:207
EvalReturnType eval() const
Definition DenseBase.h:372
Index nonZeros() const
Definition DenseBase.h:175
static const CwiseNullaryOp< CustomNullaryOp, Derived > NullaryExpr(Index rows, Index cols, const CustomNullaryOp &func)
Definition CwiseNullaryOp.h:117
Index innerSize() const
Definition DenseBase.h:197
Derived & setOnes()
Definition CwiseNullaryOp.h:625
const Replicate< Derived, RowFactor, ColFactor > replicate() const
Definition Replicate.h:139
void swap(PlainObjectBase< OtherDerived > &other)
Definition DenseBase.h:394
static const ConstantReturnType Ones()
Definition CwiseNullaryOp.h:597
ConstColwiseReturnType colwise() const
Definition VectorwiseOp.h:555
static const ConstantReturnType Zero()
Definition CwiseNullaryOp.h:468
Derived & setConstant(const Scalar &value)
Definition CwiseNullaryOp.h:332
void transposeInPlace()
Definition Transpose.h:291
DenseBase()
Definition DenseBase.h:513
Eigen::Transpose< Derived > transpose()
Definition Transpose.h:199
void visit(Visitor &func) const
Definition Visitor.h:77
internal::traits< Derived >::Index Index
The type of indices.
Definition DenseBase.h:51
ColXpr col(Index i)
Definition DenseBase.h:553
bool isZero(RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:482
SegmentReturnType tail(Index size)
Definition VectorBlock.h:175
bool isOnes(RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:612
internal::traits< Derived >::Scalar maxCoeff() const
Definition Redux.h:346
ReverseReturnType reverse()
Definition Reverse.h:191
static const CwiseNullaryOp< internal::scalar_random_op< Scalar >, Derived > Random(Index rows, Index cols)
Definition Random.h:49
const NestByValue< Derived > nestByValue() const
Definition NestByValue.h:104
Derived & setZero()
Definition CwiseNullaryOp.h:499
ConstRowwiseReturnType rowwise() const
Definition VectorwiseOp.h:580
CoeffReturnType value() const
Definition DenseBase.h:434
Scalar prod() const
Definition Redux.h:384
internal::traits< Derived >::Scalar minCoeff() const
Definition Redux.h:337
void fill(const Scalar &value)
Definition CwiseNullaryOp.h:322
RowXpr row(Index i)
Definition DenseBase.h:570
Derived & operator=(const DenseBase< OtherDerived > &other)
Definition Assign.h:541
Scalar sum() const
Definition Redux.h:357
Derived & setRandom()
Definition Random.h:110
SegmentReturnType segment(Index start, Index size)
Definition VectorBlock.h:111
static const ConstantReturnType Constant(Index rows, Index cols, const Scalar &value)
Definition CwiseNullaryOp.h:179
void resize(Index rows, Index cols)
Definition DenseBase.h:217
Derived & setLinSpaced(Index size, const Scalar &low, const Scalar &high)
Sets a linearly space vector.
Definition CwiseNullaryOp.h:387
Index outerSize() const
Definition DenseBase.h:186
const Select< Derived, ThenDerived, ElseDerived > select(const DenseBase< ThenDerived > &thenMatrix, const DenseBase< ElseDerived > &elseMatrix) const
Definition Select.h:124
bool all(void) const
Definition BooleanRedux.h:79
void swap(const DenseBase< OtherDerived > &other, int=OtherDerived::ThisConstantIsPrivateInPlainObjectBase)
Definition DenseBase.h:384
CommaInitializer< Derived > operator<<(const Scalar &s)
Definition CommaInitializer.h:125
const Flagged< Derived, Added, Removed > flagged() const
Definition Flagged.h:133
bool isConstant(const Scalar &value, RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:312
@ MaxRowsAtCompileTime
Definition DenseBase.h:111
@ CoeffReadCost
Definition DenseBase.h:162
@ IsRowMajor
Definition DenseBase.h:157
@ RowsAtCompileTime
Definition DenseBase.h:92
@ IsVectorAtCompileTime
Definition DenseBase.h:145
@ Flags
Definition DenseBase.h:152
@ SizeAtCompileTime
Definition DenseBase.h:105
@ MaxColsAtCompileTime
Definition DenseBase.h:122
@ MaxSizeAtCompileTime
Definition DenseBase.h:133
@ ColsAtCompileTime
Definition DenseBase.h:98
Scalar mean() const
Definition Redux.h:370
bool any(void) const
Definition BooleanRedux.h:105
void reverseInPlace()
Definition Reverse.h:217
bool isApproxToConstant(const Scalar &value, RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:298
Enforce aligned packet loads and stores regardless of what is requested.
Definition ForceAlignedAccess.h:36
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:129
Expression which must be nested by value.
Definition NestByValue.h:37
Dense storage base class for matrices and arrays.
Definition PlainObjectBase.h:74
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:72
Expression of a coefficient wise version of the C++ ternary operator ?:
Definition Select.h:57
Expression of the transpose of a matrix.
Definition Transpose.h:59
Expression of a fixed-size or dynamic-size sub-vector.
Definition VectorBlock.h:61
Pseudo expression providing partial reduction operations.
Definition VectorwiseOp.h:166
CornerType
Definition Constants.h:196
@ Vertical
Definition Constants.h:204
@ BothDirections
Definition Constants.h:210
@ Horizontal
Definition Constants.h:207
const unsigned int RowMajorBit
Definition Constants.h:48
Helper class used by the comma initializer operator.
Definition CommaInitializer.h:29
Definition EigenBase.h:27
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition NumTraits.h:89