diff options
Diffstat (limited to 'testsuite/tests/dph/quickhull/Types.hs')
-rw-r--r-- | testsuite/tests/dph/quickhull/Types.hs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/tests/dph/quickhull/Types.hs b/testsuite/tests/dph/quickhull/Types.hs new file mode 100644 index 0000000000..162458f424 --- /dev/null +++ b/testsuite/tests/dph/quickhull/Types.hs @@ -0,0 +1,32 @@ +{-# LANGUAGE ParallelArrays #-} +{-# OPTIONS -fvectorise #-} + +module Types ( Point, Line, points, xsOf, ysOf) where + +import Data.Array.Parallel + +type Point = (Double, Double) +type Line = (Point, Point) + +points' :: [:Double:] -> [:Double:] -> [:Point:] +points' = zipP + +points :: PArray Double -> PArray Double -> PArray Point +{-# NOINLINE points #-} +points xs ys = toPArrayP (points' (fromPArrayP xs) (fromPArrayP ys)) + +xsOf' :: [:Point:] -> [:Double:] +xsOf' ps = [: x | (x, _) <- ps :] + +xsOf :: PArray Point -> PArray Double +{-# NOINLINE xsOf #-} +xsOf ps = toPArrayP (xsOf' (fromPArrayP ps)) + +ysOf' :: [:Point:] -> [:Double:] +ysOf' ps = [: y | (_, y) <- ps :] + +ysOf :: PArray Point -> PArray Double +{-# NOINLINE ysOf #-} +ysOf ps = toPArrayP (ysOf' (fromPArrayP ps)) + + |