summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/Tests/Properties.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-08-31 16:52:26 +0000
committerAlberto Ruiz <aruiz@um.es>2010-08-31 16:52:26 +0000
commit4486e93da02c7ef9e1fdf785c88f78986048c332 (patch)
treec0d84fce23a39a307fd12041fdd570be93aca15d /lib/Numeric/LinearAlgebra/Tests/Properties.hs
parent0b48e6b34a1a4ec590f2d17833f713f42f5e0955 (diff)
refactoring norms
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Tests/Properties.hs')
-rw-r--r--lib/Numeric/LinearAlgebra/Tests/Properties.hs8
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
54debug x = trace (show x) x 54debug x = trace (show x) x
55 55
56-- relative error 56-- relative error
57dist :: (Normed t, Num t) => t -> t -> Double 57--dist :: (Normed t, Num t) => t -> t -> Double
58dist a b = r 58dist 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
73data Aprox a = (:~) a Int 73data Aprox a = (:~) a Int
74(~:) :: (Normed a, Num a) => Aprox a -> a -> Bool 74-- (~:) :: (Normed a, Num a) => Aprox a -> a -> Bool
75a :~n~: b = dist a b < 10^^(-n) 75a :~n~: b = dist a b < 10^^(-n)
76 76
77------------------------------------------------------ 77------------------------------------------------------