[Scipy-svn] r4234 - in branches/refactor_fft/scipy/fftpack: . src src/fftw3
scipy-svn at scipy.org
scipy-svn at scipy.org
Mon May 5 12:39:28 EDT 2008
Author: cdavid
Date: 2008-05-05 11:39:18 -0500 (Mon, 05 May 2008)
New Revision: 4234
Added:
branches/refactor_fft/scipy/fftpack/src/drfft.cxx
branches/refactor_fft/scipy/fftpack/src/fftw3/drfft.cxx
Removed:
branches/refactor_fft/scipy/fftpack/src/drfft.c
branches/refactor_fft/scipy/fftpack/src/fftw3/drfft.c
Modified:
branches/refactor_fft/scipy/fftpack/setup.py
Log:
Moving fftw3 implementation of drfft in c++ code.
Modified: branches/refactor_fft/scipy/fftpack/setup.py
===================================================================
--- branches/refactor_fft/scipy/fftpack/setup.py 2008-05-05 13:08:12 UTC (rev 4233)
+++ branches/refactor_fft/scipy/fftpack/setup.py 2008-05-05 16:39:18 UTC (rev 4234)
@@ -24,7 +24,7 @@
config.add_library('dfftpack',
sources=[join('dfftpack','*.f')])
- sources = ['fftpack.pyf','src/zfft.cxx','src/drfft.c','src/zrfft.c',
+ sources = ['fftpack.pyf','src/zfft.cxx','src/drfft.cxx','src/zrfft.c',
'src/zfftnd.c']
config.add_extension('_fftpack',
@@ -34,7 +34,7 @@
depends=['src/djbfft/zfft.cxx', 'src/fftw/zfft.cxx', 'src/fftpack/zfft.cxx',
'src/fftw3/zfft.cxx', 'src/mkl/zfft.cxx',
'src/djbfft/drfft.c', 'src/fftpack/drfft.c',
- 'src/fftw3/drfft.c', 'src/fftw/drfft.c',
+ 'src/fftw3/drfft.cxx', 'src/fftw/drfft.c',
'src/fftpack/zfftnd.c', 'src/fftw/zfftnd.c',
'src/fftw3/zfftnd.c', 'src/mkl/zfftnd.c',
],
Deleted: branches/refactor_fft/scipy/fftpack/src/drfft.c
===================================================================
--- branches/refactor_fft/scipy/fftpack/src/drfft.c 2008-05-05 13:08:12 UTC (rev 4233)
+++ branches/refactor_fft/scipy/fftpack/src/drfft.c 2008-05-05 16:39:18 UTC (rev 4234)
@@ -1,71 +0,0 @@
-/*
- Interface to various FFT libraries.
- Double real FFT and IFFT.
- Author: Pearu Peterson, August 2002
- */
-
-#include "fftpack.h"
-
-/* The following macro convert private backend specific function to the public
- * functions exported by the module */
-#define GEN_PUBLIC_API(name) \
-void destroy_drfft_cache(void)\
-{\
- destroy_dr##name##_caches();\
-}\
-\
-void drfft(double *inout, int n, \
- int direction, int howmany, int normalize)\
-{\
- drfft_##name(inout, n, direction, howmany, normalize);\
-}
-
-/* ************** Definition of backend specific functions ********* */
-
-/*
- * To add a backend :
- * - create a file drfft_name.c, where you define a function drfft_name where
- * name is the name of your backend. If you do not use the GEN_CACHE macro,
- * you will need to define a function void destroy_drname_caches(void),
- * which can do nothing
- * - in drfft.c, include the drfft_name.c file, and add the 3 following lines
- * just after it:
- * #ifndef WITH_DJBFFT
- * GEN_PUBLIC_API(name)
- * #endif
- */
-
-#ifdef WITH_FFTW3
- #include "fftw3/drfft.c"
- #ifndef WITH_DJBFFT
- GEN_PUBLIC_API(fftw3)
- #endif
-#elif defined WITH_FFTW
- #include "fftw/drfft.c"
- #ifndef WITH_DJBFFT
- GEN_PUBLIC_API(fftw)
- #endif
-#else /* Use fftpack by default */
- #include "fftpack/drfft.c"
- #ifndef WITH_DJBFFT
- GEN_PUBLIC_API(fftpack)
- #endif
-#endif
-
-/*
- * djbfft must be used at the end, because it needs another backend (defined
- * above) for non 2^n * size
- */
-#ifdef WITH_DJBFFT
- #include "djbfft/drfft.c"
- void destroy_drfft_cache(void)
- {
- destroy_drdjbfft_caches();
- drfft_def_destroy_cache();
- }
- void drfft(double *inout, int n,
- int direction, int howmany, int normalize)
- {
- drfft_djbfft(inout, n, direction, howmany, normalize);
- }
-#endif
Copied: branches/refactor_fft/scipy/fftpack/src/drfft.cxx (from rev 4233, branches/refactor_fft/scipy/fftpack/src/drfft.c)
===================================================================
--- branches/refactor_fft/scipy/fftpack/src/drfft.c 2008-05-05 13:08:12 UTC (rev 4233)
+++ branches/refactor_fft/scipy/fftpack/src/drfft.cxx 2008-05-05 16:39:18 UTC (rev 4234)
@@ -0,0 +1,71 @@
+/*
+ Interface to various FFT libraries.
+ Double real FFT and IFFT.
+ Author: Pearu Peterson, August 2002
+ */
+
+#include "fftpack.h"
+
+/* The following macro convert private backend specific function to the public
+ * functions exported by the module */
+#define GEN_PUBLIC_API(name) \
+void destroy_drfft_cache(void)\
+{\
+ destroy_dr##name##_caches();\
+}\
+\
+void drfft(double *inout, int n, \
+ int direction, int howmany, int normalize)\
+{\
+ drfft_##name(inout, n, direction, howmany, normalize);\
+}
+
+/* ************** Definition of backend specific functions ********* */
+
+/*
+ * To add a backend :
+ * - create a file drfft_name.c, where you define a function drfft_name where
+ * name is the name of your backend. If you do not use the GEN_CACHE macro,
+ * you will need to define a function void destroy_drname_caches(void),
+ * which can do nothing
+ * - in drfft.c, include the drfft_name.c file, and add the 3 following lines
+ * just after it:
+ * #ifndef WITH_DJBFFT
+ * GEN_PUBLIC_API(name)
+ * #endif
+ */
+
+#ifdef WITH_FFTW3
+ #include "fftw3/drfft.cxx"
+ #ifndef WITH_DJBFFT
+ GEN_PUBLIC_API(fftw3)
+ #endif
+#elif defined WITH_FFTW
+ #include "fftw/drfft.c"
+ #ifndef WITH_DJBFFT
+ GEN_PUBLIC_API(fftw)
+ #endif
+#else /* Use fftpack by default */
+ #include "fftpack/drfft.c"
+ #ifndef WITH_DJBFFT
+ GEN_PUBLIC_API(fftpack)
+ #endif
+#endif
+
+/*
+ * djbfft must be used at the end, because it needs another backend (defined
+ * above) for non 2^n * size
+ */
+#ifdef WITH_DJBFFT
+ #include "djbfft/drfft.c"
+ void destroy_drfft_cache(void)
+ {
+ destroy_drdjbfft_caches();
+ drfft_def_destroy_cache();
+ }
+ void drfft(double *inout, int n,
+ int direction, int howmany, int normalize)
+ {
+ drfft_djbfft(inout, n, direction, howmany, normalize);
+ }
+#endif
Deleted: branches/refactor_fft/scipy/fftpack/src/fftw3/drfft.c
===================================================================
--- branches/refactor_fft/scipy/fftpack/src/fftw3/drfft.c 2008-05-05 13:08:12 UTC (rev 4233)
+++ branches/refactor_fft/scipy/fftpack/src/fftw3/drfft.c 2008-05-05 16:39:18 UTC (rev 4234)
@@ -1,65 +0,0 @@
-/*
- * Last Change: Wed Aug 01 07:00 PM 2007 J
- *
- * FFTW3 implementation
- *
- * Original code by Pearu Peterson.
- */
-
-GEN_CACHE(drfftw3, (int n, int d, int flags)
- , int direction;
- int flags;
- fftw_plan plan;
- double *ptr;, ((caches_drfftw3[i].n == n) &&
- (caches_drfftw3[i].direction == d) &&
- (caches_drfftw3[i].flags == flags))
- , caches_drfftw3[id].direction = d;
- caches_drfftw3[id].flags = flags;
- caches_drfftw3[id].ptr =
- (double *) fftw_malloc(sizeof(double) * (n));
- caches_drfftw3[id].plan =
- fftw_plan_r2r_1d(n, caches_drfftw3[id].ptr, caches_drfftw3[id].ptr,
- (d > 0 ? FFTW_R2HC : FFTW_HC2R), flags);,
- fftw_destroy_plan(caches_drfftw3[id].plan);
- fftw_free(caches_drfftw3[id].ptr);, 10)
-
-static void drfft_fftw3(double *inout, int n, int direction, int
- howmany, int normalize)
-{
- int i;
- double *ptr = inout;
-
- double *ptrc = NULL;
- fftw_plan plan = NULL;
-
- i = get_cache_id_drfftw3(n, direction, FFTW_ESTIMATE);
- plan = caches_drfftw3[i].plan;
- ptrc = caches_drfftw3[i].ptr;
- switch (direction) {
- case 1:
- for (i = 0; i < howmany; ++i, ptr += n) {
- memcpy(ptrc, ptr, sizeof(double) * n);
- fftw_execute(plan);
- COPYRFFTW2STD(ptrc, ptr, n);
- }
- break;
-
- case -1:
- for (i = 0; i < howmany; ++i, ptr += n) {
- COPYINVRFFTW2STD(ptr, ptrc, n);
- fftw_execute(plan);
- memcpy(ptr, ptrc, sizeof(double) * n);
- }
- break;
- default:
- fprintf(stderr, "drfft: invalid direction=%d\n", direction);
- }
-
- if (normalize) {
- double d = 1.0 / n;
- ptr = inout;
- for (i = n * howmany - 1; i >= 0; --i) {
- (*(ptr++)) *= d;
- }
- }
-}
Copied: branches/refactor_fft/scipy/fftpack/src/fftw3/drfft.cxx (from rev 4233, branches/refactor_fft/scipy/fftpack/src/fftw3/drfft.c)
More information about the Scipy-svn
mailing list