From e0ddeef9edba613166ec6bc02c2d4309a651d5b9 Mon Sep 17 00:00:00 2001 From: hasufell Date: Wed, 17 Dec 2014 19:36:40 +0100 Subject: [PATCH] VEC: simplify scalarProd --- Algebra/Vector.hs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Algebra/Vector.hs b/Algebra/Vector.hs index 0f25d6d..bcd1dba 100644 --- a/Algebra/Vector.hs +++ b/Algebra/Vector.hs @@ -64,10 +64,7 @@ vecLength v = sqrt (x^(2 :: Int) + y^(2 :: Int)) -- |Compute the scalar product of two vectors. scalarProd :: Vec -> Vec -> Double -scalarProd v1 v2 = a1 * b1 + a2 * b2 - where - (a1, a2) = unr2 v1 - (b1, b2) = unr2 v2 +scalarProd (R2 a1 a2) (R2 b1 b2) = a1 * b1 + a2 * b2 -- |Construct a vector that points to a point from the origin.