diff options
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Linear.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Linear.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Numeric/LinearAlgebra/Linear.hs b/lib/Numeric/LinearAlgebra/Linear.hs index c802712..481d72a 100644 --- a/lib/Numeric/LinearAlgebra/Linear.hs +++ b/lib/Numeric/LinearAlgebra/Linear.hs | |||
@@ -42,6 +42,17 @@ class (Container c e) => Linear c e where | |||
42 | equal :: c e -> c e -> Bool | 42 | equal :: c e -> c e -> Bool |
43 | 43 | ||
44 | 44 | ||
45 | instance Linear Vector Float where | ||
46 | scale = vectorMapValF Scale | ||
47 | scaleRecip = vectorMapValF Recip | ||
48 | addConstant = vectorMapValF AddConstant | ||
49 | add = vectorZipF Add | ||
50 | sub = vectorZipF Sub | ||
51 | mul = vectorZipF Mul | ||
52 | divide = vectorZipF Div | ||
53 | equal u v = dim u == dim v && vectorFMax (vectorMapF Abs (sub u v)) == 0.0 | ||
54 | scalar x = fromList [x] | ||
55 | |||
45 | instance Linear Vector Double where | 56 | instance Linear Vector Double where |
46 | scale = vectorMapValR Scale | 57 | scale = vectorMapValR Scale |
47 | scaleRecip = vectorMapValR Recip | 58 | scaleRecip = vectorMapValR Recip |