Testsuite: tabs -> spaces [skip ci]
[ghc.git] / testsuite / tests / dph / quickhull / Main.hs
1
2 import qualified Types as QH
3 import QuickHullVect (quickhull)
4
5 import qualified Data.Array.Parallel.Unlifted as U
6 import qualified Data.Array.Parallel.Prelude as P
7
8 import qualified Data.Array.Parallel.PArray as P
9 import Data.Array.Parallel.PArray (PArray)
10
11 import System.Environment
12 import Data.List
13
14 import SVG
15 import TestData
16
17
18 -----
19 runQuickhull :: PArray QH.Point -> [(Double, Double)]
20 runQuickhull pts
21 = let result = quickhull pts
22 resxs = P.toUArray (QH.xsOf result)
23 resys = P.toUArray (QH.ysOf result)
24 in U.index "runQuickhull" resxs 0 `seq` (zip (U.toList resxs) (U.toList resys))
25
26
27 -- Main Program ---------------------------------------------------------------
28 main
29 = do args <- getArgs
30 let n = case args of
31 [s] -> read s
32 _ -> 1000
33
34 paInput <- toPArrayPoints
35 $ genPointsCombo n
36
37 let psHull = runQuickhull paInput
38 psInput = P.toList paInput
39
40 putStr
41 $ makeSVG
42 (roundPoints psInput)
43 (roundPoints psHull)