I implemented a recursive version of FFT. When I compile it using gp2c and try to use it in the pari calculator a bug appears and says please report. However, when I run the code inside the pari calculator, it works flawlessly. Please see the transcript below.
Also, I am attaching my script for the FFT. I am using Ubuntu. 18.04
Adrian.
---------------------------transcript--------------------------------------------
gp2c-run -g -s_c fft.gp
Reading GPRC: /etc/gprc ...Done.
GP/PARI CALCULATOR Version 2.9.4 (released)
amd64 running linux (x86-64/GMP-6.1.2 kernel) 64-bit version
compiled: Dec 19 2017, gcc version 7.3.0 (Ubuntu 7.3.0-1ubuntu1)
threading engine: pthread
(readline v7.0 enabled, extended help enabled)
Copyright (C) 2000-2017 The PARI Group
PARI/GP is free software, covered by the GNU General Public License, and comes
WITHOUT ANY WARRANTY WHATSOEVER.
Type ? for help, \q to quit.
Type ?15 for how to get moral (and possibly technical) support.
parisize = 8000000, primelimit = 500000, nbthreads = 8
? \r fft.gp
? ?FFT
FFT =
(v)->if(#v<=1,v,my(t=-2*Pi*I,x,y,z);x=vector(#v/2,i,i=2*i-1;v[i]);y=vector(#v/2,i,i=2*i;v[i]);x=FFT(x);y=FFT(y);z=vector(#v);for(k=1,(#v)/2,y[k]=exp((t*(k-1))/(#v))*y[k];z[k]=x[k]+y[k];z[k+(#v)/2]=x[k]-y[k]);z;)
? ?FFT_c
FFT_c: installed function
library name: FFT
prototype: D0,G,p
? n=2^10; v=vector(n,i,sin(Pi*(i-1)/n));
? #
timer = 1 (on)
? u=FFT(v);
time = 30 ms.
? w=FFT_c(v);
*** at top-level: w=FFT_c(v)
*** ^--------
*** FFT_c: bug in PARI/GP (Segmentation Fault), please report.
*** Break loop: type 'break' to go back to GP prompt
break>