Mercurial > hg > octave-nkf
diff liboctave/dMatrix.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 | 44046bbaa52c |
line wrap: on
line diff
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -52,7 +52,7 @@ #include "oct-cmplx.h" #include "quit.h" -#ifdef HAVE_FFTW +#if defined (HAVE_FFTW3) #include "oct-fftw.h" #endif @@ -766,7 +766,7 @@ } } -#ifdef HAVE_FFTW +#if defined (HAVE_FFTW3) ComplexMatrix Matrix::fourier (void) const @@ -789,16 +789,10 @@ nsamples = nc; } - ComplexMatrix tmp (*this); - Complex *in (tmp.fortran_vec ()); + const double *in (fortran_vec ()); 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; } @@ -828,12 +822,7 @@ Complex *in (tmp.fortran_vec ()); 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; } @@ -841,13 +830,11 @@ ComplexMatrix Matrix::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 ()); + + const double *in = fortran_vec (); + ComplexMatrix retval (rows (), cols ()); + octave_fftw::fftNd (in, retval.fortran_vec (), 2, dv); return retval; } @@ -855,13 +842,12 @@ ComplexMatrix Matrix::ifourier2d (void) const { - int nr = rows (); - int nc = cols (); + dim_vector dv(rows (), 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); + Complex *out (retval.fortran_vec ()); + + octave_fftw::ifftNd (out, out, 2, dv); return retval; } @@ -998,8 +984,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); @@ -1067,8 +1053,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);