mvfft (PR#176)

Martyn Plummer plummer@iarc.fr
Tue, 27 Apr 1999 13:52:05 +0200 (CEST)


This message is in MIME format
--_=XFMail.1.3.p0.Linux:990427135205:436=_
Content-Type: text/plain; charset=us-ascii

This should fix it.
1) Check that the dimensions are not null.
2) Call fft_factor before each call to fft_work.  The array nfac
   is set by fft_factor and overwritten by fftmx (in src/appl/fft.c,
   called by fft_work). Since nfac is not an argument of fft_work,
   nor of fft_factor it is not easy to spot the bug!

--_=XFMail.1.3.p0.Linux:990427135205:436=_
Content-Disposition: attachment; filename="fourier.diff"
Content-Transfer-Encoding: 7bit
Content-Description: fourier.diff
Content-Type: text/plain; charset=us-ascii; name=fourier.diff; SizeOnDisk=833

diff -uNr R-0.64.0/src/main/fourier.c R-fixed/src/main/fourier.c
--- R-0.64.0/src/main/fourier.c	Fri Feb  5 07:44:44 1999
+++ R-fixed/src/main/fourier.c	Tue Apr 27 12:44:48 1999
@@ -123,7 +123,7 @@
     z = CAR(args);
 
     d = getAttrib(z, R_DimSymbol);
-    if (length(d) > 2)
+    if (d == R_NilValue || length(d) > 2)
 	errorcall(call, "vector-valued series required\n");
     n = INTEGER(d)[0];
     p = INTEGER(d)[1];
@@ -156,9 +156,11 @@
 	    errorcall(call, "fft factorization error\n");
 	work = (double*)R_alloc(4 * maxf, sizeof(double));
 	iwork = (int*)R_alloc(maxp, sizeof(int));
-	for (i = 0; i < p; i++)
+	for (i = 0; i < p; i++) {
+	    fft_factor(n, &maxf, &maxp);
 	    fft_work(&(COMPLEX(z)[i*n].r), &(COMPLEX(z)[i*n].i),
 		     1, n, 1, inv, work, iwork);
+        }
 	vmaxset(vmax);
     }
     UNPROTECT(1);

--_=XFMail.1.3.p0.Linux:990427135205:436=_--
End of MIME message
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._