summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/bool.hs3
-rw-r--r--examples/parallel.hs5
-rw-r--r--examples/tests.hs3
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
23taut x = minElement x == 1 23taut x = minElement x == 1
24 24
25minEvery a b = cond a b a a b
26maxEvery a b = cond a b b b a
27
25-- examples 28-- examples
26 29
27clip a b x = cond y b y y b where y = cond x a a x x 30clip 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
3import System.Environment(getArgs) 4import System.Environment(getArgs)
4import Numeric.LinearAlgebra 5import Numeric.LinearAlgebra
@@ -7,7 +8,6 @@ import System.Time
7 8
8inParallel = parMap rwhnf id 9inParallel = parMap rwhnf id
9 10
10
11-- matrix product decomposed into p parallel subtasks 11-- matrix product decomposed into p parallel subtasks
12parMul p x y = fromBlocks [ inParallel ( map (x <>) ys ) ] 12parMul 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 @@
1import Numeric.LinearAlgebra.Tests
2
3main = runTests 20