summaryrefslogtreecommitdiff
path: root/packages/base/src/Numeric/Matrix.hs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base/src/Numeric/Matrix.hs')
-rw-r--r--packages/base/src/Numeric/Matrix.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/base/src/Numeric/Matrix.hs b/packages/base/src/Numeric/Matrix.hs
index 5400f26..06da150 100644
--- a/packages/base/src/Numeric/Matrix.hs
+++ b/packages/base/src/Numeric/Matrix.hs
@@ -32,8 +32,11 @@ import Internal.Element
32import Internal.Numeric 32import Internal.Numeric
33import qualified Data.Monoid as M 33import qualified Data.Monoid as M
34import Data.List(partition) 34import Data.List(partition)
35import qualified Data.Foldable as F
36import qualified Data.Semigroup as S
35import Internal.Chain 37import Internal.Chain
36 38
39
37------------------------------------------------------------------- 40-------------------------------------------------------------------
38 41
39instance Container Matrix a => Eq (Matrix a) where 42instance Container Matrix a => Eq (Matrix a) where
@@ -84,6 +87,11 @@ adaptScalarM f1 f2 f3 x y
84 | isScalar y = f3 x (y @@>(0,0) ) 87 | isScalar y = f3 x (y @@>(0,0) )
85 | otherwise = f2 x y 88 | otherwise = f2 x y
86 89
90instance (Container Vector t, Eq t, Num (Vector t), Product t) => S.Semigroup (Matrix t)
91 where
92 (<>) = mappend
93 sconcat = mconcat . F.toList
94
87instance (Container Vector t, Eq t, Num (Vector t), Product t) => M.Monoid (Matrix t) 95instance (Container Vector t, Eq t, Num (Vector t), Product t) => M.Monoid (Matrix t)
88 where 96 where
89 mempty = 1 97 mempty = 1