diff options
Diffstat (limited to 'packages/base/src/Numeric')
-rw-r--r-- | packages/base/src/Numeric/Chain.hs | 2 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Static.hs | 30 | ||||
-rw-r--r-- | packages/base/src/Numeric/Vectorized.hs | 1 |
3 files changed, 8 insertions, 25 deletions
diff --git a/packages/base/src/Numeric/Chain.hs b/packages/base/src/Numeric/Chain.hs index 55e2df6..64c09c0 100644 --- a/packages/base/src/Numeric/Chain.hs +++ b/packages/base/src/Numeric/Chain.hs | |||
@@ -14,6 +14,8 @@ | |||
14 | -- | 14 | -- |
15 | ----------------------------------------------------------------------------- | 15 | ----------------------------------------------------------------------------- |
16 | 16 | ||
17 | {-# LANGUAGE FlexibleContexts #-} | ||
18 | |||
17 | module Numeric.Chain ( | 19 | module Numeric.Chain ( |
18 | optimiseMult, | 20 | optimiseMult, |
19 | ) where | 21 | ) where |
diff --git a/packages/base/src/Numeric/LinearAlgebra/Static.hs b/packages/base/src/Numeric/LinearAlgebra/Static.hs index a26cc4c..4c3186f 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Static.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Static.hs | |||
@@ -1,5 +1,3 @@ | |||
1 | #if __GLASGOW_HASKELL__ >= 708 | ||
2 | |||
3 | {-# LANGUAGE DataKinds #-} | 1 | {-# LANGUAGE DataKinds #-} |
4 | {-# LANGUAGE KindSignatures #-} | 2 | {-# LANGUAGE KindSignatures #-} |
5 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} | 3 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} |
@@ -51,7 +49,7 @@ module Numeric.LinearAlgebra.Static( | |||
51 | linSolve, (<\>), | 49 | linSolve, (<\>), |
52 | -- * Factorizations | 50 | -- * Factorizations |
53 | svd, withCompactSVD, svdTall, svdFlat, Eigen(..), | 51 | svd, withCompactSVD, svdTall, svdFlat, Eigen(..), |
54 | withNullspace, qr, | 52 | withNullspace, qr, chol, |
55 | -- * Misc | 53 | -- * Misc |
56 | mean, | 54 | mean, |
57 | Disp(..), Domain(..), | 55 | Disp(..), Domain(..), |
@@ -67,7 +65,7 @@ import Numeric.LinearAlgebra.HMatrix hiding ( | |||
67 | row,col,vector,matrix,linspace,toRows,toColumns, | 65 | row,col,vector,matrix,linspace,toRows,toColumns, |
68 | (<\>),fromList,takeDiag,svd,eig,eigSH,eigSH', | 66 | (<\>),fromList,takeDiag,svd,eig,eigSH,eigSH', |
69 | eigenvalues,eigenvaluesSH,eigenvaluesSH',build, | 67 | eigenvalues,eigenvaluesSH,eigenvaluesSH',build, |
70 | qr,size,app,mul,dot) | 68 | qr,size,app,mul,dot,chol) |
71 | import qualified Numeric.LinearAlgebra.HMatrix as LA | 69 | import qualified Numeric.LinearAlgebra.HMatrix as LA |
72 | import Data.Proxy(Proxy) | 70 | import Data.Proxy(Proxy) |
73 | import Numeric.LinearAlgebra.Static.Internal | 71 | import Numeric.LinearAlgebra.Static.Internal |
@@ -183,6 +181,7 @@ a ¦ b = tr (tr a —— tr b) | |||
183 | type Sq n = L n n | 181 | type Sq n = L n n |
184 | --type CSq n = CL n n | 182 | --type CSq n = CL n n |
185 | 183 | ||
184 | |||
186 | type GL = forall n m . (KnownNat n, KnownNat m) => L m n | 185 | type GL = forall n m . (KnownNat n, KnownNat m) => L m n |
187 | type GSq = forall n . KnownNat n => Sq n | 186 | type GSq = forall n . KnownNat n => Sq n |
188 | 187 | ||
@@ -305,6 +304,9 @@ instance KnownNat n => Eigen (Sq n) (C n) (M n n) | |||
305 | where | 304 | where |
306 | (l,v) = LA.eig m | 305 | (l,v) = LA.eig m |
307 | 306 | ||
307 | chol :: KnownNat n => Sym n -> Sq n | ||
308 | chol (extract . unSym -> m) = mkL $ LA.cholSH m | ||
309 | |||
308 | -------------------------------------------------------------------------------- | 310 | -------------------------------------------------------------------------------- |
309 | 311 | ||
310 | withNullspace | 312 | withNullspace |
@@ -614,23 +616,3 @@ instance (KnownNat n', KnownNat m') => Testable (L n' m') | |||
614 | where | 616 | where |
615 | checkT _ = test | 617 | checkT _ = test |
616 | 618 | ||
617 | #else | ||
618 | |||
619 | {- | | ||
620 | Module : Numeric.LinearAlgebra.Static | ||
621 | Copyright : (c) Alberto Ruiz 2014 | ||
622 | License : BSD3 | ||
623 | Stability : experimental | ||
624 | |||
625 | Experimental interface with statically checked dimensions. | ||
626 | |||
627 | This module requires GHC >= 7.8 | ||
628 | |||
629 | -} | ||
630 | |||
631 | module Numeric.LinearAlgebra.Static | ||
632 | {-# WARNING "This module requires GHC >= 7.8" #-} | ||
633 | where | ||
634 | |||
635 | #endif | ||
636 | |||
diff --git a/packages/base/src/Numeric/Vectorized.hs b/packages/base/src/Numeric/Vectorized.hs index 6f0d240..405ae01 100644 --- a/packages/base/src/Numeric/Vectorized.hs +++ b/packages/base/src/Numeric/Vectorized.hs | |||
@@ -37,7 +37,6 @@ import Foreign.C.String | |||
37 | import System.IO.Unsafe(unsafePerformIO) | 37 | import System.IO.Unsafe(unsafePerformIO) |
38 | 38 | ||
39 | import Control.Monad(when) | 39 | import Control.Monad(when) |
40 | import Control.Applicative((<$>)) | ||
41 | 40 | ||
42 | 41 | ||
43 | 42 | ||