summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/parallel.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/parallel.hs b/examples/parallel.hs
index 8f67863..7256fb6 100644
--- a/examples/parallel.hs
+++ b/examples/parallel.hs
@@ -5,11 +5,9 @@ import System.Time
5 5
6inParallel = parMap rwhnf id 6inParallel = parMap rwhnf id
7 7
8parMul x y = fromBlocks [[ay],[by]] 8parMul x y = fromBlocks [inParallel[x <> y1, x <> y2]]
9 where p = rows x `div` 2 9 where p = cols y `div` 2
10 a = takeRows p x 10 (y1,y2) = splitColumnsAt p y
11 b = dropRows p x
12 [ay,by] = inParallel [a<>y,b<>y]
13 11
14main = do 12main = do
15 n <- (read . head) `fmap` getArgs 13 n <- (read . head) `fmap` getArgs
@@ -20,6 +18,9 @@ main = do
20a = (2><3) [1..6::Double] 18a = (2><3) [1..6::Double]
21b = (3><4) [1..12::Double] 19b = (3><4) [1..12::Double]
22 20
21splitRowsAt p m = (takeRows p m, dropRows p m)
22splitColumnsAt p m = (takeColumns p m, dropColumns p m)
23
23time act = do 24time act = do
24 t0 <- getClockTime 25 t0 <- getClockTime
25 act 26 act