diff options
Diffstat (limited to 'examples/benchmarks.hs')
-rw-r--r-- | examples/benchmarks.hs | 19 |
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 | ||
21 | main = sequence_ [bench1,bench2,bench3,bench4,bench5 1000000 3] | 21 | main = sequence_ [bench1,bench2,bench3,bench4, |
22 | bench5 1000000 3, | ||
23 | bench5 100000 50] | ||
22 | 24 | ||
23 | w :: Vector Double | 25 | w :: Vector Double |
24 | w = constant 1 5000000 | 26 | w = constant 1 5000000 |
@@ -131,19 +133,18 @@ bench4 = do | |||
131 | -------------------------------------------------------------------------------- | 133 | -------------------------------------------------------------------------------- |
132 | 134 | ||
133 | op1 a b = a <> trans b | 135 | op1 a b = a <> trans b |
134 | 136 | op2 a b = a + trans b | |
135 | op2 a b = a + trans b | ||
136 | 137 | ||
137 | timep = time . print . vectorMax . flatten | 138 | timep = time . print . vectorMax . flatten |
138 | 139 | ||
139 | bench5 n d = do | 140 | bench5 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 | ||