diff options
Diffstat (limited to 'packages/base/src/Numeric/Matrix.hs')
-rw-r--r-- | packages/base/src/Numeric/Matrix.hs | 8 |
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 | |||
32 | import Internal.Numeric | 32 | import Internal.Numeric |
33 | import qualified Data.Monoid as M | 33 | import qualified Data.Monoid as M |
34 | import Data.List(partition) | 34 | import Data.List(partition) |
35 | import qualified Data.Foldable as F | ||
36 | import qualified Data.Semigroup as S | ||
35 | import Internal.Chain | 37 | import Internal.Chain |
36 | 38 | ||
39 | |||
37 | ------------------------------------------------------------------- | 40 | ------------------------------------------------------------------- |
38 | 41 | ||
39 | instance Container Matrix a => Eq (Matrix a) where | 42 | instance 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 | ||
90 | instance (Container Vector t, Eq t, Num (Vector t), Product t) => S.Semigroup (Matrix t) | ||
91 | where | ||
92 | (<>) = mappend | ||
93 | sconcat = mconcat . F.toList | ||
94 | |||
87 | instance (Container Vector t, Eq t, Num (Vector t), Product t) => M.Monoid (Matrix t) | 95 | instance (Container Vector t, Eq t, Num (Vector t), Product t) => M.Monoid (Matrix t) |
88 | where | 96 | where |
89 | mempty = 1 | 97 | mempty = 1 |