diff options
author | Alberto Ruiz <aruiz@um.es> | 2015-01-08 13:54:23 +0100 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2015-01-08 13:54:23 +0100 |
commit | 8878aaaf649962f4360a94109a674da756ad2202 (patch) | |
tree | d131b381c200796715b14a6eda1d0ae001032777 /packages/base/src/Numeric | |
parent | 432d80a0b65b0be64fe0dc0d7816f1f738895458 (diff) |
update base to ghc-7.10
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/Algorithms.hs | 5 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Static.hs | 5 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Util/CG.hs | 6 |
4 files changed, 9 insertions, 9 deletions
diff --git a/packages/base/src/Numeric/Chain.hs b/packages/base/src/Numeric/Chain.hs index 4c497f0..55e2df6 100644 --- a/packages/base/src/Numeric/Chain.hs +++ b/packages/base/src/Numeric/Chain.hs | |||
@@ -1,3 +1,5 @@ | |||
1 | {-# LANGUAGE FlexibleContexts #-} | ||
2 | |||
1 | ----------------------------------------------------------------------------- | 3 | ----------------------------------------------------------------------------- |
2 | -- | | 4 | -- | |
3 | -- Module : Numeric.Chain | 5 | -- Module : Numeric.Chain |
diff --git a/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs b/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs index 02ac6a0..a113d48 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs | |||
@@ -935,10 +935,9 @@ relativeError' x y = dig (norm (x `sub` y) / norm x) | |||
935 | dig r = round $ -logBase 10 (realToFrac r :: Double) | 935 | dig r = round $ -logBase 10 (realToFrac r :: Double) |
936 | 936 | ||
937 | 937 | ||
938 | relativeError :: (Normed c t, Num (c t)) => NormType -> c t -> c t -> Double | 938 | relativeError :: Num a => (a -> Double) -> a -> a -> Double |
939 | relativeError t a b = realToFrac r | 939 | relativeError norm a b = r |
940 | where | 940 | where |
941 | norm = pnorm t | ||
942 | na = norm a | 941 | na = norm a |
943 | nb = norm b | 942 | nb = norm b |
944 | nab = norm (a-b) | 943 | nab = norm (a-b) |
diff --git a/packages/base/src/Numeric/LinearAlgebra/Static.hs b/packages/base/src/Numeric/LinearAlgebra/Static.hs index cc5eb4f..a26cc4c 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Static.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Static.hs | |||
@@ -13,7 +13,6 @@ | |||
13 | {-# LANGUAGE TypeOperators #-} | 13 | {-# LANGUAGE TypeOperators #-} |
14 | {-# LANGUAGE ViewPatterns #-} | 14 | {-# LANGUAGE ViewPatterns #-} |
15 | {-# LANGUAGE GADTs #-} | 15 | {-# LANGUAGE GADTs #-} |
16 | {-# LANGUAGE OverlappingInstances #-} | ||
17 | {-# LANGUAGE TypeFamilies #-} | 16 | {-# LANGUAGE TypeFamilies #-} |
18 | 17 | ||
19 | 18 | ||
@@ -184,8 +183,8 @@ a ¦ b = tr (tr a —— tr b) | |||
184 | type Sq n = L n n | 183 | type Sq n = L n n |
185 | --type CSq n = CL n n | 184 | --type CSq n = CL n n |
186 | 185 | ||
187 | type GL = (KnownNat n, KnownNat m) => L m n | 186 | type GL = forall n m . (KnownNat n, KnownNat m) => L m n |
188 | type GSq = KnownNat n => Sq n | 187 | type GSq = forall n . KnownNat n => Sq n |
189 | 188 | ||
190 | isKonst :: forall m n . (KnownNat m, KnownNat n) => L m n -> Maybe (ℝ,(Int,Int)) | 189 | isKonst :: forall m n . (KnownNat m, KnownNat n) => L m n -> Maybe (ℝ,(Int,Int)) |
191 | isKonst s@(unwrap -> x) | 190 | isKonst s@(unwrap -> x) |
diff --git a/packages/base/src/Numeric/LinearAlgebra/Util/CG.hs b/packages/base/src/Numeric/LinearAlgebra/Util/CG.hs index b82c74f..899a5bf 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Util/CG.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Util/CG.hs | |||
@@ -9,7 +9,7 @@ module Numeric.LinearAlgebra.Util.CG( | |||
9 | import Data.Packed.Numeric | 9 | import Data.Packed.Numeric |
10 | import Numeric.Sparse | 10 | import Numeric.Sparse |
11 | import Numeric.Vector() | 11 | import Numeric.Vector() |
12 | import Numeric.LinearAlgebra.Algorithms(linearSolveLS, relativeError, NormType(..)) | 12 | import Numeric.LinearAlgebra.Algorithms(linearSolveLS, relativeError, pnorm, NormType(..)) |
13 | import Control.Arrow((***)) | 13 | import Control.Arrow((***)) |
14 | 14 | ||
15 | {- | 15 | {- |
@@ -142,13 +142,13 @@ instance Testable GMatrix | |||
142 | print s3; print d3 | 142 | print s3; print d3 |
143 | print s4; print d4 | 143 | print s4; print d4 |
144 | print s5; print d5 | 144 | print s5; print d5 |
145 | print $ relativeError Infinity s5 d5 | 145 | print $ relativeError (pnorm Infinity) s5 d5 |
146 | 146 | ||
147 | ok = s1==d1 | 147 | ok = s1==d1 |
148 | && s2==d2 | 148 | && s2==d2 |
149 | && s3==d3 | 149 | && s3==d3 |
150 | && s4==d4 | 150 | && s4==d4 |
151 | && relativeError Infinity s5 d5 < 1E-10 | 151 | && relativeError (pnorm Infinity) s5 d5 < 1E-10 |
152 | 152 | ||
153 | disp = putStr . dispf 2 | 153 | disp = putStr . dispf 2 |
154 | 154 | ||