From 97e8a48be58fd53afccc7ae01ee6ec5805d5c1cd Mon Sep 17 00:00:00 2001 From: Vivian McPhail Date: Thu, 8 Jul 2010 23:03:48 +0000 Subject: Linear and Floating (Complex Float) --- lib/Numeric/LinearAlgebra/Linear.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/Numeric/LinearAlgebra/Linear.hs') diff --git a/lib/Numeric/LinearAlgebra/Linear.hs b/lib/Numeric/LinearAlgebra/Linear.hs index aed6a2b..2351ff1 100644 --- a/lib/Numeric/LinearAlgebra/Linear.hs +++ b/lib/Numeric/LinearAlgebra/Linear.hs @@ -132,6 +132,17 @@ instance Linear Vector (Complex Double) where equal u v = dim u == dim v && vectorMax (mapVector magnitude (sub u v)) == 0.0 scalar x = fromList [x] +instance Linear Vector (Complex Float) where + scale = vectorMapValQ Scale + scaleRecip = vectorMapValQ Recip + addConstant = vectorMapValQ AddConstant + add = vectorZipQ Add + sub = vectorZipQ Sub + mul = vectorZipQ Mul + divide = vectorZipQ Div + equal u v = dim u == dim v && vectorMax (mapVector magnitude (sub u v)) == 0.0 + scalar x = fromList [x] + instance (Linear Vector a, Container Matrix a) => (Linear Matrix a) where scale x = liftMatrix (scale x) scaleRecip x = liftMatrix (scaleRecip x) -- cgit v1.2.3