diff options
Diffstat (limited to 'examples/parallel.hs')
-rw-r--r-- | examples/parallel.hs | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/examples/parallel.hs b/examples/parallel.hs deleted file mode 100644 index 7256fb6..0000000 --- a/examples/parallel.hs +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | import System(getArgs) | ||
2 | import Numeric.LinearAlgebra | ||
3 | import Control.Parallel.Strategies | ||
4 | import System.Time | ||
5 | |||
6 | inParallel = parMap rwhnf id | ||
7 | |||
8 | parMul x y = fromBlocks [inParallel[x <> y1, x <> y2]] | ||
9 | where p = cols y `div` 2 | ||
10 | (y1,y2) = splitColumnsAt p y | ||
11 | |||
12 | main = do | ||
13 | n <- (read . head) `fmap` getArgs | ||
14 | let m = ident n :: Matrix Double | ||
15 | time $ print $ vectorMax $ takeDiag $ parMul m m | ||
16 | time $ print $ vectorMax $ takeDiag $ m <> m | ||
17 | |||
18 | a = (2><3) [1..6::Double] | ||
19 | b = (3><4) [1..12::Double] | ||
20 | |||
21 | splitRowsAt p m = (takeRows p m, dropRows p m) | ||
22 | splitColumnsAt p m = (takeColumns p m, dropColumns p m) | ||
23 | |||
24 | time act = do | ||
25 | t0 <- getClockTime | ||
26 | act | ||
27 | t1 <- getClockTime | ||
28 | print $ tdSec $ normalizeTimeDiff $ diffClockTimes t1 t0 | ||