mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
expand unit-tests and fix const-qualifaction bugs thus discovered
This commit is contained in:
@@ -58,42 +58,42 @@ template<typename MatrixType> class ScalarMultiple : NoDefaultOperatorEquals,
|
||||
const Scalar m_scalar;
|
||||
};
|
||||
|
||||
#define EIGEN_MAKE_SCALAR_OPS(OtherScalar) \
|
||||
#define EIGEN_MAKE_SCALAR_OPS(OtherScalar) \
|
||||
template<typename Scalar, typename Derived> \
|
||||
ScalarMultiple<Derived> \
|
||||
operator*(const MatrixBase<Scalar, Derived>& matrix, \
|
||||
const ScalarMultiple<Derived> \
|
||||
operator*(const MatrixBase<Scalar, Derived>& matrix, \
|
||||
OtherScalar scalar) \
|
||||
{ \
|
||||
return ScalarMultiple<Derived>(matrix.ref(), scalar); \
|
||||
return ScalarMultiple<Derived>(matrix.ref(), scalar); \
|
||||
} \
|
||||
\
|
||||
template<typename Scalar, typename Derived> \
|
||||
ScalarMultiple<Derived> \
|
||||
const ScalarMultiple<Derived> \
|
||||
operator*(OtherScalar scalar, \
|
||||
const MatrixBase<Scalar, Derived>& matrix) \
|
||||
const MatrixBase<Scalar, Derived>& matrix) \
|
||||
{ \
|
||||
return ScalarMultiple<Derived>(matrix.ref(), scalar); \
|
||||
return ScalarMultiple<Derived>(matrix.ref(), scalar); \
|
||||
} \
|
||||
\
|
||||
template<typename Scalar, typename Derived> \
|
||||
ScalarMultiple<Derived> \
|
||||
operator/(const MatrixBase<Scalar, Derived>& matrix, \
|
||||
const ScalarMultiple<Derived> \
|
||||
operator/(const MatrixBase<Scalar, Derived>& matrix, \
|
||||
OtherScalar scalar) \
|
||||
{ \
|
||||
assert(NumTraits<Scalar>::HasFloatingPoint); \
|
||||
assert(NumTraits<Scalar>::HasFloatingPoint); \
|
||||
return matrix * (static_cast<Scalar>(1) / scalar); \
|
||||
} \
|
||||
\
|
||||
template<typename Scalar, typename Derived> \
|
||||
Derived & \
|
||||
MatrixBase<Scalar, Derived>::operator*=(const OtherScalar &other) \
|
||||
MatrixBase<Scalar, Derived>::operator*=(const OtherScalar &other) \
|
||||
{ \
|
||||
return *this = *this * other; \
|
||||
} \
|
||||
\
|
||||
template<typename Scalar, typename Derived> \
|
||||
Derived & \
|
||||
MatrixBase<Scalar, Derived>::operator/=(const OtherScalar &other) \
|
||||
MatrixBase<Scalar, Derived>::operator/=(const OtherScalar &other) \
|
||||
{ \
|
||||
return *this = *this / other; \
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user