diff liboctave/CMatrix.cc @ 4773:ccfbd6047a54

[project @ 2004-02-16 19:02:32 by jwe]
author jwe
date Mon, 16 Feb 2004 19:02:33 +0000
parents 334a27c8f453
children 4689ee5e88ec
line wrap: on
line diff
--- a/liboctave/CMatrix.cc	Mon Feb 16 17:57:34 2004 +0000
+++ b/liboctave/CMatrix.cc	Mon Feb 16 19:02:33 2004 +0000
@@ -56,7 +56,7 @@
 #include "mx-inlines.cc"
 #include "oct-cmplx.h"
 
-#ifdef HAVE_FFTW
+#if defined (HAVE_FFTW3)
 #include "oct-fftw.h"
 #endif
 
@@ -1102,7 +1102,7 @@
   return retval;
 }
 
-#ifdef HAVE_FFTW
+#if defined (HAVE_FFTW3)
 
 ComplexMatrix
 ComplexMatrix::fourier (void) const
@@ -1128,12 +1128,7 @@
   const Complex *in (data ());
   Complex *out (retval.fortran_vec ());
 
-  for (size_t i = 0; i < nsamples; i++)
-    {
-      OCTAVE_QUIT;
-
-      octave_fftw::fft (&in[npts * i], &out[npts * i], npts);
-    }
+  octave_fftw::fft (in, out, npts, nsamples); 
 
   return retval;
 }
@@ -1162,12 +1157,7 @@
   const Complex *in (data ());
   Complex *out (retval.fortran_vec ());
 
-  for (size_t i = 0; i < nsamples; i++)
-    {
-      OCTAVE_QUIT;
-
-      octave_fftw::ifft (&in[npts * i], &out[npts * i], npts);
-    }
+  octave_fftw::ifft (in, out, npts, nsamples); 
 
   return retval;
 }
@@ -1175,13 +1165,13 @@
 ComplexMatrix
 ComplexMatrix::fourier2d (void) const
 {
-  int nr = rows ();
-  int nc = cols ();
-
-  ComplexMatrix retval (*this);
-  // Note the order of passing the rows and columns to account for
-  // column-major storage.
-  octave_fftw::fft2d (retval.fortran_vec (), nc, nr);
+  dim_vector dv(rows (), cols ());
+
+  ComplexMatrix retval (rows (), cols ());
+  const Complex *in (data ());
+  Complex *out (retval.fortran_vec ());
+
+  octave_fftw::fftNd (in, out, 2, dv);
 
   return retval;
 }
@@ -1189,13 +1179,13 @@
 ComplexMatrix
 ComplexMatrix::ifourier2d (void) const
 {
-  int nr = rows ();
-  int nc = cols ();
-
-  ComplexMatrix retval (*this);
-  // Note the order of passing the rows and columns to account for
-  // column-major storage.
-  octave_fftw::ifft2d (retval.fortran_vec (), nc, nr);
+  dim_vector dv(rows (), cols ());
+
+  ComplexMatrix retval (rows (), cols ());
+  const Complex *in (data ());
+  Complex *out (retval.fortran_vec ());
+
+  octave_fftw::ifftNd (in, out, 2, dv);
 
   return retval;
 }
@@ -1332,8 +1322,8 @@
   wsave.resize (nn);
   pwsave = wsave.fortran_vec ();
 
-  Array<Complex> row (npts);
-  Complex *prow = row.fortran_vec ();
+  Array<Complex> tmp (npts);
+  Complex *prow = tmp.fortran_vec ();
 
   F77_FUNC (cffti, CFFTI) (npts, pwsave);
 
@@ -1401,8 +1391,8 @@
   wsave.resize (nn);
   pwsave = wsave.fortran_vec ();
 
-  Array<Complex> row (npts);
-  Complex *prow = row.fortran_vec ();
+  Array<Complex> tmp (npts);
+  Complex *prow = tmp.fortran_vec ();
 
   F77_FUNC (cffti, CFFTI) (npts, pwsave);