summaryrefslogtreecommitdiff
path: root/examples/benchmarks.hs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/benchmarks.hs')
-rw-r--r--examples/benchmarks.hs19
1 files changed, 10 insertions, 9 deletions
diff --git a/examples/benchmarks.hs b/examples/benchmarks.hs
index 7ba15aa..6490b25 100644
--- a/examples/benchmarks.hs
+++ b/examples/benchmarks.hs
@@ -18,7 +18,9 @@ time act = do
18 18
19-------------------------------------------------------------------------------- 19--------------------------------------------------------------------------------
20 20
21main = sequence_ [bench1,bench2,bench3,bench4,bench5 1000000 3] 21main = sequence_ [bench1,bench2,bench3,bench4,
22 bench5 1000000 3,
23 bench5 100000 50]
22 24
23w :: Vector Double 25w :: Vector Double
24w = constant 1 5000000 26w = constant 1 5000000
@@ -131,19 +133,18 @@ bench4 = do
131-------------------------------------------------------------------------------- 133--------------------------------------------------------------------------------
132 134
133op1 a b = a <> trans b 135op1 a b = a <> trans b
134 136op2 a b = a + trans b
135op2 a b = a + trans b
136 137
137timep = time . print . vectorMax . flatten 138timep = time . print . vectorMax . flatten
138 139
139bench5 n d = do 140bench5 n d = do
140 putStrLn "-------------------------------------------------------" 141 putStrLn "-------------------------------------------------------"
141 putStrLn "transpose in multiply"
142 let ms = replicate n ((ident d :: Matrix Double))
143 let mz = replicate n (diag (constant (0::Double) d))
144 timep $ foldl1' (<>) ms
145 timep $ foldl1' op1 ms
146 putStrLn "-------------------------------------------------------"
147 putStrLn "transpose in add" 142 putStrLn "transpose in add"
143 let ms = replicate n ((ident d :: Matrix Double))
148 timep $ foldl1' (+) ms 144 timep $ foldl1' (+) ms
149 timep $ foldl1' op2 ms 145 timep $ foldl1' op2 ms
146 putStrLn "-------------------------------------------------------"
147 putStrLn "transpose in multiply"
148
149 timep $ foldl1' (<>) ms
150 timep $ foldl1' op1 ms