From 72044ca9259ca5242d971362d0f88ea9ce9df6cc Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 21 Jan 2010 23:33:20 -0500 Subject: [PATCH] fix a super nasty bug: on row-major expressions that are NOT vectors but that do have LinearAccess, the MapBase::coeff(int) and MapBase::coeffRef(int) methods were broken. --- Eigen/src/Core/MapBase.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Eigen/src/Core/MapBase.h b/Eigen/src/Core/MapBase.h index e79748e7d..72c208bc2 100644 --- a/Eigen/src/Core/MapBase.h +++ b/Eigen/src/Core/MapBase.h @@ -99,7 +99,7 @@ template class MapBase inline const Scalar coeff(int index) const { ei_assert(Derived::IsVectorAtCompileTime || (ei_traits::Flags & LinearAccessBit)); - if ( ((RowsAtCompileTime == 1) == IsRowMajor) ) + if ( ((RowsAtCompileTime == 1) == IsRowMajor) || !int(Derived::IsVectorAtCompileTime) ) return m_data[index]; else return m_data[index*stride()]; @@ -108,7 +108,7 @@ template class MapBase inline Scalar& coeffRef(int index) { ei_assert(Derived::IsVectorAtCompileTime || (ei_traits::Flags & LinearAccessBit)); - if ( ((RowsAtCompileTime == 1) == IsRowMajor) ) + if ( ((RowsAtCompileTime == 1) == IsRowMajor) || !int(Derived::IsVectorAtCompileTime) ) return const_cast(m_data)[index]; else return const_cast(m_data)[index*stride()];