VEC: move scalarMul from Test/Vector.hs to Algebra/Vector.hs
This commit is contained in:
parent
35e1366034
commit
38329a806b
@ -67,6 +67,11 @@ scalarProd :: Vec -> Vec -> Double
|
|||||||
scalarProd (R2 a1 a2) (R2 b1 b2) = a1 * b1 + a2 * b2
|
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.
|
-- |Construct a vector that points to a point from the origin.
|
||||||
pt2Vec :: PT -> Vec
|
pt2Vec :: PT -> Vec
|
||||||
pt2Vec = r2 . unp2
|
pt2Vec = r2 . unp2
|
||||||
|
@ -107,8 +107,6 @@ scalarProdProp3 r v1 v2 v3 =
|
|||||||
==
|
==
|
||||||
r' * (v1' `scalarProd` v2') + (v1' `scalarProd` v3')
|
r' * (v1' `scalarProd` v2') + (v1' `scalarProd` v3')
|
||||||
where
|
where
|
||||||
scalarMul :: Double -> Vec -> Vec
|
|
||||||
scalarMul d (R2 a b) = R2 (a * d) (b * d)
|
|
||||||
v1' = r2 . (fromIntegral *** fromIntegral) $ v1
|
v1' = r2 . (fromIntegral *** fromIntegral) $ v1
|
||||||
v2' = r2 . (fromIntegral *** fromIntegral) $ v2
|
v2' = r2 . (fromIntegral *** fromIntegral) $ v2
|
||||||
v3' = r2 . (fromIntegral *** fromIntegral) $ v3
|
v3' = r2 . (fromIntegral *** fromIntegral) $ v3
|
||||||
|
Loading…
Reference in New Issue
Block a user