diff options
author | 2021-01-27 23:29:33 +0100 | |
---|---|---|
committer | 2021-01-27 23:32:12 +0100 | |
commit | 0668c68b031351488712f21290c77412b02c5de8 (patch) | |
tree | e7179ffbeb1d7681cda08070d259615989e42eef /Eigen | |
parent | 288d456c2951013e423ae4107f0207ef4594bb45 (diff) |
Allow for negative strides.
Note that using a stride of -1 is still not possible because it would
clash with the definition of Eigen::Dynamic.
This fixes #747.
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/Stride.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Eigen/src/Core/Stride.h b/Eigen/src/Core/Stride.h index 513742f34..cbcb0a503 100644 --- a/Eigen/src/Core/Stride.h +++ b/Eigen/src/Core/Stride.h @@ -26,7 +26,7 @@ namespace Eigen { * * 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. * @@ -38,6 +38,10 @@ namespace Eigen { * \include Map_general_stride.cpp * Output: \verbinclude Map_general_stride.out * + * Both strides can be negative, however, a negative stride of -1 cannot be specified at compiletime + * because of the ambiguity with Dynamic which is defined to -1 (historically, negative strides were + * not allowed). + * * \sa class InnerStride, class OuterStride, \ref TopicStorageOrders */ template<int _OuterStrideAtCompileTime, int _InnerStrideAtCompileTime> @@ -55,6 +59,8 @@ class Stride Stride() : m_outer(OuterStrideAtCompileTime), m_inner(InnerStrideAtCompileTime) { + // FIXME: for Eigen 4 we should use DynamicIndex instead of Dynamic. + // FIXME: for Eigen 4 we should also unify this API with fix<> eigen_assert(InnerStrideAtCompileTime != Dynamic && OuterStrideAtCompileTime != Dynamic); } @@ -63,7 +69,6 @@ class Stride Stride(Index outerStride, Index innerStride) : m_outer(outerStride), m_inner(innerStride) { - eigen_assert(innerStride>=0 && outerStride>=0); } /** Copy constructor */ |