10#ifndef EIGEN_DENSECOEFFSBASE_H
11#define EIGEN_DENSECOEFFSBASE_H
33template<
typename Derived>
39 typedef typename internal::packet_traits<Scalar>::type PacketScalar;
54 typename internal::packet_traits<Scalar>::type
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());
104 EIGEN_STRONG_INLINE CoeffReturnType coeffByOuterInner(Index outer, Index inner)
const
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);
138 EIGEN_STRONG_INLINE CoeffReturnType
142 THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
143 eigen_internal_assert(index >= 0 && index < size());
157 EIGEN_STRONG_INLINE CoeffReturnType
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());
177 EIGEN_STRONG_INLINE CoeffReturnType
180 eigen_assert(index >= 0 && index < size());
187 EIGEN_STRONG_INLINE CoeffReturnType
188 x()
const {
return (*
this)[0]; }
193 EIGEN_STRONG_INLINE CoeffReturnType
194 y()
const {
return (*
this)[1]; }
199 EIGEN_STRONG_INLINE CoeffReturnType
200 z()
const {
return (*
this)[2]; }
205 EIGEN_STRONG_INLINE CoeffReturnType
206 w()
const {
return (*
this)[3]; }
218 template<
int LoadMode>
219 EIGEN_STRONG_INLINE PacketReturnType packet(Index row, Index col)
const
222 eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
228 template<
int LoadMode>
229 EIGEN_STRONG_INLINE PacketReturnType packetByOuterInner(Index outer, Index inner)
const
231 return packet<LoadMode>(rowIndexByOuterInner(outer, inner),
232 colIndexByOuterInner(outer, inner));
245 template<
int LoadMode>
246 EIGEN_STRONG_INLINE PacketReturnType packet(Index index)
const
248 EIGEN_STATIC_ASSERT(internal::evaluator<Derived>::Flags &
LinearAccessBit,
249 THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
250 typedef typename internal::packet_traits<Scalar>::type DefaultPacketType;
251 eigen_internal_assert(index >= 0 && index < size());
252 return internal::evaluator<Derived>(derived()).template packet<LoadMode,DefaultPacketType>(index);
262 void coeffRefByOuterInner();
264 void writePacketByOuterInner();
266 void copyCoeffByOuterInner();
268 void copyPacketByOuterInner();
287template<
typename Derived>
296 typedef typename internal::packet_traits<Scalar>::type PacketScalar;
297 typedef typename NumTraits<Scalar>::Real
RealScalar;
304 using Base::rowIndexByOuterInner;
305 using Base::colIndexByOuterInner;
306 using Base::operator[];
307 using Base::operator();
330 eigen_internal_assert(row >= 0 && row < rows()
331 && col >= 0 && col < cols());
336 EIGEN_STRONG_INLINE Scalar&
337 coeffRefByOuterInner(Index outer, Index inner)
339 return coeffRef(rowIndexByOuterInner(outer, inner),
340 colIndexByOuterInner(outer, inner));
349 EIGEN_STRONG_INLINE Scalar&
352 eigen_assert(row >= 0 && row < rows()
353 && col >= 0 && col < cols());
354 return coeffRef(row, col);
374 EIGEN_STRONG_INLINE Scalar&
378 THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
379 eigen_internal_assert(index >= 0 && index < size());
391 EIGEN_STRONG_INLINE Scalar&
394 EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
395 THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
396 eigen_assert(index >= 0 && index < size());
397 return coeffRef(index);
410 EIGEN_STRONG_INLINE Scalar&
413 eigen_assert(index >= 0 && index < size());
414 return coeffRef(index);
420 EIGEN_STRONG_INLINE Scalar&
421 x() {
return (*
this)[0]; }
426 EIGEN_STRONG_INLINE Scalar&
427 y() {
return (*
this)[1]; }
432 EIGEN_STRONG_INLINE Scalar&
433 z() {
return (*
this)[2]; }
438 EIGEN_STRONG_INLINE Scalar&
439 w() {
return (*
this)[3]; }
453template<
typename Derived>
460 typedef typename NumTraits<Scalar>::Real
RealScalar;
474 return derived().innerStride();
485 return derived().outerStride();
489 inline Index stride()
const
491 return Derived::IsVectorAtCompileTime ? innerStride() : outerStride();
501 return Derived::IsRowMajor ? outerStride() : innerStride();
511 return Derived::IsRowMajor ? innerStride() : outerStride();
526template<
typename Derived>
534 typedef typename NumTraits<Scalar>::Real
RealScalar;
548 return derived().innerStride();
559 return derived().outerStride();
563 inline Index stride()
const
565 return Derived::IsVectorAtCompileTime ? innerStride() : outerStride();
575 return Derived::IsRowMajor ? outerStride() : innerStride();
585 return Derived::IsRowMajor ? innerStride() : outerStride();
591template<
int Alignment,
typename Derived,
bool JustReturnZero>
594 static inline Index run(
const Derived&)
598template<
int Alignment,
typename Derived>
601 static inline Index run(
const Derived& m)
603 return internal::first_aligned<Alignment>(&m.const_cast_derived().coeffRef(0,0), m.size());
614template<
int Alignment,
typename Derived>
618 return first_aligned_impl<Alignment, Derived, ReturnZero>::run(m.derived());
621template<
typename Derived>
622static inline Index first_default_aligned(
const DenseBase<Derived>& m)
624 typedef typename Derived::Scalar Scalar;
625 typedef typename packet_traits<Scalar>::type DefaultPacketType;
626 return internal::first_aligned<int(unpacket_traits<DefaultPacketType>::alignment),Derived>(m);
629template<typename Derived, bool HasDirectAccess = has_direct_access<Derived>::ret>
635template<
typename Derived>
647template<
typename Derived>
EIGEN_DEVICE_FUNC Index innerStride() const
Definition DenseCoeffsBase.h:472
EIGEN_DEVICE_FUNC Index outerStride() const
Definition DenseCoeffsBase.h:483
EIGEN_DEVICE_FUNC Index rowStride() const
Definition DenseCoeffsBase.h:499
EIGEN_DEVICE_FUNC Index colStride() const
Definition DenseCoeffsBase.h:509
EIGEN_DEVICE_FUNC Index outerStride() const
Definition DenseCoeffsBase.h:557
EIGEN_DEVICE_FUNC Index innerStride() const
Definition DenseCoeffsBase.h:546
EIGEN_DEVICE_FUNC Index rowStride() const
Definition DenseCoeffsBase.h:573
EIGEN_DEVICE_FUNC Index colStride() const
Definition DenseCoeffsBase.h:583
Base class providing read-only coefficient access to matrices and arrays.
Definition DenseCoeffsBase.h:35
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator()(Index row, Index col) const
Definition DenseCoeffsBase.h:115
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType x() const
equivalent to operator[](0).
Definition DenseCoeffsBase.h:188
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType w() const
equivalent to operator[](3).
Definition DenseCoeffsBase.h:206
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator()(Index index) const
Definition DenseCoeffsBase.h:178
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType z() const
equivalent to operator[](2).
Definition DenseCoeffsBase.h:200
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator[](Index index) const
Definition DenseCoeffsBase.h:158
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
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
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType y() const
equivalent to operator[](1).
Definition DenseCoeffsBase.h:194
Base class providing read/write coefficient access to matrices and arrays.
Definition DenseCoeffsBase.h:289
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & x()
equivalent to operator[](0).
Definition DenseCoeffsBase.h:421
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator[](Index index)
Definition DenseCoeffsBase.h:392
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & y()
equivalent to operator[](1).
Definition DenseCoeffsBase.h:427
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:328
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator()(Index row, Index col)
Definition DenseCoeffsBase.h:350
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & z()
equivalent to operator[](2).
Definition DenseCoeffsBase.h:433
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & operator()(Index index)
Definition DenseCoeffsBase.h:411
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Short version: don't use this function, use operator[](Index) instead.
Definition DenseCoeffsBase.h:375
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & w()
equivalent to operator[](3).
Definition DenseCoeffsBase.h:439
Definition ForwardDeclarations.h:54
Pseudo expression representing a solving operation.
Definition Solve.h:63
@ DirectAccessors
Direct read-only access to the coefficients.
Definition Constants.h:370
@ ReadOnlyAccessors
Read-only access via a member function.
Definition Constants.h:366
@ WriteAccessors
Read/write access via member functions.
Definition Constants.h:368
@ DirectWriteAccessors
Direct read/write access to the coefficients.
Definition Constants.h:372
const unsigned int LinearAccessBit
Short version: means the expression can be seen as 1D vector.
Definition Constants.h:124
const unsigned int DirectAccessBit
Means that the underlying array of coefficients can be directly accessed as a plain strided array.
Definition Constants.h:149
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition Constants.h:138
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:61
Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor Matrix...
Definition EigenBase.h:29
Eigen::Index Index
The interface type of indices.
Definition EigenBase.h:37
Definition DenseCoeffsBase.h:17
Definition CoreEvaluators.h:82
Definition DenseCoeffsBase.h:593
Definition DenseCoeffsBase.h:631
Definition DenseCoeffsBase.h:643
Definition ForwardDeclarations.h:17