VEC: move scalarMul from Test/Vector.hs to Algebra/Vector.hs

This commit is contained in:
hasufell 2014-12-17 19:41:15 +01:00
parent 35e1366034
commit 38329a806b
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
2 changed files with 5 additions and 2 deletions

View File

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

View File

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