summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Linear.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Linear.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/Linear.hs11
1 files changed, 11 insertions, 0 deletions
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
132 equal u v = dim u == dim v && vectorMax (mapVector magnitude (sub u v)) == 0.0 132 equal u v = dim u == dim v && vectorMax (mapVector magnitude (sub u v)) == 0.0
133 scalar x = fromList [x] 133 scalar x = fromList [x]
134 134
135instance Linear Vector (Complex Float) where
136 scale = vectorMapValQ Scale
137 scaleRecip = vectorMapValQ Recip
138 addConstant = vectorMapValQ AddConstant
139 add = vectorZipQ Add
140 sub = vectorZipQ Sub
141 mul = vectorZipQ Mul
142 divide = vectorZipQ Div
143 equal u v = dim u == dim v && vectorMax (mapVector magnitude (sub u v)) == 0.0
144 scalar x = fromList [x]
145
135instance (Linear Vector a, Container Matrix a) => (Linear Matrix a) where 146instance (Linear Vector a, Container Matrix a) => (Linear Matrix a) where
136 scale x = liftMatrix (scale x) 147 scale x = liftMatrix (scale x)
137 scaleRecip x = liftMatrix (scaleRecip x) 148 scaleRecip x = liftMatrix (scaleRecip x)