mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-22 04:44:25 +08:00
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.
This commit is contained in:
parent
c2b8ca7493
commit
72044ca925
@ -99,7 +99,7 @@ template<typename Derived> class MapBase
|
|||||||
inline const Scalar coeff(int index) const
|
inline const Scalar coeff(int index) const
|
||||||
{
|
{
|
||||||
ei_assert(Derived::IsVectorAtCompileTime || (ei_traits<Derived>::Flags & LinearAccessBit));
|
ei_assert(Derived::IsVectorAtCompileTime || (ei_traits<Derived>::Flags & LinearAccessBit));
|
||||||
if ( ((RowsAtCompileTime == 1) == IsRowMajor) )
|
if ( ((RowsAtCompileTime == 1) == IsRowMajor) || !int(Derived::IsVectorAtCompileTime) )
|
||||||
return m_data[index];
|
return m_data[index];
|
||||||
else
|
else
|
||||||
return m_data[index*stride()];
|
return m_data[index*stride()];
|
||||||
@ -108,7 +108,7 @@ template<typename Derived> class MapBase
|
|||||||
inline Scalar& coeffRef(int index)
|
inline Scalar& coeffRef(int index)
|
||||||
{
|
{
|
||||||
ei_assert(Derived::IsVectorAtCompileTime || (ei_traits<Derived>::Flags & LinearAccessBit));
|
ei_assert(Derived::IsVectorAtCompileTime || (ei_traits<Derived>::Flags & LinearAccessBit));
|
||||||
if ( ((RowsAtCompileTime == 1) == IsRowMajor) )
|
if ( ((RowsAtCompileTime == 1) == IsRowMajor) || !int(Derived::IsVectorAtCompileTime) )
|
||||||
return const_cast<Scalar*>(m_data)[index];
|
return const_cast<Scalar*>(m_data)[index];
|
||||||
else
|
else
|
||||||
return const_cast<Scalar*>(m_data)[index*stride()];
|
return const_cast<Scalar*>(m_data)[index*stride()];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user