Prepare dph for a vectInfoVar type change
[packages/dph.git] / dph-examples / examples / spectral / Pluecker / Solver.hs
1 module Solver
2 (Solver,solvers)
3 where
4
5 import Common
6 import qualified Vector as SV
7 import qualified Vectorised as SPA
8 import qualified Data.Vector as V
9 import qualified Data.Vector.Unboxed as VU
10 import qualified Data.Array.Parallel as P
11 import qualified Data.Array.Parallel.PArray as P
12
13
14 type Solver = VU.Vector Vec3 -> VU.Vector (Int,Int,Int,Colour) -> VU.Vector Vec3 -> Double -> VU.Vector Colour
15
16 solvers :: [(String,Solver)]
17 solvers =
18 [("vectorised", solverPA)
19 ,("vector", SV.solveV)]
20
21 solverPA verts tris rays time
22 = tu3 (SPA.solvePA (fu3 verts) (fu4_3 tris) (fu3 rays) time)
23
24
25 fu as = P.fromUArray as
26
27 fu3 as
28 = let (xs,ys,zs) = VU.unzip3 as
29 in P.zip3 (fu xs) (fu ys) (fu zs)
30
31 fu4_3 as
32 = let (xs,ys,zs,bs) = VU.unzip4 as
33 in P.zip4 (fu xs) (fu ys) (fu zs) (fu3 bs)
34
35
36 tu as = P.toUArray as
37
38 tu3 as
39 = let (xs,ys,zs) = P.unzip3 as
40 in VU.zip3 (tu xs) (tu ys) (tu zs)