From 38329a806b0696a4b34f22968dbbb674544c4334 Mon Sep 17 00:00:00 2001 From: hasufell Date: Wed, 17 Dec 2014 19:41:15 +0100 Subject: [PATCH] VEC: move scalarMul from Test/Vector.hs to Algebra/Vector.hs --- Algebra/Vector.hs | 5 +++++ Test/Vector.hs | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Algebra/Vector.hs b/Algebra/Vector.hs index bcd1dba..ce9b795 100644 --- a/Algebra/Vector.hs +++ b/Algebra/Vector.hs @@ -67,6 +67,11 @@ scalarProd :: Vec -> Vec -> Double scalarProd (R2 a1 a2) (R2 b1 b2) = a1 * b1 + a2 * b2 +-- |Multiply a scalar with a vector. +scalarMul :: Double -> Vec -> Vec +scalarMul d (R2 a b) = R2 (a * d) (b * d) + + -- |Construct a vector that points to a point from the origin. pt2Vec :: PT -> Vec pt2Vec = r2 . unp2 diff --git a/Test/Vector.hs b/Test/Vector.hs index 1494d57..296e684 100644 --- a/Test/Vector.hs +++ b/Test/Vector.hs @@ -107,8 +107,6 @@ scalarProdProp3 r v1 v2 v3 = == r' * (v1' `scalarProd` v2') + (v1' `scalarProd` v3') where - scalarMul :: Double -> Vec -> Vec - scalarMul d (R2 a b) = R2 (a * d) (b * d) v1' = r2 . (fromIntegral *** fromIntegral) $ v1 v2' = r2 . (fromIntegral *** fromIntegral) $ v2 v3' = r2 . (fromIntegral *** fromIntegral) $ v3