mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-18 14:34:17 +08:00
Fix super-nasty bug in the declaration of the storage array of fixed-size matrices.
Also some simplifications.
This commit is contained in:
parent
7d41ad9d90
commit
023773beaa
@ -48,7 +48,7 @@ template<typename Lhs, typename Rhs> class EiSum
|
|||||||
|
|
||||||
EiSum(const EiSum& other)
|
EiSum(const EiSum& other)
|
||||||
: m_lhs(other.m_lhs), m_rhs(other.m_rhs) {}
|
: m_lhs(other.m_lhs), m_rhs(other.m_rhs) {}
|
||||||
|
|
||||||
EI_INHERIT_ASSIGNMENT_OPERATORS(EiSum)
|
EI_INHERIT_ASSIGNMENT_OPERATORS(EiSum)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -194,8 +194,7 @@ template<typename OtherDerived>
|
|||||||
Derived &
|
Derived &
|
||||||
EiObject<Scalar, Derived>::operator+=(const EiObject<Scalar, OtherDerived>& other)
|
EiObject<Scalar, Derived>::operator+=(const EiObject<Scalar, OtherDerived>& other)
|
||||||
{
|
{
|
||||||
*this = *this + other;
|
return *this = *this + other;
|
||||||
return *static_cast<Derived*>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Scalar, typename Derived>
|
template<typename Scalar, typename Derived>
|
||||||
@ -203,8 +202,7 @@ template<typename OtherDerived>
|
|||||||
Derived &
|
Derived &
|
||||||
EiObject<Scalar, Derived>::operator-=(const EiObject<Scalar, OtherDerived> &other)
|
EiObject<Scalar, Derived>::operator-=(const EiObject<Scalar, OtherDerived> &other)
|
||||||
{
|
{
|
||||||
*this = *this - other;
|
return *this = *this - other;
|
||||||
return *static_cast<Derived*>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Scalar, typename Derived>
|
template<typename Scalar, typename Derived>
|
||||||
@ -212,8 +210,7 @@ template<typename OtherDerived>
|
|||||||
Derived &
|
Derived &
|
||||||
EiObject<Scalar, Derived>::operator*=(const EiObject<Scalar, OtherDerived> &other)
|
EiObject<Scalar, Derived>::operator*=(const EiObject<Scalar, OtherDerived> &other)
|
||||||
{
|
{
|
||||||
*this = *this * other;
|
return *this = *this * other;
|
||||||
return *static_cast<Derived*>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // EI_MATRIXOPS_H
|
#endif // EI_MATRIXOPS_H
|
||||||
|
@ -48,7 +48,6 @@ template<typename MatrixType> class EiMatrixConstRef
|
|||||||
return m_matrix._read(row, col);
|
return m_matrix._read(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
const MatrixType& m_matrix;
|
const MatrixType& m_matrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ template<typename Scalar,
|
|||||||
class EiMatrixStorage
|
class EiMatrixStorage
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
Scalar m_array[RowsAtCompileTime * RowsAtCompileTime];
|
Scalar m_array[RowsAtCompileTime * ColsAtCompileTime];
|
||||||
|
|
||||||
void resize(int rows, int cols)
|
void resize(int rows, int cols)
|
||||||
{ assert(rows == RowsAtCompileTime && cols == ColsAtCompileTime); }
|
{ assert(rows == RowsAtCompileTime && cols == ColsAtCompileTime); }
|
||||||
|
@ -92,16 +92,14 @@ template<typename Scalar, typename Derived> \
|
|||||||
Derived & \
|
Derived & \
|
||||||
EiObject<Scalar, Derived>::operator*=(const OtherScalar &other) \
|
EiObject<Scalar, Derived>::operator*=(const OtherScalar &other) \
|
||||||
{ \
|
{ \
|
||||||
*this = *this * other; \
|
return *this = *this * other; \
|
||||||
return *static_cast<Derived*>(this); \
|
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
template<typename Scalar, typename Derived> \
|
template<typename Scalar, typename Derived> \
|
||||||
Derived & \
|
Derived & \
|
||||||
EiObject<Scalar, Derived>::operator/=(const OtherScalar &other) \
|
EiObject<Scalar, Derived>::operator/=(const OtherScalar &other) \
|
||||||
{ \
|
{ \
|
||||||
*this = *this / other; \
|
return *this = *this / other; \
|
||||||
return *static_cast<Derived*>(this); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EI_MAKE_SCALAR_OPS(int)
|
EI_MAKE_SCALAR_OPS(int)
|
||||||
|
Loading…
Reference in New Issue
Block a user