diff options
author | George Roldugin <groldugin@cse.unsw.edu.au> | 2011-07-22 11:49:33 +0000 |
---|---|---|
committer | George Roldugin <groldugin@cse.unsw.edu.au> | 2011-07-22 12:03:27 +0000 |
commit | e49956176c722a6edfc670c4fa1902ef9dfb32eb (patch) | |
tree | eba8f934c4dca8dfb0cec6e6b01c24087c17f518 /testsuite/tests/dph | |
parent | 3cd7b4015ed19ba451cc512c43fb934d5db4948e (diff) | |
download | haskell-e49956176c722a6edfc670c4fa1902ef9dfb32eb.tar.gz |
Fix dph-diophantine (#5065)
1. Adjust array lengths to be equal when performing parallel array comprehensions
2. Lower input arguments to prevent arithmetic overflow
Diffstat (limited to 'testsuite/tests/dph')
5 files changed, 11 insertions, 11 deletions
diff --git a/testsuite/tests/dph/diophantine/DiophantineVect.hs b/testsuite/tests/dph/diophantine/DiophantineVect.hs index bef6694b3d..b6f34eb397 100644 --- a/testsuite/tests/dph/diophantine/DiophantineVect.hs +++ b/testsuite/tests/dph/diophantine/DiophantineVect.hs @@ -11,7 +11,8 @@ solution3' = let pow x i = productP (replicateP i x) primes = [: 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73 :] - sumpri xx = productP [: pow p x | p <- primes | x <- xx :] + a `cutTo` b = sliceP 0 (lengthP b) a + sumpri xx = productP [: pow p x | p <- primes `cutTo` xx | x <- xx :] distinct xx = productP [: x + 1 | x <- xx :] series :: [:Int:] -> Int -> [:[:Int:]:] @@ -28,7 +29,7 @@ solution3' i = minIndexP [: a | (a, b) <- xx :] in xx !: i in - prob 7 2000 + prob 5 200 solution3 :: (Int, PArray Int) {-# NOINLINE solution3 #-} diff --git a/testsuite/tests/dph/diophantine/Main.hs b/testsuite/tests/dph/diophantine/Main.hs index eb8ae7ac28..e3130f03a8 100644 --- a/testsuite/tests/dph/diophantine/Main.hs +++ b/testsuite/tests/dph/diophantine/Main.hs @@ -19,7 +19,7 @@ solution1 prob x y = minimum [ (sumpri m ,m) | m <- series [1..3] x , (>y) $ distinct $ map (*2) m] - in prob 7 2000 + in prob 5 200 solution2 = let primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73] @@ -31,7 +31,7 @@ solution2 prob x y = minimum [ (sumpri m ,m) | m <- series [1..3] x , (distinct $ map (*2) m) > y ] - in prob 7 2000 + in prob 5 200 main diff --git a/testsuite/tests/dph/diophantine/dph-diophantine-fast.stdout b/testsuite/tests/dph/diophantine/dph-diophantine-fast.stdout index 7088d6ced3..3fe0f66bd1 100644 --- a/testsuite/tests/dph/diophantine/dph-diophantine-fast.stdout +++ b/testsuite/tests/dph/diophantine/dph-diophantine-fast.stdout @@ -1,3 +1,3 @@ -(180180,[2,2,1,1,1,1,0]) -(180180,[2,2,1,1,1,1,0]) -(180180,[:2,2,1,1,1,1,0:]) +(1260,[2,2,1,1,0]) +(1260,[2,2,1,1,0]) +(1260,fromList<PArray> [2,2,1,1,0]) diff --git a/testsuite/tests/dph/diophantine/dph-diophantine-opt.stdout b/testsuite/tests/dph/diophantine/dph-diophantine-opt.stdout index 7088d6ced3..3fe0f66bd1 100644 --- a/testsuite/tests/dph/diophantine/dph-diophantine-opt.stdout +++ b/testsuite/tests/dph/diophantine/dph-diophantine-opt.stdout @@ -1,3 +1,3 @@ -(180180,[2,2,1,1,1,1,0]) -(180180,[2,2,1,1,1,1,0]) -(180180,[:2,2,1,1,1,1,0:]) +(1260,[2,2,1,1,0]) +(1260,[2,2,1,1,0]) +(1260,fromList<PArray> [2,2,1,1,0]) diff --git a/testsuite/tests/dph/diophantine/dph-diophantine.T b/testsuite/tests/dph/diophantine/dph-diophantine.T index c963db9145..3d6f44352f 100644 --- a/testsuite/tests/dph/diophantine/dph-diophantine.T +++ b/testsuite/tests/dph/diophantine/dph-diophantine.T @@ -12,7 +12,6 @@ test ('dph-diophantine-opt' test ('dph-diophantine-fast' , [ reqlib('dph-par') , reqlib('dph-prim-par') - , expect_broken(5065) , only_ways(['normal', 'threaded1', 'threaded2']) ] , multimod_compile_and_run , [ 'Main' |