Commit 26d4142e authored by Laszlo Domoszlai's avatar Laszlo Domoszlai
Browse files

rephamming works

parent c51c83a9
......@@ -2,7 +2,7 @@
#define DEBUG_H
//#define DEBUG
#define BENCHMARK
//#define BENCHMARK
#ifndef DEBUG
#define NDEBUG
......
......@@ -6,7 +6,7 @@
#define STACK_SIZE_A 10240*50
#define STACK_SIZE_B 10240*50
#define HEAP_SIZE 5*1024*1024
#define HEAP_SIZE 20*1024*1024
extern int stack_top_a;
extern int stack_top_b;
......
......@@ -182,12 +182,12 @@ conc (Cons (Cons z zs) yss) = Cons z (conc (Cons zs yss))
hd1 (Cons x xs) = x
Start = reptreetest 100 10000
//Start = reptreetest 100 10000
//Start = (matchtest 2000)
//Start = (el1 10000000 mergetest)
//Start = (fib 35)
//Start = (rephamming 10000 1000)
//Start = (rephamming 4000 1000)
Start = (rephamming 4000 1000)
//Start = reptwice 400
//Start = sorttestd 5000
//Start = queens 11
......
main = Benchmarks.Start
Benchmarks.Start = Benchmarks.rephamming 4000 1000
Benchmarks.rephamming !n_0 m_1 = Benchmarks.sum1 (Benchmarks.map1 Benchmarks.hm (Benchmarks.rep1 n_0 m_1))
Benchmarks.rep1 !n_0 a_1 = if (eqI n_0 0) Benchmarks.Nill (Benchmarks.Cons a_1 (Benchmarks.rep1 (sub n_0 1) a_1))
:: Benchmarks.List1 = Benchmarks.Nill | Benchmarks.Cons a1 a2
Benchmarks.hm !n_0 = mod (Benchmarks.el1 n_0 (Benchmarks.hamming n_0)) 999
Benchmarks.hamming k_0 = let h_1_0 = Benchmarks.Cons (Benchmarks.f k_0) (Benchmarks.merge1_86 (Benchmarks.merge1_86 (Benchmarks.map1 (Benchmarks.mult_84 2) h_1_0) (Benchmarks.map1 (Benchmarks.mult_84 3) h_1_0)) (Benchmarks.map1 (Benchmarks.mult_84 5) h_1_0)) in h_1_0
Benchmarks.mult_84 !a_0 !b_1 = mult a_0 b_1
Benchmarks.map1 f_0 !_x_1 = select _x_1 (Benchmarks.Nill -> Benchmarks.Nill) (Benchmarks.Cons x_1_0 xs_1_1 -> Benchmarks.Cons (f_0 x_1_0) (Benchmarks.map1 f_0 xs_1_1))
Benchmarks.merge1_86 !_x_0 !ys_1 = select _x_0 (Benchmarks.Nill -> ys_1) (_ -> select ys_1 (Benchmarks.Nill -> _x_0) (Benchmarks.Cons b_1_0 bs_1_1 -> select _x_0 (Benchmarks.Cons a_2_0 as_2_1 -> if (eqI a_2_0 b_1_0) (Benchmarks.Cons a_2_0 (Benchmarks.merge1_86 as_2_1 bs_1_1)) (if (lt a_2_0 b_1_0) (Benchmarks.Cons a_2_0 (Benchmarks.merge1_86 as_2_1 (Benchmarks.Cons b_1_0 bs_1_1))) (Benchmarks.Cons b_1_0 (Benchmarks.merge1_86 (Benchmarks.Cons a_2_0 as_2_1) bs_1_1)))) ) )
Benchmarks.f !k_0 = if (eqI (mod k_0 2) 0) 1 (mod k_0 2)
Benchmarks.el1 !n_0 !_x_1 = select _x_1 (Benchmarks.Cons a_1_0 as_1_1 -> if (eqI n_0 0) a_1_0 (Benchmarks.el1 (sub n_0 1) as_1_1))
Benchmarks.sum1 !_x_0 = select _x_0 (Benchmarks.Nill -> 0) (Benchmarks.Cons x_1_0 xs_1_1 -> add x_1_0 (Benchmarks.sum1 xs_1_1))
[3564000]
\ No newline at end of file
main = Benchmarks.Start
Benchmarks.Start::I = Benchmarks.rephamming 4000 1000
Benchmarks.rephamming::I !n_0::I m_1::I = Benchmarks.sum1 (Benchmarks.map1 Benchmarks.hm (Benchmarks.rep1 n_0 m_1))
Benchmarks.rep1 !n_0::I a_1 = if (eqI n_0 0) Benchmarks.Nill (Benchmarks.Cons a_1 (Benchmarks.rep1 (subI n_0 1) a_1))
:: Benchmarks.List1 = Benchmarks.Nill | Benchmarks.Cons a1 a2
Benchmarks.hm::I !n_0::I = mod (Benchmarks.el1 n_0 (Benchmarks.hamming n_0)) 999
Benchmarks.hamming k_0::I = let h_1_0 = Benchmarks.Cons (Benchmarks.f k_0) (Benchmarks.merge1_86 (Benchmarks.merge1_86 (Benchmarks.map1 (Benchmarks.mult_84 2) h_1_0) (Benchmarks.map1 (Benchmarks.mult_84 3) h_1_0)) (Benchmarks.map1 (Benchmarks.mult_84 5) h_1_0)) in h_1_0
Benchmarks.mult_84::I !a_0::I !b_1::I = multI a_0 b_1
Benchmarks.map1 f_0 !_x_1 = select _x_1 (Benchmarks.Nill -> Benchmarks.Nill) (Benchmarks.Cons x_1_0 xs_1_1 -> Benchmarks.Cons (f_0 x_1_0) (Benchmarks.map1 f_0 xs_1_1))
Benchmarks.merge1_86 !_x_0 !ys_1 = select _x_0 (Benchmarks.Nill -> ys_1) (_ -> select ys_1 (Benchmarks.Nill -> _x_0) (Benchmarks.Cons b_1_0 bs_1_1 -> select _x_0 (Benchmarks.Cons a_2_0 as_2_1 -> if (eqI a_2_0 b_1_0) (Benchmarks.Cons a_2_0 (Benchmarks.merge1_86 as_2_1 bs_1_1)) (if (ltI a_2_0 b_1_0) (Benchmarks.Cons a_2_0 (Benchmarks.merge1_86 as_2_1 (Benchmarks.Cons b_1_0 bs_1_1))) (Benchmarks.Cons b_1_0 (Benchmarks.merge1_86 (Benchmarks.Cons a_2_0 as_2_1) bs_1_1)))) ) )
Benchmarks.f::I !k_0::I = if (eqI (mod k_0 2) 0) 1 (mod k_0 2)
Benchmarks.el1 !n_0::I !_x_1 = select _x_1 (Benchmarks.Cons a_1_0 as_1_1 -> if (eqI n_0 0) a_1_0 (Benchmarks.el1 (subI n_0 1) as_1_1))
Benchmarks.sum1::I !_x_0 = select _x_0 (Benchmarks.Nill -> 0) (Benchmarks.Cons x_1_0 xs_1_1 -> addI x_1_0 (Benchmarks.sum1 xs_1_1))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment