summaryrefslogtreecommitdiff
path: root/lib/GSL/Compat.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-09-09 15:45:06 +0000
committerAlberto Ruiz <aruiz@um.es>2007-09-09 15:45:06 +0000
commit631a32fbdc0d61f647d3217da86bcb1d552e5e5a (patch)
tree2b81e4e6b9d7ae646787bc3ff8684b2d759b24c5 /lib/GSL/Compat.hs
parent34380f2b5d7b048a4d68197f16a8db0e53742030 (diff)
simplified (but wrong)
Diffstat (limited to 'lib/GSL/Compat.hs')
-rw-r--r--lib/GSL/Compat.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/GSL/Compat.hs b/lib/GSL/Compat.hs
index 809a1f5..1d6f7b9 100644
--- a/lib/GSL/Compat.hs
+++ b/lib/GSL/Compat.hs
@@ -38,7 +38,7 @@ adaptScalar f1 f2 f3 x y
38 | dim y == 1 = f3 x (y@>0) 38 | dim y == 1 = f3 x (y@>0)
39 | otherwise = f2 x y 39 | otherwise = f2 x y
40 40
41liftMatrix2' :: (Field t) => (Vector a -> Vector b -> Vector t) -> Matrix a -> Matrix b -> Matrix t 41liftMatrix2' :: (Field t, Field a, Field b) => (Vector a -> Vector b -> Vector t) -> Matrix a -> Matrix b -> Matrix t
42liftMatrix2' f m1 m2 | compat' m1 m2 = reshape (max (cols m1) (cols m2)) (f (cdat m1) (cdat m2)) 42liftMatrix2' f m1 m2 | compat' m1 m2 = reshape (max (cols m1) (cols m2)) (f (cdat m1) (cdat m2))
43 | otherwise = error "nonconformant matrices in liftMatrix2'" 43 | otherwise = error "nonconformant matrices in liftMatrix2'"
44 44
@@ -63,6 +63,7 @@ instance (Eq a, Field a) => Eq (Matrix a) where
63 63
64instance (Field a, Linear Vector a) => Num (Matrix a) where 64instance (Field a, Linear Vector a) => Num (Matrix a) where
65 (+) = liftMatrix2' (+) 65 (+) = liftMatrix2' (+)
66 (-) = liftMatrix2' (-)
66 negate = liftMatrix negate 67 negate = liftMatrix negate
67 (*) = liftMatrix2' (*) 68 (*) = liftMatrix2' (*)
68 signum = liftMatrix signum 69 signum = liftMatrix signum