summaryrefslogtreecommitdiff
path: root/examples/tests.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-09-19 08:59:32 +0000
committerAlberto Ruiz <aruiz@um.es>2007-09-19 08:59:32 +0000
commitf39ad090513e48fc2cbaf421c8b39fa3ca12a221 (patch)
treeb42f3b473034a301f11e25d82b902be2ce39db4f /examples/tests.hs
parente34d5566b9abfd235ce210f9f9909b23d52bd138 (diff)
minor changes
Diffstat (limited to 'examples/tests.hs')
-rw-r--r--examples/tests.hs35
1 files changed, 14 insertions, 21 deletions
diff --git a/examples/tests.hs b/examples/tests.hs
index f352b71..dcc3cbf 100644
--- a/examples/tests.hs
+++ b/examples/tests.hs
@@ -7,25 +7,14 @@
7----------------------------------------------------------------------------- 7-----------------------------------------------------------------------------
8 8
9import Data.Packed.Internal((>|<), fdat, cdat, multiply', multiplyG, MatrixOrder(..)) 9import Data.Packed.Internal((>|<), fdat, cdat, multiply', multiplyG, MatrixOrder(..))
10import Data.Packed.Vector 10import GSL hiding (sin,cos,exp,choose)
11import Data.Packed.Matrix 11import LinearAlgebra hiding ((<>))
12import GSL.Vector
13import GSL.Integration
14import GSL.Differentiation
15import GSL.Special hiding (choose, multiply, exp)
16import GSL.Fourier
17import GSL.Polynomials
18import LAPACK
19import Test.QuickCheck 12import Test.QuickCheck
20import Test.HUnit hiding ((~:)) 13import Test.HUnit hiding ((~:))
21import Complex 14
22import LinearAlgebra.Algorithms
23import LinearAlgebra.Linear hiding ((<>))
24import GSL.Matrix
25import GSLHaskell hiding ((<>),constant)
26 15
27dist :: (Normed t, Num t) => t -> t -> Double 16dist :: (Normed t, Num t) => t -> t -> Double
28dist a b = norm (a-b) 17dist a b = pnorm Infinity (a-b)
29 18
30infixl 4 |~| 19infixl 4 |~|
31a |~| b = a :~8~: b 20a |~| b = a :~8~: b
@@ -280,15 +269,17 @@ integrateTest = assertBool "integrate" (abs (volSphere 2.5 - 4/3*pi*2.5^3) < eps
280 269
281--------------------------------------------------------------------- 270---------------------------------------------------------------------
282 271
283arit1 u = vectorMapValR PowVS 2 (vectorMapR Sin u) 272arit1 u = sin u ^ 2 + cos u ^ 2 |~| 1
284 `add` vectorMapValR PowVS 2 (vectorMapR Cos u) 273 where _ = u :: Vector Double
285 |~| constant 1 (dim u)
286 274
287arit2 u = (vectorMapR Cos u) `mul` (vectorMapR Tan u) 275arit2 u = sin u ** 2 + cos u ** 2 |~| 1
288 |~| vectorMapR Sin u 276 where _ = u :: Vector Double
289 277
278arit3 u = cos u * tan u |~| sin u
279 where _ = u :: Vector Double
290 280
291-- arit3 (PairV u v) = 281arit4 u = (cos u * tan u) :~6~: sin u
282 where _ = u :: Vector (Complex Double)
292 283
293--------------------------------------------------------------------- 284---------------------------------------------------------------------
294 285
@@ -347,6 +338,8 @@ main = do
347 putStrLn "--------- VEC OPER ------" 338 putStrLn "--------- VEC OPER ------"
348 quickCheck arit1 339 quickCheck arit1
349 quickCheck arit2 340 quickCheck arit2
341 quickCheck arit3
342 quickCheck arit4
350 putStrLn "--------- GSL ------" 343 putStrLn "--------- GSL ------"
351 runTestTT tests 344 runTestTT tests
352 quickCheck $ \v -> ifft (fft v) |~| v 345 quickCheck $ \v -> ifft (fft v) |~| v