Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors > Class Template Reference

Base class providing read-only coefficient access to matrices and arrays. More...

#include <DenseCoeffsBase.h>

+ Inheritance diagram for Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >:

Public Types

typedef internal::traits< Derived >::StorageKind StorageKind
 
typedef internal::traits< Derived >::Scalar Scalar
 
typedef internal::packet_traits< Scalar >::type PacketScalar
 
typedef std::conditional_t< bool(internal::traits< Derived >::Flags &LvalueBit), const Scalar &, std::conditional_t< internal::is_arithmetic< Scalar >::value, Scalar, const Scalar > > CoeffReturnType
 
typedef internal::add_const_on_value_type_if_arithmetic< typename internal::packet_traits< Scalar >::type >::type PacketReturnType
 
typedef EigenBase< Derived > Base
 
- Public Types inherited from Eigen::EigenBase< Derived >
typedef Eigen::Index Index
 The interface type of indices. More...
 
typedef internal::traits< Derived >::StorageKind StorageKind
 

Public Member Functions

EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rowIndexByOuterInner (Index outer, Index inner) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index colIndexByOuterInner (Index outer, Index inner) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType coeff (Index row, Index col) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType coeffByOuterInner (Index outer, Index inner) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType operator() (Index row, Index col) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType coeff (Index index) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType operator[] (Index index) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType operator() (Index index) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType x () const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType y () const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType z () const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType w () const
 
template<int LoadMode>
EIGEN_STRONG_INLINE PacketReturnType packet (Index row, Index col) const
 
template<int LoadMode>
EIGEN_STRONG_INLINE PacketReturnType packetByOuterInner (Index outer, Index inner) const
 
template<int LoadMode>
EIGEN_STRONG_INLINE PacketReturnType packet (Index index) const
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
constexpr EIGEN_DEVICE_FUNC Derived & derived ()
 
constexpr EIGEN_DEVICE_FUNC const Derived & derived () const
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size () const EIGEN_NOEXCEPT
 
- Public Member Functions inherited from Eigen::EigenBase< Derived >
constexpr EIGEN_DEVICE_FUNC Derived & derived ()
 
constexpr EIGEN_DEVICE_FUNC const Derived & derived () const
 
EIGEN_DEVICE_FUNC Derived & const_cast_derived () const
 
EIGEN_DEVICE_FUNC const Derived & const_derived () const
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size () const EIGEN_NOEXCEPT
 
template<typename Dest >
EIGEN_DEVICE_FUNC void evalTo (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void addTo (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void subTo (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void applyThisOnTheRight (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void applyThisOnTheLeft (Dest &dst) const
 
template<typename Device >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DeviceWrapper< Derived, Device > device (Device &device)
 
template<typename Device >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DeviceWrapper< const Derived, Device > device (Device &device) const
 

Protected Member Functions

void coeffRef ()
 
void coeffRefByOuterInner ()
 
void writePacket ()
 
void writePacketByOuterInner ()
 
void copyCoeff ()
 
void copyCoeffByOuterInner ()
 
void copyPacket ()
 
void copyPacketByOuterInner ()
 
void stride ()
 
void innerStride ()
 
void outerStride ()
 
void rowStride ()
 
void colStride ()
 

Detailed Description

template<typename Derived>
class Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >

Base class providing read-only coefficient access to matrices and arrays.

Template Parameters
DerivedType of the derived class
Note
ReadOnlyAccessors Constant indicating read-only access

This class defines the operator() const function and friends, which can be used to read specific entries of a matrix or array.

See also
DenseCoeffsBase<Derived, WriteAccessors>, DenseCoeffsBase<Derived, DirectAccessors>, The class hierarchy

Member Typedef Documentation

◆ Base

template<typename Derived >
typedef EigenBase<Derived> Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::Base

◆ CoeffReturnType

template<typename Derived >
typedef std::conditional_t<bool(internal::traits<Derived>::Flags& LvalueBit), const Scalar&, std::conditional_t<internal::is_arithmetic<Scalar>::value, Scalar, const Scalar> > Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::CoeffReturnType

◆ PacketReturnType

◆ PacketScalar

template<typename Derived >
typedef internal::packet_traits<Scalar>::type Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::PacketScalar

◆ Scalar

template<typename Derived >
typedef internal::traits<Derived>::Scalar Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::Scalar

◆ StorageKind

template<typename Derived >
typedef internal::traits<Derived>::StorageKind Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::StorageKind

Member Function Documentation

◆ coeff() [1/2]

template<typename Derived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::coeff ( Index  index) const
inline

Short version: don't use this function, use operator[](Index) const instead.

Long version: this function is similar to operator[](Index) const , but without the assertion. Use this for limiting the performance cost of debugging code when doing repeated coefficient access. Only use this when it is guaranteed that the parameter index is in range.

If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this function equivalent to operator[](Index) const .

See also
operator[](Index) const, coeffRef(Index), coeff(Index,Index) const
126  {
127  EIGEN_STATIC_ASSERT(internal::evaluator<Derived>::Flags & LinearAccessBit,
128  THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
129  eigen_internal_assert(index >= 0 && index < size());
130  return internal::evaluator<Derived>(derived()).coeff(index);
131  }
#define eigen_internal_assert(x)
Definition: Macros.h:916
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
constexpr EIGEN_DEVICE_FUNC Derived & derived()
Definition: EigenBase.h:49
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT
Definition: EigenBase.h:64
const unsigned int LinearAccessBit
Definition: Constants.h:133

References eigen_internal_assert, EIGEN_STATIC_ASSERT, Eigen::LinearAccessBit, and size.

◆ coeff() [2/2]

template<typename Derived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::coeff ( Index  row,
Index  col 
) const
inline

Short version: don't use this function, use operator()(Index,Index) const instead.

Long version: this function is similar to operator()(Index,Index) const , but without the assertion. Use this for limiting the performance cost of debugging code when doing repeated coefficient access. Only use this when it is guaranteed that the parameters row and col are in range.

If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this function equivalent to operator()(Index,Index) const .

See also
operator()(Index,Index) const, coeffRef(Index,Index), coeff(Index) const
92  {
93  eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
94  return internal::evaluator<Derived>(derived()).coeff(row, col);
95  }
m col(1)
m row(1)
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: EigenBase.h:61
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: EigenBase.h:59

References col(), cols, eigen_internal_assert, row(), and rows.

◆ coeffByOuterInner()

template<typename Derived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::coeffByOuterInner ( Index  outer,
Index  inner 
) const
inline
98  {
99  return coeff(rowIndexByOuterInner(outer, inner), colIndexByOuterInner(outer, inner));
100  }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index colIndexByOuterInner(Index outer, Index inner) const
Definition: DenseCoeffsBase.h:71
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType coeff(Index row, Index col) const
Definition: DenseCoeffsBase.h:92
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rowIndexByOuterInner(Index outer, Index inner) const
Definition: DenseCoeffsBase.h:64

◆ coeffRef()

template<typename Derived >
void Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::coeffRef ( )
protected

◆ coeffRefByOuterInner()

template<typename Derived >
void Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::coeffRefByOuterInner ( )
protected

◆ colIndexByOuterInner()

template<typename Derived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::colIndexByOuterInner ( Index  outer,
Index  inner 
) const
inline
71  {
72  return int(Derived::ColsAtCompileTime) == 1 ? 0
73  : int(Derived::RowsAtCompileTime) == 1 ? inner
74  : int(Derived::Flags) & RowMajorBit ? inner
75  : outer;
76  }
const unsigned int RowMajorBit
Definition: Constants.h:70
return int(ret)+1

References int(), and Eigen::RowMajorBit.

◆ cols()

◆ colStride()

template<typename Derived >
void Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::colStride ( )
protected

◆ copyCoeff()

template<typename Derived >
void Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::copyCoeff ( )
protected

◆ copyCoeffByOuterInner()

template<typename Derived >
void Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::copyCoeffByOuterInner ( )
protected

◆ copyPacket()

template<typename Derived >
void Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::copyPacket ( )
protected

◆ copyPacketByOuterInner()

template<typename Derived >
void Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::copyPacketByOuterInner ( )
protected

◆ derived() [1/2]

template<typename Derived >
constexpr EIGEN_DEVICE_FUNC Derived& Eigen::EigenBase< Derived >::derived
inlineconstexpr
Returns
a reference to the derived object
49 { return *static_cast<Derived*>(this); }

◆ derived() [2/2]

template<typename Derived >
constexpr EIGEN_DEVICE_FUNC const Derived& Eigen::EigenBase< Derived >::derived
inlineconstexpr
Returns
a const reference to the derived object
51 { return *static_cast<const Derived*>(this); }

◆ innerStride()

template<typename Derived >
void Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::innerStride ( )
protected

◆ operator()() [1/2]

template<typename Derived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::operator() ( Index  index) const
inline
Returns
the coefficient at given index.

This is synonymous to operator[](Index) const.

This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit.

See also
operator[](Index), operator()(Index,Index) const, x() const, y() const, z() const, w() const
158  {
159  eigen_assert(index >= 0 && index < size());
160  return coeff(index);
161  }
#define eigen_assert(x)
Definition: Macros.h:910

References eigen_assert, and size.

◆ operator()() [2/2]

template<typename Derived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::operator() ( Index  row,
Index  col 
) const
inline
Returns
the coefficient at given the given row and column.
See also
operator()(Index,Index), operator[](Index)
106  {
107  eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
108  return coeff(row, col);
109  }

References col(), cols, eigen_assert, row(), and rows.

◆ operator[]()

template<typename Derived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR CoeffReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::operator[] ( Index  index) const
inline
Returns
the coefficient at given index.

This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit.

See also
operator[](Index), operator()(Index,Index) const, x() const, y() const, z() const, w() const
141  {
142  EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
143  THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
144  eigen_assert(index >= 0 && index < size());
145  return coeff(index);
146  }

References eigen_assert, EIGEN_STATIC_ASSERT, and size.

◆ outerStride()

template<typename Derived >
void Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::outerStride ( )
protected

◆ packet() [1/2]

template<typename Derived >
template<int LoadMode>
EIGEN_STRONG_INLINE PacketReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::packet ( Index  index) const
inline
Returns
the packet of coefficients starting at the given index. It is your responsibility to ensure that a packet really starts there. This method is only available on expressions having the PacketAccessBit and the LinearAccessBit.

The LoadMode parameter may have the value Aligned or Unaligned. Its effect is to select the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets starting at an address which is a multiple of the packet size.

222  {
223  EIGEN_STATIC_ASSERT(internal::evaluator<Derived>::Flags & LinearAccessBit,
224  THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
225  typedef typename internal::packet_traits<Scalar>::type DefaultPacketType;
226  eigen_internal_assert(index >= 0 && index < size());
227  return internal::evaluator<Derived>(derived()).template packet<LoadMode, DefaultPacketType>(index);
228  }
Scalar type
Definition: GenericPacketMath.h:109

References eigen_internal_assert, EIGEN_STATIC_ASSERT, Eigen::LinearAccessBit, and size.

◆ packet() [2/2]

template<typename Derived >
template<int LoadMode>
EIGEN_STRONG_INLINE PacketReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::packet ( Index  row,
Index  col 
) const
inline
Returns
the packet of coefficients starting at the given row and column. It is your responsibility to ensure that a packet really starts there. This method is only available on expressions having the PacketAccessBit.

The LoadMode parameter may have the value Aligned or Unaligned. Its effect is to select the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets starting at an address which is a multiple of the packet size.

199  {
200  typedef typename internal::packet_traits<Scalar>::type DefaultPacketType;
201  eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
202  return internal::evaluator<Derived>(derived()).template packet<LoadMode, DefaultPacketType>(row, col);
203  }

References col(), cols, eigen_internal_assert, row(), and rows.

◆ packetByOuterInner()

template<typename Derived >
template<int LoadMode>
EIGEN_STRONG_INLINE PacketReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::packetByOuterInner ( Index  outer,
Index  inner 
) const
inline
207  {
208  return packet<LoadMode>(rowIndexByOuterInner(outer, inner), colIndexByOuterInner(outer, inner));
209  }

◆ rowIndexByOuterInner()

template<typename Derived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::rowIndexByOuterInner ( Index  outer,
Index  inner 
) const
inline
64  {
65  return int(Derived::RowsAtCompileTime) == 1 ? 0
66  : int(Derived::ColsAtCompileTime) == 1 ? inner
67  : int(Derived::Flags) & RowMajorBit ? outer
68  : inner;
69  }

References int(), and Eigen::RowMajorBit.

◆ rows()

◆ rowStride()

template<typename Derived >
void Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::rowStride ( )
protected

◆ size()

template<typename Derived >
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index Eigen::EigenBase< Derived >::size
inline
Returns
the number of coefficients, which is rows()*cols().
See also
rows(), cols(), SizeAtCompileTime.
64 { return rows() * cols(); }

◆ stride()

template<typename Derived >
void Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::stride ( )
protected

◆ w()

equivalent to operator[](3).

183  {
184  EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 4, OUT_OF_RANGE_ACCESS);
185  return (*this)[3];
186  }

References EIGEN_STATIC_ASSERT.

◆ writePacket()

template<typename Derived >
void Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::writePacket ( )
protected

◆ writePacketByOuterInner()

template<typename Derived >
void Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::writePacketByOuterInner ( )
protected

◆ x()

equivalent to operator[](0).

165 { return (*this)[0]; }

◆ y()

equivalent to operator[](1).

169  {
170  EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 2, OUT_OF_RANGE_ACCESS);
171  return (*this)[1];
172  }

References EIGEN_STATIC_ASSERT.

◆ z()

equivalent to operator[](2).

176  {
177  EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 3, OUT_OF_RANGE_ACCESS);
178  return (*this)[2];
179  }

References EIGEN_STATIC_ASSERT.


The documentation for this class was generated from the following file: