Refactoring faustine in beam.ml -> method output.
[Faustine.git] / dsp_files / fft_pattern_matching.dsp
1 import ( "complex.lib" ) ;
2 import ( "fft.lib.dsp" ) ;
3
4 concats = case {
5 (1) => _, 1 : vectorize ;
6 (m) => concats(m - 1), ( _, 1 : vectorize) : #;
7 };
8
9 //subvect_even(n) = par(i, (n/2), (_, (i, 2 : *) : [])) : concats(n/2);
10 //subvect_odd(n) = par(i, (n/2), (_, (i, 2 : * : _, 1 : +) : [])) : concats(n/2);
11
12 evens = case {
13 (2) => [0] : vectorize(1);
14 (n) => evens(n-2) # ((_, (n-2) : []) : vectorize(1));
15 };
16
17 odds = case {
18 (2) => [1] : vectorize(1);
19 (n) => odds(n - 2) # ((_, (n-1) : []) : vectorize(1));
20 };
21
22 subvect_even(n) = _ <: evens(n);
23 subvect_odd(n) = _ <: odds(n);
24
25 eo(n) = _ <: subvect_even(n), subvect_odd(n);
26
27 output = serialize, serialize : vectorize(1), vectorize(1) : #;
28
29 //process = (1,2,3,4,5,6,7,8) : evens(8);
30
31 process = _ : vectorize(8) : eo(8) : output;