From 0885320603fb3139fbfd8f8094ed7895980d4d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 31 Jan 2013 19:18:34 +0100 Subject: [PATCH] Math: vector dot product in terms of component-wise multiply and sum. Less SIMD alternatives to implement in the future. --- src/Math/Vector.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Math/Vector.h b/src/Math/Vector.h index 6bf8eadb4..6744acb13 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -73,13 +73,8 @@ template class Vector { * @f] * @see dot() const */ - static T dot(const Vector& a, const Vector& b) { - T out(0); - - for(std::size_t i = 0; i != size; ++i) - out += a[i]*b[i]; - - return out; + inline static T dot(const Vector& a, const Vector& b) { + return (a*b).sum(); } /**