diff options
author | Gael Guennebaud <g.gael@free.fr> | 2017-08-22 13:27:37 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2017-08-22 13:27:37 +0200 |
commit | e27f17bf5c921dca73b4d2dc1a90863b36292fdc (patch) | |
tree | 80ad04455c6c877271c566482e291d712480d260 /Eigen/src/Core/Map.h | |
parent | 21d0a0bcf5eef2fb89f1ca48b65d52ec03e97272 (diff) |
Gub 1453: fix Map with non-default inner-stride but no outer-stride.
Diffstat (limited to 'Eigen/src/Core/Map.h')
-rw-r--r-- | Eigen/src/Core/Map.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h index 06d196702..7ca6a9280 100644 --- a/Eigen/src/Core/Map.h +++ b/Eigen/src/Core/Map.h @@ -20,11 +20,17 @@ struct traits<Map<PlainObjectType, MapOptions, StrideType> > { typedef traits<PlainObjectType> TraitsBase; enum { + PlainObjectTypeInnerSize = ((traits<PlainObjectType>::Flags&RowMajorBit)==RowMajorBit) + ? PlainObjectType::ColsAtCompileTime + : PlainObjectType::RowsAtCompileTime, + InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0 ? int(PlainObjectType::InnerStrideAtCompileTime) : int(StrideType::InnerStrideAtCompileTime), OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 - ? int(PlainObjectType::OuterStrideAtCompileTime) + ? (InnerStrideAtCompileTime==Dynamic || PlainObjectTypeInnerSize==Dynamic + ? Dynamic + : int(InnerStrideAtCompileTime) * int(PlainObjectTypeInnerSize)) : int(StrideType::OuterStrideAtCompileTime), Alignment = int(MapOptions)&int(AlignedMask), Flags0 = TraitsBase::Flags & (~NestByRefBit), @@ -108,9 +114,10 @@ template<typename PlainObjectType, int MapOptions, typename StrideType> class Ma inline Index outerStride() const { return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer() - : IsVectorAtCompileTime ? this->size() - : int(Flags)&RowMajorBit ? this->cols() - : this->rows(); + : internal::traits<Map>::OuterStrideAtCompileTime != Dynamic ? internal::traits<Map>::OuterStrideAtCompileTime + : IsVectorAtCompileTime ? (this->size() * innerStride()) + : int(Flags)&RowMajorBit ? (this->cols() * innerStride()) + : (this->rows() * innerStride()); } /** Constructor in the fixed-size case. |