diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/bool.hs | 3 | ||||
-rw-r--r-- | examples/parallel.hs | 5 | ||||
-rw-r--r-- | examples/tests.hs | 3 |
3 files changed, 6 insertions, 5 deletions
diff --git a/examples/bool.hs b/examples/bool.hs index 278e9f2..679b8bf 100644 --- a/examples/bool.hs +++ b/examples/bool.hs | |||
@@ -22,6 +22,9 @@ imp a b = no a .||. b | |||
22 | 22 | ||
23 | taut x = minElement x == 1 | 23 | taut x = minElement x == 1 |
24 | 24 | ||
25 | minEvery a b = cond a b a a b | ||
26 | maxEvery a b = cond a b b b a | ||
27 | |||
25 | -- examples | 28 | -- examples |
26 | 29 | ||
27 | clip a b x = cond y b y y b where y = cond x a a x x | 30 | clip a b x = cond y b y y b where y = cond x a a x x |
diff --git a/examples/parallel.hs b/examples/parallel.hs index 566b729..e875407 100644 --- a/examples/parallel.hs +++ b/examples/parallel.hs | |||
@@ -1,4 +1,5 @@ | |||
1 | -- $ runhaskell parallel.hs 2000 | 1 | -- $ ghc --make -O -rtsopts -threaded parallel.hs |
2 | -- $ ./parallel 3000 +RTS -N4 -s -A200M | ||
2 | 3 | ||
3 | import System.Environment(getArgs) | 4 | import System.Environment(getArgs) |
4 | import Numeric.LinearAlgebra | 5 | import Numeric.LinearAlgebra |
@@ -7,7 +8,6 @@ import System.Time | |||
7 | 8 | ||
8 | inParallel = parMap rwhnf id | 9 | inParallel = parMap rwhnf id |
9 | 10 | ||
10 | |||
11 | -- matrix product decomposed into p parallel subtasks | 11 | -- matrix product decomposed into p parallel subtasks |
12 | parMul p x y = fromBlocks [ inParallel ( map (x <>) ys ) ] | 12 | parMul p x y = fromBlocks [ inParallel ( map (x <>) ys ) ] |
13 | where [ys] = toBlocksEvery (rows y) (cols y `div` p) y | 13 | where [ys] = toBlocksEvery (rows y) (cols y `div` p) y |
@@ -25,3 +25,4 @@ time act = do | |||
25 | act | 25 | act |
26 | t1 <- getClockTime | 26 | t1 <- getClockTime |
27 | print $ tdSec $ normalizeTimeDiff $ diffClockTimes t1 t0 | 27 | print $ tdSec $ normalizeTimeDiff $ diffClockTimes t1 t0 |
28 | |||
diff --git a/examples/tests.hs b/examples/tests.hs deleted file mode 100644 index 23fd675..0000000 --- a/examples/tests.hs +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | import Numeric.LinearAlgebra.Tests | ||
2 | |||
3 | main = runTests 20 | ||