mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
add operators *= and /=
This commit is contained in:
@@ -149,13 +149,6 @@ template<typename Lhs, typename Rhs> class MatrixProduct
|
||||
const RhsRef m_rhs;
|
||||
};
|
||||
|
||||
template<typename Scalar, typename Derived1, typename Derived2>
|
||||
MatrixProduct<Derived1, Derived2>
|
||||
operator*(const EigenBase<Scalar, Derived1> &mat1, const EigenBase<Scalar, Derived2> &mat2)
|
||||
{
|
||||
return MatrixProduct<Derived1, Derived2>(mat1.ref(), mat2.ref());
|
||||
}
|
||||
|
||||
template<typename Scalar, typename Derived1, typename Derived2>
|
||||
MatrixSum<Derived1, Derived2>
|
||||
operator+(const EigenBase<Scalar, Derived1> &mat1, const EigenBase<Scalar, Derived2> &mat2)
|
||||
@@ -170,6 +163,13 @@ operator-(const EigenBase<Scalar, Derived1> &mat1, const EigenBase<Scalar, Deriv
|
||||
return MatrixDifference<Derived1, Derived2>(mat1.ref(), mat2.ref());
|
||||
}
|
||||
|
||||
template<typename Scalar, typename Derived1, typename Derived2>
|
||||
MatrixProduct<Derived1, Derived2>
|
||||
operator*(const EigenBase<Scalar, Derived1> &mat1, const EigenBase<Scalar, Derived2> &mat2)
|
||||
{
|
||||
return MatrixProduct<Derived1, Derived2>(mat1.ref(), mat2.ref());
|
||||
}
|
||||
|
||||
template<typename Scalar, typename Derived>
|
||||
template<typename OtherDerived>
|
||||
Derived &
|
||||
@@ -188,6 +188,15 @@ EigenBase<Scalar, Derived>::operator-=(const EigenBase<Scalar, OtherDerived> &ot
|
||||
return *static_cast<Derived*>(this);
|
||||
}
|
||||
|
||||
template<typename Scalar, typename Derived>
|
||||
template<typename OtherDerived>
|
||||
Derived &
|
||||
EigenBase<Scalar, Derived>::operator*=(const EigenBase<Scalar, OtherDerived> &other)
|
||||
{
|
||||
*this = *this * other;
|
||||
return *static_cast<Derived*>(this);
|
||||
}
|
||||
|
||||
} // namespace Eigen
|
||||
|
||||
#endif // EIGEN_MATRIXOPS_H
|
||||
|
||||
Reference in New Issue
Block a user