summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-08-23 13:00:56 +0000
committerAlberto Ruiz <aruiz@um.es>2010-08-23 13:00:56 +0000
commit2b5b266bb02c7205262bc8a0b584477b6043a112 (patch)
tree697dccfd2f901c67b167b7a617320d7025ac1f8c /lib/Numeric/LinearAlgebra
parent1222e1c0e02e7c43c87dfba84a5d5d2dfd010ff3 (diff)
offset test
Diffstat (limited to 'lib/Numeric/LinearAlgebra')
-rw-r--r--lib/Numeric/LinearAlgebra/Tests.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Numeric/LinearAlgebra/Tests.hs b/lib/Numeric/LinearAlgebra/Tests.hs
index 24b5bb5..5c5135c 100644
--- a/lib/Numeric/LinearAlgebra/Tests.hs
+++ b/lib/Numeric/LinearAlgebra/Tests.hs
@@ -33,6 +33,7 @@ import Prelude hiding ((^))
33import qualified Prelude 33import qualified Prelude
34import System.CPUTime 34import System.CPUTime
35import Text.Printf 35import Text.Printf
36import Data.Packed.Development(unsafeFromForeignPtr,unsafeToForeignPtr)
36 37
37#include "Tests/quickCheckCompat.h" 38#include "Tests/quickCheckCompat.h"
38 39
@@ -201,6 +202,19 @@ rotTest = fun (10^5) :~12~: rot 5E4
201 where fun n = foldl1' (<>) (map rot angles) 202 where fun n = foldl1' (<>) (map rot angles)
202 where angles = toList $ linspace n (0,1) 203 where angles = toList $ linspace n (0,1)
203 204
205---------------------------------------------------------------------
206-- vector <= 0.6.0.2 bug discovered by Patrick Perry
207-- http://trac.haskell.org/vector/ticket/31
208
209offsetTest = y == y' where
210 x = fromList [0..3 :: Double]
211 y = subVector 1 3 x
212 (f,o,n) = unsafeToForeignPtr y
213 y' = unsafeFromForeignPtr f o n
214
215---------------------------------------------------------------------
216
217
204-- | All tests must pass with a maximum dimension of about 20 218-- | All tests must pass with a maximum dimension of about 20
205-- (some tests may fail with bigger sizes due to precision loss). 219-- (some tests may fail with bigger sizes due to precision loss).
206runTests :: Int -- ^ maximum dimension 220runTests :: Int -- ^ maximum dimension
@@ -340,6 +354,7 @@ runTests n = do
340 , odeTest 354 , odeTest
341 , fittingTest 355 , fittingTest
342 , mbCholTest 356 , mbCholTest
357 , utest "offset" offsetTest
343 ] 358 ]
344 return () 359 return ()
345 360