diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-05-23 10:51:16 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-05-23 10:51:16 +0200 |
commit | 0a9ef8f5b0088c1ac25175bffca4ed95d9e109a5 (patch) | |
tree | 7bd461ebbf140804e470ae03bb3a2e29bdd935e2 /packages/tests/src/Numeric/LinearAlgebra | |
parent | 109fa7d25779e331356bbe310755c10eddfeb235 (diff) |
relativeError, cgSolve'
Diffstat (limited to 'packages/tests/src/Numeric/LinearAlgebra')
-rw-r--r-- | packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs index 657689a..423edaa 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs | |||
@@ -54,19 +54,9 @@ import Test.QuickCheck(Arbitrary,arbitrary,coarbitrary,choose,vector | |||
54 | trivial :: Testable a => Bool -> a -> Property | 54 | trivial :: Testable a => Bool -> a -> Property |
55 | trivial = (`classify` "trivial") | 55 | trivial = (`classify` "trivial") |
56 | 56 | ||
57 | |||
58 | -- relative error | 57 | -- relative error |
59 | dist :: (Normed c t, Num (c t)) => c t -> c t -> Double | 58 | dist :: (Normed c t, Num (c t)) => c t -> c t -> Double |
60 | dist a b = realToFrac r | 59 | dist = relativeError Infinity |
61 | where norm = pnorm Infinity | ||
62 | na = norm a | ||
63 | nb = norm b | ||
64 | nab = norm (a-b) | ||
65 | mx = max na nb | ||
66 | mn = min na nb | ||
67 | r = if mn < peps | ||
68 | then mx | ||
69 | else nab/mx | ||
70 | 60 | ||
71 | infixl 4 |~| | 61 | infixl 4 |~| |
72 | a |~| b = a :~10~: b | 62 | a |~| b = a :~10~: b |