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

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

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

Public Types

typedef EigenBase< Derived > Base
 
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 internal::packet_traits< Scalar >::type PacketScalar
 
typedef internal::traits< Derived >::Scalar Scalar
 
typedef internal::traits< Derived >::StorageKind StorageKind
 
- 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

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

Protected Member Functions

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

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

Definition at line 37 of file DenseCoeffsBase.h.

Member Typedef Documentation

◆ Base

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

Definition at line 60 of file DenseCoeffsBase.h.

◆ 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

Definition at line 54 of file DenseCoeffsBase.h.

◆ PacketReturnType

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

Definition at line 58 of file DenseCoeffsBase.h.

◆ PacketScalar

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

Definition at line 42 of file DenseCoeffsBase.h.

◆ Scalar

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

Definition at line 41 of file DenseCoeffsBase.h.

◆ StorageKind

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

Definition at line 40 of file DenseCoeffsBase.h.

Member Function Documentation

◆ coeff() [1/2]

template<typename Derived >
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

Definition at line 142 of file DenseCoeffsBase.h.

143  {
144  EIGEN_STATIC_ASSERT(internal::evaluator<Derived>::Flags & LinearAccessBit,
145  THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
146  eigen_internal_assert(index >= 0 && index < size());
147  return internal::evaluator<Derived>(derived()).coeff(index);
148  }
#define eigen_internal_assert(x)
Definition: Macros.h:908
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT
Definition: EigenBase.h:69
const unsigned int LinearAccessBit
Definition: Constants.h:132

◆ coeff() [2/2]

template<typename Derived >
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

Definition at line 99 of file DenseCoeffsBase.h.

100  {
101  eigen_internal_assert(row >= 0 && row < rows()
102  && col >= 0 && col < cols());
103  return internal::evaluator<Derived>(derived()).coeff(row,col);
104  }
RowXpr row(Index i)
This is the const version of row(). *‍/.
ColXpr col(Index i)
This is the const version of col().
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: EigenBase.h:65
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: EigenBase.h:62

◆ coeffByOuterInner()

template<typename Derived >
CoeffReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::coeffByOuterInner ( Index  outer,
Index  inner 
) const
inline

Definition at line 107 of file DenseCoeffsBase.h.

108  {
109  return coeff(rowIndexByOuterInner(outer, inner),
110  colIndexByOuterInner(outer, inner));
111  }
Index colIndexByOuterInner(Index outer, Index inner) const
Index rowIndexByOuterInner(Index outer, Index inner) const
CoeffReturnType coeff(Index row, Index col) const

◆ 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 >
Index Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::colIndexByOuterInner ( Index  outer,
Index  inner 
) const
inline

Definition at line 76 of file DenseCoeffsBase.h.

77  {
78  return int(Derived::ColsAtCompileTime) == 1 ? 0
79  : int(Derived::RowsAtCompileTime) == 1 ? inner
80  : int(Derived::Flags)&RowMajorBit ? inner
81  : outer;
82  }
const unsigned int RowMajorBit
Definition: Constants.h:68

◆ cols()

template<typename Derived >
EIGEN_CONSTEXPR Index Eigen::EigenBase< Derived >::cols ( void  )
inline
Returns
the number of columns.
See also
rows(), ColsAtCompileTime

Definition at line 65 of file EigenBase.h.

65 { return derived().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 >
Derived& Eigen::EigenBase< Derived >::derived
inline
Returns
a reference to the derived object

Definition at line 48 of file EigenBase.h.

48 { return *static_cast<Derived*>(this); }

◆ derived() [2/2]

template<typename Derived >
const Derived& Eigen::EigenBase< Derived >::derived
inline
Returns
a const reference to the derived object

Definition at line 51 of file EigenBase.h.

51 { return *static_cast<const Derived*>(this); }

◆ innerStride()

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

◆ operator()() [1/2]

template<typename Derived >
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

Definition at line 181 of file DenseCoeffsBase.h.

182  {
183  eigen_assert(index >= 0 && index < size());
184  return coeff(index);
185  }
#define eigen_assert(x)
Definition: Macros.h:902

◆ operator()() [2/2]

template<typename Derived >
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)

Definition at line 118 of file DenseCoeffsBase.h.

119  {
120  eigen_assert(row >= 0 && row < rows()
121  && col >= 0 && col < cols());
122  return coeff(row, col);
123  }

◆ operator[]()

template<typename Derived >
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

Definition at line 161 of file DenseCoeffsBase.h.

162  {
163  EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
164  THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
165  eigen_assert(index >= 0 && index < size());
166  return coeff(index);
167  }

◆ outerStride()

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

◆ packet() [1/2]

template<typename Derived >
template<int LoadMode>
PacketReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::packet ( Index  index) const
inline

Definition at line 261 of file DenseCoeffsBase.h.

262  {
263  EIGEN_STATIC_ASSERT(internal::evaluator<Derived>::Flags & LinearAccessBit,
264  THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
265  typedef typename internal::packet_traits<Scalar>::type DefaultPacketType;
266  eigen_internal_assert(index >= 0 && index < size());
267  return internal::evaluator<Derived>(derived()).template packet<LoadMode,DefaultPacketType>(index);
268  }

◆ packet() [2/2]

template<typename Derived >
template<int LoadMode>
PacketReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::packet ( Index  row,
Index  col 
) const
inline

Definition at line 234 of file DenseCoeffsBase.h.

235  {
236  typedef typename internal::packet_traits<Scalar>::type DefaultPacketType;
237  eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
238  return internal::evaluator<Derived>(derived()).template packet<LoadMode,DefaultPacketType>(row,col);
239  }

◆ packetByOuterInner()

template<typename Derived >
template<int LoadMode>
PacketReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::packetByOuterInner ( Index  outer,
Index  inner 
) const
inline

Definition at line 244 of file DenseCoeffsBase.h.

245  {
246  return packet<LoadMode>(rowIndexByOuterInner(outer, inner),
247  colIndexByOuterInner(outer, inner));
248  }

◆ rowIndexByOuterInner()

template<typename Derived >
Index Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::rowIndexByOuterInner ( Index  outer,
Index  inner 
) const
inline

Definition at line 67 of file DenseCoeffsBase.h.

68  {
69  return int(Derived::RowsAtCompileTime) == 1 ? 0
70  : int(Derived::ColsAtCompileTime) == 1 ? inner
71  : int(Derived::Flags)&RowMajorBit ? outer
72  : inner;
73  }

◆ rows()

template<typename Derived >
EIGEN_CONSTEXPR Index Eigen::EigenBase< Derived >::rows ( void  )
inline
Returns
the number of rows.
See also
cols(), RowsAtCompileTime

Definition at line 62 of file EigenBase.h.

62 { return derived().rows(); }

◆ rowStride()

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

◆ size()

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

Definition at line 69 of file EigenBase.h.

69 { return rows() * cols(); }

◆ stride()

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

◆ w()

template<typename Derived >
CoeffReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::w ( ) const
inline

equivalent to operator[](3).

Definition at line 217 of file DenseCoeffsBase.h.

218  {
219  EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS);
220  return (*this)[3];
221  }

◆ writePacket()

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

◆ writePacketByOuterInner()

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

◆ x()

template<typename Derived >
CoeffReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::x ( ) const
inline

equivalent to operator[](0).

Definition at line 191 of file DenseCoeffsBase.h.

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

◆ y()

template<typename Derived >
CoeffReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::y ( ) const
inline

equivalent to operator[](1).

Definition at line 197 of file DenseCoeffsBase.h.

198  {
199  EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS);
200  return (*this)[1];
201  }

◆ z()

template<typename Derived >
CoeffReturnType Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >::z ( ) const
inline

equivalent to operator[](2).

Definition at line 207 of file DenseCoeffsBase.h.

208  {
209  EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS);
210  return (*this)[2];
211  }

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