Patch by Gael Guennebaud: coeff-wise binary operators.

This unifies + and - and moreover this patch introduces
coeff-wise * and / based on this. Also, corresponding test.
This commit is contained in:
Benoit Jacob
2008-02-29 14:35:14 +00:00
parent f12e9c53ac
commit a2f8d4be6a
9 changed files with 331 additions and 9 deletions

View File

@@ -69,7 +69,7 @@ struct DotUnroller<Index, 0, Derived1, Derived2>
*/
template<typename Scalar, typename Derived>
template<typename OtherDerived>
Scalar MatrixBase<Scalar, Derived>::dot(const OtherDerived& other) const
Scalar MatrixBase<Scalar, Derived>::dot(const MatrixBase<Scalar, OtherDerived>& other) const
{
assert(Traits::IsVectorAtCompileTime
&& OtherDerived::Traits::IsVectorAtCompileTime
@@ -79,7 +79,7 @@ Scalar MatrixBase<Scalar, Derived>::dot(const OtherDerived& other) const
&& Traits::SizeAtCompileTime != Dynamic
&& Traits::SizeAtCompileTime <= 16)
DotUnroller<Traits::SizeAtCompileTime-1, Traits::SizeAtCompileTime,
Derived, OtherDerived>
Derived, MatrixBase<Scalar, OtherDerived> >
::run(*static_cast<const Derived*>(this), other, res);
else
{
@@ -136,7 +136,7 @@ MatrixBase<Scalar, Derived>::normalized() const
template<typename Scalar, typename Derived>
template<typename OtherDerived>
bool MatrixBase<Scalar, Derived>::isOrtho
(const OtherDerived& other,
(const MatrixBase<Scalar, OtherDerived>& other,
typename NumTraits<Scalar>::Real prec) const
{
return ei_abs2(dot(other)) <= prec * prec * norm2() * other.norm2();