10#ifndef EIGEN_DENSECOEFFSBASE_H
11#define EIGEN_DENSECOEFFSBASE_H
34template<
typename Derived>
40 typedef typename internal::packet_traits<Scalar>::type PacketScalar;
55 typename internal::packet_traits<Scalar>::type
65 EIGEN_STRONG_INLINE
Index rowIndexByOuterInner(
Index outer,
Index inner)
const
67 return int(Derived::RowsAtCompileTime) == 1 ? 0
68 : int(Derived::ColsAtCompileTime) == 1 ? inner
74 EIGEN_STRONG_INLINE
Index colIndexByOuterInner(
Index outer,
Index inner)
const
76 return int(Derived::ColsAtCompileTime) == 1 ? 0
77 : int(Derived::RowsAtCompileTime) == 1 ? inner
99 eigen_internal_assert(row >= 0 && row < rows()
100 && col >= 0 && col < cols());
105 EIGEN_STRONG_INLINE CoeffReturnType coeffByOuterInner(
Index outer,
Index inner)
const
107 return coeff(rowIndexByOuterInner(outer, inner),
108 colIndexByOuterInner(outer, inner));
118 eigen_assert(row >= 0 && row < rows()
119 && col >= 0 && col < cols());
120 return coeff(row, col);
139 EIGEN_STRONG_INLINE CoeffReturnType
143 THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
144 eigen_internal_assert(index >= 0 && index < size());
158 EIGEN_STRONG_INLINE CoeffReturnType
161 EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
162 THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
163 eigen_assert(index >= 0 && index < size());
178 EIGEN_STRONG_INLINE CoeffReturnType
181 eigen_assert(index >= 0 && index < size());
188 EIGEN_STRONG_INLINE CoeffReturnType
189 x()
const {
return (*
this)[0]; }
194 EIGEN_STRONG_INLINE CoeffReturnType
197 EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS);
204 EIGEN_STRONG_INLINE CoeffReturnType
207 EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS);
214 EIGEN_STRONG_INLINE CoeffReturnType
217 EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS);
231 template<
int LoadMode>
232 EIGEN_STRONG_INLINE PacketReturnType packet(
Index row,
Index col)
const
235 eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
241 template<
int LoadMode>
242 EIGEN_STRONG_INLINE PacketReturnType packetByOuterInner(
Index outer,
Index inner)
const
244 return packet<LoadMode>(rowIndexByOuterInner(outer, inner),
245 colIndexByOuterInner(outer, inner));
258 template<
int LoadMode>
259 EIGEN_STRONG_INLINE PacketReturnType packet(
Index index)
const
261 EIGEN_STATIC_ASSERT(internal::evaluator<Derived>::Flags &
LinearAccessBit,
262 THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
263 typedef typename internal::packet_traits<Scalar>::type DefaultPacketType;
264 eigen_internal_assert(index >= 0 && index < size());
265 return internal::evaluator<Derived>(derived()).template packet<LoadMode,DefaultPacketType>(index);
275 void coeffRefByOuterInner();
277 void writePacketByOuterInner();
279 void copyCoeffByOuterInner();
281 void copyPacketByOuterInner();
301template<
typename Derived>
310 typedef typename internal::packet_traits<Scalar>::type PacketScalar;
318 using Base::rowIndexByOuterInner;
319 using Base::colIndexByOuterInner;
320 using Base::operator[];
321 using Base::operator();
344 eigen_internal_assert(row >= 0 && row < rows()
345 && col >= 0 && col < cols());
350 EIGEN_STRONG_INLINE Scalar&
351 coeffRefByOuterInner(
Index outer,
Index inner)
353 return coeffRef(rowIndexByOuterInner(outer, inner),
354 colIndexByOuterInner(outer, inner));
363 EIGEN_STRONG_INLINE Scalar&
366 eigen_assert(row >= 0 && row < rows()
367 && col >= 0 && col < cols());
368 return coeffRef(row, col);
388 EIGEN_STRONG_INLINE Scalar&
392 THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
393 eigen_internal_assert(index >= 0 && index < size());
405 EIGEN_STRONG_INLINE Scalar&
408 EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
409 THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
410 eigen_assert(index >= 0 && index < size());
411 return coeffRef(index);
424 EIGEN_STRONG_INLINE Scalar&
427 eigen_assert(index >= 0 && index < size());
428 return coeffRef(index);
434 EIGEN_STRONG_INLINE Scalar&
435 x() {
return (*
this)[0]; }
440 EIGEN_STRONG_INLINE Scalar&
443 EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS);
450 EIGEN_STRONG_INLINE Scalar&
453 EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS);
460 EIGEN_STRONG_INLINE Scalar&
463 EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS);
480template<
typename Derived>
498 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
501 return derived().innerStride();
509 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
512 return derived().outerStride();
516 EIGEN_CONSTEXPR
inline Index stride()
const
518 return Derived::IsVectorAtCompileTime ? innerStride() : outerStride();
525 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
528 return Derived::IsRowMajor ? outerStride() : innerStride();
535 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
538 return Derived::IsRowMajor ? innerStride() : outerStride();
554template<
typename Derived>
573 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
576 return derived().innerStride();
584 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
587 return derived().outerStride();
591 EIGEN_CONSTEXPR
inline Index stride()
const EIGEN_NOEXCEPT
593 return Derived::IsVectorAtCompileTime ? innerStride() : outerStride();
600 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
603 return Derived::IsRowMajor ? outerStride() : innerStride();
610 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
613 return Derived::IsRowMajor ? innerStride() : outerStride();
619template<
int Alignment,
typename Derived,
bool JustReturnZero>
622 static EIGEN_CONSTEXPR
inline Index run(
const Derived&) EIGEN_NOEXCEPT
626template<
int Alignment,
typename Derived>
629 static inline Index run(
const Derived& m)
631 return internal::first_aligned<Alignment>(m.data(), m.size());
642template<
int Alignment,
typename Derived>
646 return first_aligned_impl<Alignment, Derived, ReturnZero>::run(m.derived());
649template<
typename Derived>
650static inline Index first_default_aligned(
const DenseBase<Derived>& m)
652 typedef typename Derived::Scalar Scalar;
653 typedef typename packet_traits<Scalar>::type DefaultPacketType;
654 return internal::first_aligned<int(unpacket_traits<DefaultPacketType>::alignment),Derived>(m);
657template<typename Derived, bool HasDirectAccess = has_direct_access<Derived>::ret>
663template<
typename Derived>
675template<
typename Derived>
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index colStride() const
Definition DenseCoeffsBase.h:536
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerStride() const
Definition DenseCoeffsBase.h:510
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rowStride() const
Definition DenseCoeffsBase.h:526
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index innerStride() const
Definition DenseCoeffsBase.h:499
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index innerStride() const EIGEN_NOEXCEPT
Definition DenseCoeffsBase.h:574
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rowStride() const EIGEN_NOEXCEPT
Definition DenseCoeffsBase.h:601
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerStride() const EIGEN_NOEXCEPT
Definition DenseCoeffsBase.h:585
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index colStride() const EIGEN_NOEXCEPT
Definition DenseCoeffsBase.h:611
Base class providing read-only coefficient access to matrices and arrays.
Definition DenseCoeffsBase.h:36
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator()(Index row, Index col) const
Definition DenseCoeffsBase.h:116
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType x() const
equivalent to operator[](0).
Definition DenseCoeffsBase.h:189
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType w() const
equivalent to operator[](3).
Definition DenseCoeffsBase.h:215
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator()(Index index) const
Definition DenseCoeffsBase.h:179
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType z() const
equivalent to operator[](2).
Definition DenseCoeffsBase.h:205
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator[](Index index) const
Definition DenseCoeffsBase.h:159
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:97
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:140
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType y() const
equivalent to operator[](1).
Definition DenseCoeffsBase.h:195
Base class providing read/write coefficient access to matrices and arrays.
Definition DenseCoeffsBase.h:303
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & x()
equivalent to operator[](0).
Definition DenseCoeffsBase.h:435
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator[](Index index)
Definition DenseCoeffsBase.h:406
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & y()
equivalent to operator[](1).
Definition DenseCoeffsBase.h:441
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:342
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator()(Index row, Index col)
Definition DenseCoeffsBase.h:364
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & z()
equivalent to operator[](2).
Definition DenseCoeffsBase.h:451
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator()(Index index)
Definition DenseCoeffsBase.h:425
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Short version: don't use this function, use operator[](Index) instead.
Definition DenseCoeffsBase.h:389
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & w()
equivalent to operator[](3).
Definition DenseCoeffsBase.h:461
Definition ForwardDeclarations.h:50
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
@ DirectAccessors
Direct read-only access to the coefficients.
Definition Constants.h:380
@ ReadOnlyAccessors
Read-only access via a member function.
Definition Constants.h:376
@ WriteAccessors
Read/write access via member functions.
Definition Constants.h:378
@ DirectWriteAccessors
Direct read/write access to the coefficients.
Definition Constants.h:382
const unsigned int LinearAccessBit
Short version: means the expression can be seen as 1D vector.
Definition Constants.h:130
const unsigned int DirectAccessBit
Means that the underlying array of coefficients can be directly accessed as a plain strided array.
Definition Constants.h:155
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition Constants.h:144
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:66
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor Matrix...
Definition EigenBase.h:30
Eigen::Index Index
The interface type of indices.
Definition EigenBase.h:39
Definition DenseCoeffsBase.h:17
Definition CoreEvaluators.h:91
Definition DenseCoeffsBase.h:621
Definition DenseCoeffsBase.h:659
Definition DenseCoeffsBase.h:671
Definition ForwardDeclarations.h:17