diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-09-09 15:45:06 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-09-09 15:45:06 +0000 |
commit | 631a32fbdc0d61f647d3217da86bcb1d552e5e5a (patch) | |
tree | 2b81e4e6b9d7ae646787bc3ff8684b2d759b24c5 /lib/GSL/Compat.hs | |
parent | 34380f2b5d7b048a4d68197f16a8db0e53742030 (diff) |
simplified (but wrong)
Diffstat (limited to 'lib/GSL/Compat.hs')
-rw-r--r-- | lib/GSL/Compat.hs | 3 |
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 | ||
41 | liftMatrix2' :: (Field t) => (Vector a -> Vector b -> Vector t) -> Matrix a -> Matrix b -> Matrix t | 41 | liftMatrix2' :: (Field t, Field a, Field b) => (Vector a -> Vector b -> Vector t) -> Matrix a -> Matrix b -> Matrix t |
42 | liftMatrix2' f m1 m2 | compat' m1 m2 = reshape (max (cols m1) (cols m2)) (f (cdat m1) (cdat m2)) | 42 | liftMatrix2' 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 | ||
64 | instance (Field a, Linear Vector a) => Num (Matrix a) where | 64 | instance (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 |