First cleaning step in "dsp_files" directory.
[Faustine.git] / dsp_files / fft_pattern_matching.dsp
diff --git a/dsp_files/fft_pattern_matching.dsp b/dsp_files/fft_pattern_matching.dsp
new file mode 100644 (file)
index 0000000..949f079
--- /dev/null
@@ -0,0 +1,31 @@
+import ( "complex.lib" ) ;
+import ( "fft.lib.dsp" ) ;
+
+concats = case {
+       (1) => _, 1 : vectorize ;
+       (m) => concats(m - 1), ( _, 1 : vectorize) : #;
+};
+
+//subvect_even(n) = par(i, (n/2), (_, (i, 2 : *) : [])) : concats(n/2);
+//subvect_odd(n) = par(i, (n/2), (_, (i, 2 : * : _, 1 : +) : [])) : concats(n/2);
+
+evens = case {
+       (2) => [0] : vectorize(1);
+       (n) => evens(n-2) # ((_, (n-2) : []) : vectorize(1));
+};
+
+odds = case {
+       (2) => [1] : vectorize(1);
+       (n) => odds(n - 2) # ((_, (n-1) : []) : vectorize(1));
+};
+
+subvect_even(n) = _ <: evens(n);
+subvect_odd(n) = _ <: odds(n);
+
+eo(n) = _ <: subvect_even(n), subvect_odd(n);
+
+output = serialize, serialize : vectorize(1), vectorize(1) : #;
+
+//process = (1,2,3,4,5,6,7,8) : evens(8);
+
+process = _ : vectorize(8) : eo(8) : output;
\ No newline at end of file