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>
46 :
public DenseCoeffsBase<Derived>
47 #endif // not EIGEN_PARSED_BY_DOXYGEN 50 using internal::special_scalar_op_base<Derived,typename internal::traits<Derived>::Scalar,
55 typedef typename internal::traits<Derived>::StorageKind StorageKind;
61 typedef typename internal::traits<Derived>::Index
Index;
63 typedef typename internal::traits<Derived>::Scalar Scalar;
64 typedef typename internal::packet_traits<Scalar>::type PacketScalar;
67 typedef DenseCoeffsBase<Derived> Base;
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;
102 RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
108 ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
115 SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
116 internal::traits<Derived>::ColsAtCompileTime>::ret),
121 MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime,
132 MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime,
143 MaxSizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::MaxRowsAtCompileTime,
144 internal::traits<Derived>::MaxColsAtCompileTime>::ret),
155 IsVectorAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime == 1
156 || internal::traits<Derived>::MaxColsAtCompileTime == 1,
162 Flags = internal::traits<Derived>::Flags,
169 InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? int(SizeAtCompileTime)
170 : int(IsRowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime),
172 CoeffReadCost =
internal::traits<Derived>::CoeffReadCost,
177 InnerStrideAtCompileTime =
internal::inner_stride_at_compile_time<Derived>::ret,
178 OuterStrideAtCompileTime =
internal::outer_stride_at_compile_time<Derived>::ret
181 enum { ThisConstantIsPrivateInPlainObjectBase };
185 inline Index nonZeros()
const {
return size(); }
198 return IsVectorAtCompileTime ? 1
199 : int(IsRowMajor) ? this->rows() : this->cols();
209 return IsVectorAtCompileTime ? this->size()
210 : int(IsRowMajor) ? this->cols() : this->rows();
219 EIGEN_ONLY_USED_FOR_DEBUG(newSize);
220 eigen_assert(newSize == this->size()
221 &&
"DenseBase::resize() does not actually allow to resize.");
229 EIGEN_ONLY_USED_FOR_DEBUG(nbRows);
230 EIGEN_ONLY_USED_FOR_DEBUG(nbCols);
231 eigen_assert(nbRows == this->rows() && nbCols == this->cols()
232 &&
"DenseBase::resize() does not actually allow to resize.");
235 #ifndef EIGEN_PARSED_BY_DOXYGEN 246 #endif // not EIGEN_PARSED_BY_DOXYGEN 249 template<
typename OtherDerived>
255 Derived& operator=(
const DenseBase& other);
257 template<
typename OtherDerived>
260 template<
typename OtherDerived>
263 template<
typename OtherDerived>
266 template<
typename OtherDerived>
267 Derived& operator=(
const ReturnByValue<OtherDerived>& func);
269 #ifndef EIGEN_PARSED_BY_DOXYGEN 271 template<
typename OtherDerived>
273 #endif // not EIGEN_PARSED_BY_DOXYGEN 277 template<
unsigned int Added,
unsigned int Removed>
278 const Flagged<Derived, Added, Removed> flagged()
const;
280 template<
typename OtherDerived>
285 ConstTransposeReturnType transpose()
const;
286 void transposeInPlace();
287 #ifndef EIGEN_NO_DEBUG 289 template<
typename OtherDerived>
290 void checkTransposeAliasing(
const OtherDerived& other)
const;
295 static const ConstantReturnType
296 Constant(Index rows, Index cols,
const Scalar& value);
297 static const ConstantReturnType
298 Constant(Index size,
const Scalar& value);
299 static const ConstantReturnType
300 Constant(
const Scalar& value);
302 static const SequentialLinSpacedReturnType
303 LinSpaced(Sequential_t, Index size,
const Scalar& low,
const Scalar& high);
304 static const RandomAccessLinSpacedReturnType
305 LinSpaced(Index size,
const Scalar& low,
const Scalar& high);
306 static const SequentialLinSpacedReturnType
307 LinSpaced(Sequential_t,
const Scalar& low,
const Scalar& high);
308 static const RandomAccessLinSpacedReturnType
309 LinSpaced(
const Scalar& low,
const Scalar& high);
311 template<
typename CustomNullaryOp>
313 NullaryExpr(Index rows, Index cols,
const CustomNullaryOp& func);
314 template<
typename CustomNullaryOp>
316 NullaryExpr(Index size,
const CustomNullaryOp& func);
317 template<
typename CustomNullaryOp>
319 NullaryExpr(
const CustomNullaryOp& func);
321 static const ConstantReturnType Zero(Index rows, Index cols);
322 static const ConstantReturnType Zero(Index size);
323 static const ConstantReturnType Zero();
324 static const ConstantReturnType Ones(Index rows, Index cols);
325 static const ConstantReturnType Ones(Index size);
326 static const ConstantReturnType Ones();
328 void fill(
const Scalar& value);
329 Derived& setConstant(
const Scalar& value);
330 Derived& setLinSpaced(Index size,
const Scalar& low,
const Scalar& high);
331 Derived& setLinSpaced(
const Scalar& low,
const Scalar& high);
334 Derived& setRandom();
336 template<
typename OtherDerived>
339 bool isMuchSmallerThan(
const RealScalar& other,
341 template<
typename OtherDerived>
350 inline bool hasNaN()
const;
351 inline bool allFinite()
const;
353 inline Derived& operator*=(
const Scalar& other);
354 inline Derived& operator/=(
const Scalar& other);
356 typedef typename internal::add_const_on_value_type<typename internal::eval<Derived>::type>::type EvalReturnType;
362 EIGEN_STRONG_INLINE EvalReturnType
eval()
const 367 return typename internal::eval<Derived>::type(derived());
373 template<
typename OtherDerived>
375 int = OtherDerived::ThisConstantIsPrivateInPlainObjectBase)
377 SwapWrapper<Derived>(derived()).lazyAssign(other.derived());
383 template<
typename OtherDerived>
386 SwapWrapper<Derived>(derived()).lazyAssign(other.derived());
393 template<
bool Enable>
inline const typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf()
const;
394 template<
bool Enable>
inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf();
398 Scalar trace()
const;
402 typename internal::traits<Derived>::Scalar minCoeff()
const;
403 typename internal::traits<Derived>::Scalar maxCoeff()
const;
405 template<
typename IndexType>
406 typename internal::traits<Derived>::Scalar minCoeff(IndexType* row, IndexType* col)
const;
407 template<
typename IndexType>
408 typename internal::traits<Derived>::Scalar maxCoeff(IndexType* row, IndexType* col)
const;
409 template<
typename IndexType>
410 typename internal::traits<Derived>::Scalar minCoeff(IndexType* index)
const;
411 template<
typename IndexType>
412 typename internal::traits<Derived>::Scalar maxCoeff(IndexType* index)
const;
414 template<
typename BinaryOp>
415 typename internal::result_of<BinaryOp(typename internal::traits<Derived>::Scalar)>::type
416 redux(
const BinaryOp& func)
const;
418 template<
typename Visitor>
419 void visit(Visitor& func)
const;
426 EIGEN_STATIC_ASSERT_SIZE_1x1(Derived)
427 eigen_assert(this->rows() == 1 && this->cols() == 1);
428 return derived().coeff(0,0);
431 bool all(
void)
const;
432 bool any(
void)
const;
440 ConstRowwiseReturnType rowwise()
const;
441 RowwiseReturnType rowwise();
442 ConstColwiseReturnType colwise()
const;
443 ColwiseReturnType colwise();
449 template<
typename ThenDerived,
typename ElseDerived>
454 template<
typename ThenDerived>
458 template<
typename ElseDerived>
462 template<
int p> RealScalar lpNorm()
const;
464 template<
int RowFactor,
int ColFactor>
470 ReverseReturnType reverse();
471 ConstReverseReturnType reverse()
const;
472 void reverseInPlace();
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 507 EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1,
int(IsRowMajor))
508 && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1,
int(!IsRowMajor))),
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:217
Enforce aligned packet loads and stores regardless of what is requested.
Definition: ForceAlignedAccess.h:34
Expression of the transpose of a matrix.
Definition: Transpose.h:57
CornerType
Definition: Constants.h:201
void resize(Index nbRows, Index nbCols)
Definition: DenseBase.h:227
void swap(const DenseBase< OtherDerived > &other, int=OtherDerived::ThisConstantIsPrivateInPlainObjectBase)
Definition: DenseBase.h:374
DenseBase()
Definition: DenseBase.h:501
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:88
Pseudo expression providing partial reduction operations.
Definition: ForwardDeclarations.h:212
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:41
CoeffReturnType value() const
Definition: DenseBase.h:424
Helper class used by the comma initializer operator.
Definition: CommaInitializer.h:28
Definition: EigenBase.h:26
void swap(PlainObjectBase< OtherDerived > &other)
Definition: DenseBase.h:384
Index outerSize() const
Definition: DenseBase.h:196
Dense storage base class for matrices and arrays.
Definition: PlainObjectBase.h:85
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:62
Expression which must be nested by value.
Definition: NestByValue.h:35
EvalReturnType eval() const
Definition: DenseBase.h:362
internal::traits< Derived >::Index Index
The type of indices.
Definition: DenseBase.h:61
Definition: Eigen_Colamd.h:54
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:102
const unsigned int RowMajorBit
Definition: Constants.h:53
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
Index innerSize() const
Definition: DenseBase.h:207
Expression of the reverse of a vector or matrix.
Definition: Reverse.h:70
Expression of a coefficient wise version of the C++ ternary operator ?:
Definition: Select.h:55