summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Instances.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Instances.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/Instances.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Numeric/LinearAlgebra/Instances.hs b/lib/Numeric/LinearAlgebra/Instances.hs
index 4ee576f..3f295bf 100644
--- a/lib/Numeric/LinearAlgebra/Instances.hs
+++ b/lib/Numeric/LinearAlgebra/Instances.hs
@@ -29,7 +29,7 @@ import Foreign(Storable)
29 29
30------------------------------------------------------------------ 30------------------------------------------------------------------
31 31
32instance (Show a, Field a) => (Show (Matrix a)) where 32instance (Show a, Element a) => (Show (Matrix a)) where
33 show m = (sizes++) . dsp . map (map show) . toLists $ m 33 show m = (sizes++) . dsp . map (map show) . toLists $ m
34 where sizes = "("++show (rows m)++"><"++show (cols m)++")\n" 34 where sizes = "("++show (rows m)++"><"++show (cols m)++")\n"
35 35
@@ -51,7 +51,7 @@ adaptScalar f1 f2 f3 x y
51 | dim y == 1 = f3 x (y@>0) 51 | dim y == 1 = f3 x (y@>0)
52 | otherwise = f2 x y 52 | otherwise = f2 x y
53 53
54liftMatrix2' :: (Field t, Field a, Field b) => (Vector a -> Vector b -> Vector t) -> Matrix a -> Matrix b -> Matrix t 54liftMatrix2' :: (Element t, Element a, Element b) => (Vector a -> Vector b -> Vector t) -> Matrix a -> Matrix b -> Matrix t
55liftMatrix2' f m1 m2 | compat' m1 m2 = reshape (max (cols m1) (cols m2)) (f (flatten m1) (flatten m2)) 55liftMatrix2' f m1 m2 | compat' m1 m2 = reshape (max (cols m1) (cols m2)) (f (flatten m1) (flatten m2))
56 | otherwise = error "nonconformant matrices in liftMatrix2'" 56 | otherwise = error "nonconformant matrices in liftMatrix2'"
57 57
@@ -60,7 +60,7 @@ compat' m1 m2 = rows m1 == 1 && cols m1 == 1
60 || rows m2 == 1 && cols m2 == 1 60 || rows m2 == 1 && cols m2 == 1
61 || rows m1 == rows m2 && cols m1 == cols m2 61 || rows m1 == rows m2 && cols m1 == cols m2
62 62
63instance (Eq a, Field a) => Eq (Vector a) where 63instance (Eq a, Element a) => Eq (Vector a) where
64 a == b = dim a == dim b && toList a == toList b 64 a == b = dim a == dim b && toList a == toList b
65 65
66instance (Linear Vector a) => Num (Vector a) where 66instance (Linear Vector a) => Num (Vector a) where
@@ -71,7 +71,7 @@ instance (Linear Vector a) => Num (Vector a) where
71 abs = liftVector abs 71 abs = liftVector abs
72 fromInteger = fromList . return . fromInteger 72 fromInteger = fromList . return . fromInteger
73 73
74instance (Eq a, Field a) => Eq (Matrix a) where 74instance (Eq a, Element a) => Eq (Matrix a) where
75 a == b = cols a == cols b && flatten a == flatten b 75 a == b = cols a == cols b && flatten a == flatten b
76 76
77instance (Linear Vector a) => Num (Matrix a) where 77instance (Linear Vector a) => Num (Matrix a) where