10 #ifndef EIGEN_DENSECOEFFSBASE_H 11 #define EIGEN_DENSECOEFFSBASE_H 33 template<
typename Derived>
64 EIGEN_STRONG_INLINE
Index rowIndexByOuterInner(
Index outer,
Index inner)
const 66 return int(Derived::RowsAtCompileTime) == 1 ? 0
67 : int(Derived::ColsAtCompileTime) == 1 ? inner
73 EIGEN_STRONG_INLINE
Index colIndexByOuterInner(
Index outer,
Index inner)
const 75 return int(Derived::ColsAtCompileTime) == 1 ? 0
76 : int(Derived::RowsAtCompileTime) == 1 ? inner
98 eigen_internal_assert(row >= 0 && row < rows()
99 && col >= 0 && col < cols());
106 return coeff(rowIndexByOuterInner(outer, inner),
107 colIndexByOuterInner(outer, inner));
117 eigen_assert(row >= 0 && row < rows()
118 && col >= 0 && col < cols());
119 return coeff(row, col);
142 THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
143 eigen_internal_assert(index >= 0 && index < size());
160 EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
161 THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
162 eigen_assert(index >= 0 && index < size());
180 eigen_assert(index >= 0 && index < size());
188 x()
const {
return (*
this)[0]; }
196 EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS);
206 EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS);
216 EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS);
230 template<
int LoadMode>
231 EIGEN_STRONG_INLINE PacketReturnType packet(
Index row,
Index col)
const 234 eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
240 template<
int LoadMode>
241 EIGEN_STRONG_INLINE PacketReturnType packetByOuterInner(
Index outer,
Index inner)
const 243 return packet<LoadMode>(rowIndexByOuterInner(outer, inner),
244 colIndexByOuterInner(outer, inner));
257 template<
int LoadMode>
258 EIGEN_STRONG_INLINE PacketReturnType packet(
Index index)
const 261 THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
263 eigen_internal_assert(index >= 0 && index < size());
274 void coeffRefByOuterInner();
276 void writePacketByOuterInner();
278 void copyCoeffByOuterInner();
280 void copyPacketByOuterInner();
299 template<
typename Derived>
316 using Base::rowIndexByOuterInner;
317 using Base::colIndexByOuterInner;
318 using Base::operator[];
319 using Base::operator();
342 eigen_internal_assert(row >= 0 && row < rows()
343 && col >= 0 && col < cols());
348 EIGEN_STRONG_INLINE Scalar&
349 coeffRefByOuterInner(
Index outer,
Index inner)
351 return coeffRef(rowIndexByOuterInner(outer, inner),
352 colIndexByOuterInner(outer, inner));
361 EIGEN_STRONG_INLINE Scalar&
364 eigen_assert(row >= 0 && row < rows()
365 && col >= 0 && col < cols());
366 return coeffRef(row, col);
386 EIGEN_STRONG_INLINE Scalar&
390 THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
391 eigen_internal_assert(index >= 0 && index < size());
403 EIGEN_STRONG_INLINE Scalar&
406 EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
407 THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
408 eigen_assert(index >= 0 && index < size());
409 return coeffRef(index);
422 EIGEN_STRONG_INLINE Scalar&
425 eigen_assert(index >= 0 && index < size());
426 return coeffRef(index);
432 EIGEN_STRONG_INLINE Scalar&
433 x() {
return (*
this)[0]; }
438 EIGEN_STRONG_INLINE Scalar&
441 EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS);
448 EIGEN_STRONG_INLINE Scalar&
451 EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS);
458 EIGEN_STRONG_INLINE Scalar&
461 EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS);
477 template<
typename Derived>
498 return derived().innerStride();
509 return derived().outerStride();
513 inline Index stride()
const 515 return Derived::IsVectorAtCompileTime ? innerStride() : outerStride();
525 return Derived::IsRowMajor ? outerStride() : innerStride();
535 return Derived::IsRowMajor ? innerStride() : outerStride();
550 template<
typename Derived>
572 return derived().innerStride();
583 return derived().outerStride();
587 inline Index stride()
const 589 return Derived::IsVectorAtCompileTime ? innerStride() : outerStride();
599 return Derived::IsRowMajor ? outerStride() : innerStride();
609 return Derived::IsRowMajor ? innerStride() : outerStride();
615 template<
int Alignment,
typename Derived,
bool JustReturnZero>
618 static inline Index run(
const Derived&)
622 template<
int Alignment,
typename Derived>
625 static inline Index run(
const Derived& m)
627 return internal::first_aligned<Alignment>(m.data(), m.size());
638 template<
int Alignment,
typename Derived>
645 template<
typename Derived>
648 typedef typename Derived::Scalar Scalar;
650 return internal::first_aligned<int(unpacket_traits<DefaultPacketType>::alignment),Derived>(m);
653 template<typename Derived, bool HasDirectAccess = has_direct_access<Derived>::ret>
659 template<
typename Derived>
665 template<typename Derived, bool HasDirectAccess = has_direct_access<Derived>::ret>
671 template<
typename Derived>
681 #endif // EIGEN_DENSECOEFFSBASE_H EIGEN_DEVICE_FUNC Index outerStride() const
Definition: DenseCoeffsBase.h:581
Definition: DenseCoeffsBase.h:654
Read/write access via member functions.
Definition: Constants.h:368
EIGEN_DEVICE_FUNC Index colStride() const
Definition: DenseCoeffsBase.h:533
const unsigned int DirectAccessBit
Means that the underlying array of coefficients can be directly accessed as a plain strided array...
Definition: Constants.h:150
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition: Constants.h:139
Definition: CoreEvaluators.h:90
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator()(Index index)
Definition: DenseCoeffsBase.h:423
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:85
Holds information about the various numeric (i.e.
Definition: NumTraits.h:150
Definition: ForwardDeclarations.h:54
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:37
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
Definition: DenseCoeffsBase.h:16
Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor Matrix...
Definition: EigenBase.h:28
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator()(Index row, Index col) const
Definition: DenseCoeffsBase.h:115
EIGEN_DEVICE_FUNC Index colStride() const
Definition: DenseCoeffsBase.h:607
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const
Short version: don't use this function, use operator()(Index,Index) const instead.
Definition: DenseCoeffsBase.h:96
Definition: GenericPacketMath.h:96
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator()(Index row, Index col)
Definition: DenseCoeffsBase.h:362
Read-only access via a member function.
Definition: Constants.h:366
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType w() const
equivalent to operator[](3).
Definition: DenseCoeffsBase.h:214
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator()(Index index) const
Definition: DenseCoeffsBase.h:178
EIGEN_DEVICE_FUNC Index rowStride() const
Definition: DenseCoeffsBase.h:523
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
Direct read-only access to the coefficients.
Definition: Constants.h:370
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator[](Index index) const
Definition: DenseCoeffsBase.h:158
EIGEN_DEVICE_FUNC Index innerStride() const
Definition: DenseCoeffsBase.h:570
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType z() const
equivalent to operator[](2).
Definition: DenseCoeffsBase.h:204
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Short version: don't use this function, use operator[](Index) instead.
Definition: DenseCoeffsBase.h:387
Direct read/write access to the coefficients.
Definition: Constants.h:372
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & x()
equivalent to operator[](0).
Definition: DenseCoeffsBase.h:433
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & y()
equivalent to operator[](1).
Definition: DenseCoeffsBase.h:439
Definition: BandTriangularSolver.h:13
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index row, Index col)
Short version: don't use this function, use operator()(Index,Index) instead.
Definition: DenseCoeffsBase.h:340
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Short version: don't use this function, use operator[](Index) const instead.
Definition: DenseCoeffsBase.h:139
Definition: DenseCoeffsBase.h:666
Base class providing read-only coefficient access to matrices and arrays.
Definition: DenseCoeffsBase.h:34
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType y() const
equivalent to operator[](1).
Definition: DenseCoeffsBase.h:194
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator[](Index index)
Definition: DenseCoeffsBase.h:404
EIGEN_DEVICE_FUNC Index outerStride() const
Definition: DenseCoeffsBase.h:507
EIGEN_DEVICE_FUNC Index innerStride() const
Definition: DenseCoeffsBase.h:496
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & z()
equivalent to operator[](2).
Definition: DenseCoeffsBase.h:449
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:55
Base class providing read/write coefficient access to matrices and arrays.
Definition: DenseCoeffsBase.h:300
EIGEN_DEVICE_FUNC Index rowStride() const
Definition: DenseCoeffsBase.h:597
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType x() const
equivalent to operator[](0).
Definition: DenseCoeffsBase.h:188
const unsigned int LinearAccessBit
Short version: means the expression can be seen as 1D vector.
Definition: Constants.h:125
Definition: ForwardDeclarations.h:17
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & w()
equivalent to operator[](3).
Definition: DenseCoeffsBase.h:459
Definition: DenseCoeffsBase.h:616