Axis-notation does not work on complex
The following code:
use StdIO: all;
use Structures: all;
use Math: all;
complex omega(int j, int n) {
angle = -2.0 * pi() * tod(j) / tod(n);
return toc(cos(angle), sin(angle));
}
complex[n] DFT(complex[n] x) {
return {[k] -> sum({[j] -> x[j] * omega(k * j, n)})
| [k] < [n]};
}
complex[m, r] FFT_2D(complex[r, m] X) {
n = r * m;
W = {[., s] -> DFT(X[., s])};
V = {[t, s] -> omega(s * t, n) * W[t, s]};
Z = {[s, t] -> W[t, s]};
Y = {[., t] -> DFT(Z[., t])};
return Y;
}
int main()
{
m = 16;
r = 2;
n = m * r;
frequency = 3;
x = {[j] -> cos(2d * pi() * tod(j) * tod(frequency) / tod(n)) | [j] < [n]};
y = FFT_2D(reshape([m, r], x));
return toi(sum(y));
}
gives error
./fft.sac:17: abort:
16. n = r * m;
→ 17. W = {[., s] -> DFT(X[., s])};
18. V = {[t, s] -> omega(s * t, n) * W[t, s]};
19. Z = {[s, t] -> W[t, s]};
No definition found for a function "sacprelude_p::sel" that accepts an argument of type
"Structures::complex[.]" as parameter no 2. Full argument types are "( int[1]{0},
Structures::complex[.])".
Compilation failed while Running type inference system.
I use the compiler of !447 (merged)