#
# rfftf
#
@PROBLEM rfftf
@FUNCTION rfftf
@FUNCTION rffti
@LIB $(NETSOLVE_ROOT)/lib/$(NETSOLVE_ARCH)/fftpack_$(NETSOLVE_ARCH).a
@LANGUAGE FORTRAN
@MAJOR COL
@PATH  /FftPack/
@DESCRIPTION
subroutine rfftf computes the fourier coefficients of a real
perodic sequence (fourier analysis). the transform is defined
below at output parameter r.
http://www.netlib.org/fftpack/index.html
@INPUT 1
@OBJECT VECTOR D v
a real array of length n which contains the sequence
to be transformed
@OUTPUT 1
@OBJECT VECTOR D r
r       r(1) = the sum from i=1 to i=n of r(i)
        if n is even set l =n/2   , if n is odd set l = (n+1)/2
          then for k = 2,...,l
             r(2*k-2) = the sum from i = 1 to i = n of
                  r(i)*cos((k-1)*(i-1)*2*pi/n)
             r(2*k-1) = the sum from i = 1 to i = n of
                 -r(i)*sin((k-1)*(i-1)*2*pi/n)
        if n is even
             r(n) = the sum from i = 1 to i = n of
                  (-1)**(i-1)*r(i)
@COMPLEXITY 1,1

@CALLINGSEQUENCE
@ARG mI0
@ARG I0,O0
@ARG ?

@CODE
extern void rffti(int*, double*);
extern void rfftf(int*, double*, double*);

double *work = NULL;
int lwork;

lwork = (*@mI0@)*2+15;
work = (double *)malloc(sizeof(double)*lwork);

rffti(@mI0@,work);
rfftf(@mI0@,@I0@,work);

*@mO0@ = *@mI0@;
@O0@ = @I0@;

@END_CODE
