add operators *= and /=

This commit is contained in:
Benoit Jacob
2007-09-27 19:20:06 +00:00
parent 628b1a8f6d
commit d99d9407df
8 changed files with 70 additions and 11 deletions

View File

@@ -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