diff options
Diffstat (limited to 'packages/base/src/Numeric')
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra.hs | 4 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/HMatrix.hs | 4 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Static.hs | 4 | ||||
-rw-r--r-- | packages/base/src/Numeric/Matrix.hs | 8 |
4 files changed, 20 insertions, 0 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra.hs b/packages/base/src/Numeric/LinearAlgebra.hs index fd100e0..73d4a13 100644 --- a/packages/base/src/Numeric/LinearAlgebra.hs +++ b/packages/base/src/Numeric/LinearAlgebra.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | {-# LANGUAGE FlexibleContexts #-} | 2 | {-# LANGUAGE FlexibleContexts #-} |
2 | 3 | ||
3 | ----------------------------------------------------------------------------- | 4 | ----------------------------------------------------------------------------- |
@@ -190,6 +191,9 @@ import Internal.Random | |||
190 | import Internal.Sparse((!#>)) | 191 | import Internal.Sparse((!#>)) |
191 | import Internal.CG | 192 | import Internal.CG |
192 | import Internal.Conversion | 193 | import Internal.Conversion |
194 | #if MIN_VERSION_base(4,11,0) | ||
195 | import Prelude hiding ((<>)) | ||
196 | #endif | ||
193 | 197 | ||
194 | {- | dense matrix product | 198 | {- | dense matrix product |
195 | 199 | ||
diff --git a/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs b/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs index 5ce529c..3a84645 100644 --- a/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs +++ b/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | -------------------------------------------------------------------------------- | 2 | -------------------------------------------------------------------------------- |
2 | {- | | 3 | {- | |
3 | Module : Numeric.LinearAlgebra.HMatrix | 4 | Module : Numeric.LinearAlgebra.HMatrix |
@@ -19,6 +20,9 @@ module Numeric.LinearAlgebra.HMatrix ( | |||
19 | import Numeric.LinearAlgebra | 20 | import Numeric.LinearAlgebra |
20 | import Internal.Util | 21 | import Internal.Util |
21 | import Internal.Algorithms(cholSH, mbCholSH, eigSH', eigenvaluesSH', geigSH') | 22 | import Internal.Algorithms(cholSH, mbCholSH, eigSH', eigenvaluesSH', geigSH') |
23 | #if MIN_VERSION_base(4,11,0) | ||
24 | import Prelude hiding ((<>)) | ||
25 | #endif | ||
22 | 26 | ||
23 | infixr 8 <·> | 27 | infixr 8 <·> |
24 | (<·>) :: Numeric t => Vector t -> Vector t -> t | 28 | (<·>) :: Numeric t => Vector t -> Vector t -> t |
diff --git a/packages/base/src/Numeric/LinearAlgebra/Static.hs b/packages/base/src/Numeric/LinearAlgebra/Static.hs index 3000dcb..e328904 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Static.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Static.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | {-# LANGUAGE DataKinds #-} | 2 | {-# LANGUAGE DataKinds #-} |
2 | {-# LANGUAGE KindSignatures #-} | 3 | {-# LANGUAGE KindSignatures #-} |
3 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} | 4 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} |
@@ -80,6 +81,9 @@ import Control.Arrow((***)) | |||
80 | import Text.Printf | 81 | import Text.Printf |
81 | import Data.Type.Equality ((:~:)(Refl)) | 82 | import Data.Type.Equality ((:~:)(Refl)) |
82 | import qualified Data.Bifunctor as BF (first) | 83 | import qualified Data.Bifunctor as BF (first) |
84 | #if MIN_VERSION_base(4,11,0) | ||
85 | import Prelude hiding ((<>)) | ||
86 | #endif | ||
83 | 87 | ||
84 | ud1 :: R n -> Vector ℝ | 88 | ud1 :: R n -> Vector ℝ |
85 | ud1 (R (Dim v)) = v | 89 | ud1 (R (Dim v)) = v |
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 |