[Scipy-svn] r4301 - in branches/refactor_fft/scipy/fftpack: . src src/djbfft
scipy-svn at scipy.org
scipy-svn at scipy.org
Tue May 13 01:42:18 EDT 2008
Author: cdavid
Date: 2008-05-13 00:42:10 -0500 (Tue, 13 May 2008)
New Revision: 4301
Modified:
branches/refactor_fft/scipy/fftpack/setup.py
branches/refactor_fft/scipy/fftpack/src/djbfft/api.h
branches/refactor_fft/scipy/fftpack/src/djbfft/common.h
branches/refactor_fft/scipy/fftpack/src/djbfft/drfft.cxx
branches/refactor_fft/scipy/fftpack/src/djbfft/zfft.cxx
branches/refactor_fft/scipy/fftpack/src/fftpack.h
Log:
djbfft backend is now a separate lib.
Modified: branches/refactor_fft/scipy/fftpack/setup.py
===================================================================
--- branches/refactor_fft/scipy/fftpack/setup.py 2008-05-13 03:50:11 UTC (rev 4300)
+++ branches/refactor_fft/scipy/fftpack/setup.py 2008-05-13 05:42:10 UTC (rev 4301)
@@ -8,15 +8,25 @@
from numpy.distutils.system_info import get_info
config = Configuration('fftpack',parent_package, top_path)
+ backends = ['mkl', 'djbfft', 'fftw3', 'fftw2']
+ info = dict([(k, False) for k in backends])
+
djbfft_info = {}
mkl_info = get_info('mkl')
if mkl_info:
mkl_info.setdefault('define_macros', []).append(('SCIPY_MKL_H', None))
fft_opt_info = mkl_info
+ info['mkl'] = True
else:
- fft_opt_info = get_info('fftw3') or get_info('fftw2') \
- or get_info('dfftw')
+ # Take the first in the list
+ for b in ['fftw3', 'fftw2']:
+ tmp = get_info(b)
+ if tmp:
+ fft_opt_info = tmp
+ info[b] = True
+ break
djbfft_info = get_info('djbfft')
+ info['djbfft'] = True
config.add_data_dir('tests')
config.add_data_dir('benchmarks')
@@ -24,6 +34,20 @@
config.add_library('dfftpack',
sources=[join('dfftpack','*.f')])
+ backends_src = {}
+ backends_src['djbfft'] = [join('src/djbfft/', i) for i in
+ ['zfft.cxx', 'drfft.cxx']]
+ backends_src['fftw3'] = [join('src/fftw3/', i) for i in
+ ['zfft.cxx', 'drfft.cxx', 'zfftnd.cxx']]
+
+ for b in ['djbfft']:
+ if info[b]:
+ config.add_library('%s_backend' % b,
+ sources = backends_src[b],
+ include_dirs = ['src', djbfft_info['include_dirs'],
+ fft_opt_info['include_dirs']])
+
+
sources = ['fftpack.pyf', 'src/fftpack.cxx', 'src/zrfft.c']
config.add_extension('_fftpack',
Modified: branches/refactor_fft/scipy/fftpack/src/djbfft/api.h
===================================================================
--- branches/refactor_fft/scipy/fftpack/src/djbfft/api.h 2008-05-13 03:50:11 UTC (rev 4300)
+++ branches/refactor_fft/scipy/fftpack/src/djbfft/api.h 2008-05-13 05:42:10 UTC (rev 4301)
@@ -1,10 +1,21 @@
#ifndef _SCIPY_FFTPACK_DJBFFT_API_H_
#define _SCIPY_FFTPACK_DJBFFT_API_H_
+#include "fftpack.h"
+
void drfft_djbfft(double * inout, int n, int direction, int howmany,
int normalize);
void zfft_djbfft(complex_double * inout,
int n, int direction, int howmany, int normalize);
+#define complex8 complex_double
+#define COMPLEX8_H
+
+extern "C" {
+#include <fftfreq.h>
+#include <fftc8.h>
+#include <fftr8.h>
+};
+
#endif
Modified: branches/refactor_fft/scipy/fftpack/src/djbfft/common.h
===================================================================
--- branches/refactor_fft/scipy/fftpack/src/djbfft/common.h 2008-05-13 03:50:11 UTC (rev 4300)
+++ branches/refactor_fft/scipy/fftpack/src/djbfft/common.h 2008-05-13 05:42:10 UTC (rev 4301)
@@ -3,8 +3,6 @@
#include <cycliccache.h>
-#include "api.h"
-
namespace fft {
class DJBFFTCacheId : public CacheId {
Modified: branches/refactor_fft/scipy/fftpack/src/djbfft/drfft.cxx
===================================================================
--- branches/refactor_fft/scipy/fftpack/src/djbfft/drfft.cxx 2008-05-13 03:50:11 UTC (rev 4300)
+++ branches/refactor_fft/scipy/fftpack/src/djbfft/drfft.cxx 2008-05-13 05:42:10 UTC (rev 4301)
@@ -1,5 +1,5 @@
/*
- * Last Change: Tue May 13 12:00 PM 2008 J
+ * Last Change: Tue May 13 02:00 PM 2008 J
*
* Original code by Pearu Peterson.
*/
@@ -14,6 +14,7 @@
#include <cassert>
#include "common.h"
+#include "api.h"
#ifdef WITH_FFTW3
#define drfft_def drfft_fftw3
Modified: branches/refactor_fft/scipy/fftpack/src/djbfft/zfft.cxx
===================================================================
--- branches/refactor_fft/scipy/fftpack/src/djbfft/zfft.cxx 2008-05-13 03:50:11 UTC (rev 4300)
+++ branches/refactor_fft/scipy/fftpack/src/djbfft/zfft.cxx 2008-05-13 05:42:10 UTC (rev 4301)
@@ -3,8 +3,10 @@
*
* zfft_def is the function * used for size different than 2^N
*/
+#include <new>
#include "common.h"
+#include "api.h"
#ifdef WITH_FFTWORK
#define zfft_def zfft_fftwork
@@ -16,6 +18,8 @@
#define zfft_def zfft_fftpack
#endif
+using namespace fft;
+
class DJBFFTCache: public Cache<DJBFFTCacheId> {
public:
DJBFFTCache(const DJBFFTCacheId& id);
Modified: branches/refactor_fft/scipy/fftpack/src/fftpack.h
===================================================================
--- branches/refactor_fft/scipy/fftpack/src/fftpack.h 2008-05-13 03:50:11 UTC (rev 4300)
+++ branches/refactor_fft/scipy/fftpack/src/fftpack.h 2008-05-13 05:42:10 UTC (rev 4301)
@@ -13,35 +13,28 @@
typedef struct {double r,i;} complex_double;
typedef struct {float r,i;} complex_float;
-#ifdef __cplusplus
extern "C" {
-#endif
void init_convolution_kernel(int n,double* omega, int d,
double (*kernel_func)(int),
int zero_nyquist);
void convolve(int n,double* inout,double* omega,int swap_real_imag);
void convolve_z(int n,double* inout,double* omega_real,double* omega_imag);
-#ifdef __cplusplus
+
+void drfft_fftpack(double *inout, int n, int direction, int howmany,
+ int normalize);
+void zfft_fftpack(complex_double * inout,
+ int n, int direction, int howmany, int normalize);
+void zfftnd_fftpack(complex_double * inout, int rank,
+ int *dims, int direction, int howmany,
+ int normalize);
};
-#endif
extern int ispow2le2e30(int n);
extern int ispow2le2e13(int n);
#ifdef SCIPY_DJBFFT_H
-#ifdef __cplusplus
-extern "C" {
-#endif
#define WITH_DJBFFT
-#define complex8 complex_double
-#define COMPLEX8_H
-#include <fftfreq.h>
-#include <fftc8.h>
-#include <fftr8.h>
-#ifdef __cplusplus
-}
#endif
-#endif
#ifdef SCIPY_MKL_H
#define WITH_MKL
More information about the Scipy-svn
mailing list