diff options
author | Alberto Ruiz <aruiz@um.es> | 2010-08-31 16:52:26 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2010-08-31 16:52:26 +0000 |
commit | 4486e93da02c7ef9e1fdf785c88f78986048c332 (patch) | |
tree | c0d84fce23a39a307fd12041fdd570be93aca15d /lib/Numeric/LinearAlgebra/Tests/Properties.hs | |
parent | 0b48e6b34a1a4ec590f2d17833f713f42f5e0955 (diff) |
refactoring norms
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Tests/Properties.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Tests/Properties.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Numeric/LinearAlgebra/Tests/Properties.hs b/lib/Numeric/LinearAlgebra/Tests/Properties.hs index 9891d8a..d6bb338 100644 --- a/lib/Numeric/LinearAlgebra/Tests/Properties.hs +++ b/lib/Numeric/LinearAlgebra/Tests/Properties.hs | |||
@@ -54,15 +54,15 @@ complex x = complex'' x | |||
54 | debug x = trace (show x) x | 54 | debug x = trace (show x) x |
55 | 55 | ||
56 | -- relative error | 56 | -- relative error |
57 | dist :: (Normed t, Num t) => t -> t -> Double | 57 | --dist :: (Normed t, Num t) => t -> t -> Double |
58 | dist a b = r | 58 | dist a b = r |
59 | where norm = pnorm Infinity | 59 | where norm = normInf |
60 | na = norm a | 60 | na = norm a |
61 | nb = norm b | 61 | nb = norm b |
62 | nab = norm (a-b) | 62 | nab = norm (a-b) |
63 | mx = max na nb | 63 | mx = max na nb |
64 | mn = min na nb | 64 | mn = min na nb |
65 | r = if mn < eps | 65 | r = if mn < peps |
66 | then mx | 66 | then mx |
67 | else nab/mx | 67 | else nab/mx |
68 | 68 | ||
@@ -71,7 +71,7 @@ a |~| b = a :~10~: b | |||
71 | --a |~| b = dist a b < 10^^(-10) | 71 | --a |~| b = dist a b < 10^^(-10) |
72 | 72 | ||
73 | data Aprox a = (:~) a Int | 73 | data Aprox a = (:~) a Int |
74 | (~:) :: (Normed a, Num a) => Aprox a -> a -> Bool | 74 | -- (~:) :: (Normed a, Num a) => Aprox a -> a -> Bool |
75 | a :~n~: b = dist a b < 10^^(-n) | 75 | a :~n~: b = dist a b < 10^^(-n) |
76 | 76 | ||
77 | ------------------------------------------------------ | 77 | ------------------------------------------------------ |