Eigen::Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ > Class Template Reference

Holds strides information for Map. More...

#include <Stride.h>

Public Types

enum  { InnerStrideAtCompileTime = InnerStrideAtCompileTime_ , OuterStrideAtCompileTime = OuterStrideAtCompileTime_ }
 
typedef Eigen::Index Index
 

Public Member Functions

EIGEN_DEVICE_FUNC Stride ()
 
EIGEN_DEVICE_FUNC Stride (Index outerStride, Index innerStride)
 
EIGEN_DEVICE_FUNC Stride (const Stride &other)
 
EIGEN_DEVICE_FUNC Strideoperator= (const Stride &other)
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outer () const
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index inner () const
 

Protected Attributes

internal::variable_if_dynamic< Index, OuterStrideAtCompileTimem_outer
 
internal::variable_if_dynamic< Index, InnerStrideAtCompileTimem_inner
 

Detailed Description

template<int OuterStrideAtCompileTime_, int InnerStrideAtCompileTime_>
class Eigen::Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ >

Holds strides information for Map.

This class holds the strides information for mapping arrays with strides with class Map.

It holds two values: the inner stride and the outer stride.

The inner stride is the pointer increment between two consecutive entries within a given row of a row-major matrix or within a given column of a column-major matrix.

The outer stride is the pointer increment between two consecutive rows of a row-major matrix or between two consecutive columns of a column-major matrix.

These two values can be passed either at compile-time as template parameters, or at runtime as arguments to the constructor.

Indeed, this class takes two template parameters:

Template Parameters
OuterStrideAtCompileTime_the outer stride, or Dynamic if you want to specify it at runtime.
InnerStrideAtCompileTime_the inner stride, or Dynamic if you want to specify it at runtime.

Here is an example:

int array[24];
for (int i = 0; i < 24; ++i) array[i] = i;
cout << Map<MatrixXi, 0, Stride<Dynamic, 2> >(array, 3, 3, Stride<Dynamic, 2>(8, 2)) << endl;
int i
Definition: BiCGSTAB_step_by_step.cpp:9
std::array< T, N > array
Definition: EmulateArray.h:231

Output:

Both strides can be negative. However, a negative stride of -1 cannot be specified at compile time because of the ambiguity with Dynamic which is defined to -1 (historically, negative strides were not allowed).

Note that for compile-time vectors (ColsAtCompileTime==1 or RowsAtCompile==1), the inner stride is the pointer increment between two consecutive elements, regardless of storage layout.

See also
class InnerStride, class OuterStride, TopicStorageOrders

Member Typedef Documentation

◆ Index

template<int OuterStrideAtCompileTime_, int InnerStrideAtCompileTime_>
typedef Eigen::Index Eigen::Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ >::Index
Deprecated:
since Eigen 3.3

Member Enumeration Documentation

◆ anonymous enum

template<int OuterStrideAtCompileTime_, int InnerStrideAtCompileTime_>
anonymous enum
Enumerator
InnerStrideAtCompileTime 
OuterStrideAtCompileTime 
58 { InnerStrideAtCompileTime = InnerStrideAtCompileTime_, OuterStrideAtCompileTime = OuterStrideAtCompileTime_ };
@ InnerStrideAtCompileTime
Definition: Stride.h:58
@ OuterStrideAtCompileTime
Definition: Stride.h:58

Constructor & Destructor Documentation

◆ Stride() [1/3]

template<int OuterStrideAtCompileTime_, int InnerStrideAtCompileTime_>
EIGEN_DEVICE_FUNC Eigen::Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ >::Stride ( )
inline

Default constructor, for use when strides are fixed at compile time

62  // FIXME: for Eigen 4 we should use DynamicIndex instead of Dynamic.
63  // FIXME: for Eigen 4 we should also unify this API with fix<>
65  }
#define eigen_assert(x)
Definition: Macros.h:910
internal::variable_if_dynamic< Index, InnerStrideAtCompileTime > m_inner
Definition: Stride.h:87
internal::variable_if_dynamic< Index, OuterStrideAtCompileTime > m_outer
Definition: Stride.h:86
const int Dynamic
Definition: Constants.h:25

References Eigen::Dynamic, eigen_assert, Eigen::Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ >::InnerStrideAtCompileTime, and Eigen::Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ >::OuterStrideAtCompileTime.

◆ Stride() [2/3]

template<int OuterStrideAtCompileTime_, int InnerStrideAtCompileTime_>
EIGEN_DEVICE_FUNC Eigen::Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ >::Stride ( Index  outerStride,
Index  innerStride 
)
inline

Constructor allowing to pass the strides at runtime

68 : m_outer(outerStride), m_inner(innerStride) {}

◆ Stride() [3/3]

template<int OuterStrideAtCompileTime_, int InnerStrideAtCompileTime_>
EIGEN_DEVICE_FUNC Eigen::Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ >::Stride ( const Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ > &  other)
inline

Copy constructor

71 : m_outer(other.outer()), m_inner(other.inner()) {}

Member Function Documentation

◆ inner()

template<int OuterStrideAtCompileTime_, int InnerStrideAtCompileTime_>
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index Eigen::Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ >::inner ( ) const
inline

◆ operator=()

template<int OuterStrideAtCompileTime_, int InnerStrideAtCompileTime_>
EIGEN_DEVICE_FUNC Stride& Eigen::Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ >::operator= ( const Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ > &  other)
inline

◆ outer()

template<int OuterStrideAtCompileTime_, int InnerStrideAtCompileTime_>
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index Eigen::Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ >::outer ( ) const
inline

Member Data Documentation

◆ m_inner

template<int OuterStrideAtCompileTime_, int InnerStrideAtCompileTime_>
internal::variable_if_dynamic<Index, InnerStrideAtCompileTime> Eigen::Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ >::m_inner
protected

◆ m_outer

template<int OuterStrideAtCompileTime_, int InnerStrideAtCompileTime_>
internal::variable_if_dynamic<Index, OuterStrideAtCompileTime> Eigen::Stride< OuterStrideAtCompileTime_, InnerStrideAtCompileTime_ >::m_outer
protected

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