[Scipy-svn] r5371 - trunk/scipy/fftpack/src

scipy-svn@scip... scipy-svn@scip...
Wed Jan 7 12:27:19 CST 2009


Author: cdavid
Date: 2009-01-07 12:26:54 -0600 (Wed, 07 Jan 2009)
New Revision: 5371

Removed:
   trunk/scipy/fftpack/src/cfft_fftpack.c
   trunk/scipy/fftpack/src/cfftnd_fftpack.c
   trunk/scipy/fftpack/src/drfft_fftpack.c
   trunk/scipy/fftpack/src/rfft_fftpack.c
   trunk/scipy/fftpack/src/zfft_fftpack.c
   trunk/scipy/fftpack/src/zfftnd_fftpack.c
Modified:
   trunk/scipy/fftpack/src/convolve.c
   trunk/scipy/fftpack/src/drfft.c
   trunk/scipy/fftpack/src/fftpack.h
   trunk/scipy/fftpack/src/zfftnd.c
Log:
Rename the caches for fftpack wrappers.

Deleted: trunk/scipy/fftpack/src/cfft_fftpack.c
===================================================================
--- trunk/scipy/fftpack/src/cfft_fftpack.c	2009-01-07 18:26:15 UTC (rev 5370)
+++ trunk/scipy/fftpack/src/cfft_fftpack.c	2009-01-07 18:26:54 UTC (rev 5371)
@@ -1,46 +0,0 @@
-/* XXX: use the .src mechanism: zfft_cfft are the same */
-extern void F_FUNC(cfftf,CFFTF)(int*,float*,float*);
-extern void F_FUNC(cfftb,CFFTB)(int*,float*,float*);
-extern void F_FUNC(cffti,CFFTI)(int*,float*);
-GEN_CACHE(cfftpack,(int n)
-	  ,float* wsave;
-	  ,(caches_cfftpack[i].n==n)
-	  ,caches_cfftpack[id].wsave = (float*)malloc(sizeof(float)*(4*n+15));
-	   F_FUNC(cffti,CFFTI)(&n,caches_cfftpack[id].wsave);
-	  ,free(caches_cfftpack[id].wsave);
-	  ,10)
-
-static void cfft_fftpack(complex_float * inout,
-			 int n, int direction, int howmany, int normalize)
-{
-	int i;
-	complex_float *ptr = inout;
-	float *wsave = NULL;
-
-	wsave = caches_cfftpack[get_cache_id_cfftpack(n)].wsave;
-
-	switch (direction) {
-	case 1:
-		for (i = 0; i < howmany; ++i, ptr += n) {
-			cfftf_(&n, (float *) (ptr), wsave);
-
-		}
-		break;
-
-	case -1:
-		for (i = 0; i < howmany; ++i, ptr += n) {
-			cfftb_(&n, (float *) (ptr), wsave);
-		}
-		break;
-	default:
-		fprintf(stderr, "cfft: invalid direction=%d\n", direction);
-	}
-
-	if (normalize) {
-		ptr = inout;
-		for (i = n * howmany - 1; i >= 0; --i) {
-			*((float *) (ptr)) /= n;
-			*((float *) (ptr++) + 1) /= n;
-		}
-	}
-}

Deleted: trunk/scipy/fftpack/src/cfftnd_fftpack.c
===================================================================
--- trunk/scipy/fftpack/src/cfftnd_fftpack.c	2009-01-07 18:26:15 UTC (rev 5370)
+++ trunk/scipy/fftpack/src/cfftnd_fftpack.c	2009-01-07 18:26:54 UTC (rev 5371)
@@ -1,104 +0,0 @@
-/*
- * fftpack backend for multi dimensional fft
- *
- * Original code by Pearu Peaterson
- *
- * Last Change: Wed Aug 08 02:00 PM 2007 J
- */
-
-GEN_CACHE(cfftnd_fftpack, (int n, int rank)
-	  , complex_float * ptr; int *iptr; int rank;
-	  , ((caches_cfftnd_fftpack[i].n == n)
-	     && (caches_cfftnd_fftpack[i].rank == rank))
-	  , caches_cfftnd_fftpack[id].n = n;
-	  caches_cfftnd_fftpack[id].ptr =
-	  (complex_float *) malloc(2 * sizeof(float) * n);
-	  caches_cfftnd_fftpack[id].iptr =
-	  (int *) malloc(4 * rank * sizeof(int));
-	  ,
-	  free(caches_cfftnd_fftpack[id].ptr);
-	  free(caches_cfftnd_fftpack[id].iptr);
-	  , 10)
-
-static
-void sflatten(complex_float * dest, complex_float * src,
-	     int rank, int strides_axis, int dims_axis, int unflat,
-	     int *tmp)
-{
-    int *new_strides = tmp + rank;
-    int *new_dims = tmp + 2 * rank;
-    int *ia = tmp + 3 * rank;
-    int rm1 = rank - 1, rm2 = rank - 2;
-    int i, j, k;
-    for (i = 0; i < rm2; ++i)
-	ia[i] = 0;
-    ia[rm2] = -1;
-    j = 0;
-    if (unflat) {
-        while (next_comb(ia, new_dims, rm2)) {
-            k = 0;
-            for (i = 0; i < rm1; ++i) {
-                k += ia[i] * new_strides[i];
-            }
-            for (i = 0; i < dims_axis; ++i) {
-                *(dest + k + i * strides_axis) = *(src + j++);
-            }
-        }
-    } else {
-        while (next_comb(ia, new_dims, rm2)) {
-            k = 0;
-            for (i = 0; i < rm1; ++i) {
-                k += ia[i] * new_strides[i];
-            }
-            for (i = 0; i < dims_axis; ++i) {
-                *(dest + j++) = *(src + k + i * strides_axis);
-            }
-        }
-    }
-}
-
-extern void cfft(complex_float * inout,
-		 int n, int direction, int howmany, int normalize);
-
-extern void cfftnd_fftpack(complex_float * inout, int rank,
-			   int *dims, int direction, int howmany,
-			   int normalize)
-{
-    int i, sz;
-    complex_float *ptr = inout;
-    int axis;
-    complex_float *tmp;
-    int *itmp;
-    int k, j;
-
-    sz = 1;
-    for (i = 0; i < rank; ++i) {
-        sz *= dims[i];
-    }
-    cfft(ptr, dims[rank - 1], direction, howmany * sz / dims[rank - 1],
-	 normalize);
-
-    i = get_cache_id_cfftnd_fftpack(sz, rank);
-    tmp = caches_cfftnd_fftpack[i].ptr;
-    itmp = caches_cfftnd_fftpack[i].iptr;
-
-    itmp[rank - 1] = 1;
-    for (i = 2; i <= rank; ++i) {
-        itmp[rank - i] = itmp[rank - i + 1] * dims[rank - i + 1];
-    }
-
-    for (i = 0; i < howmany; ++i, ptr += sz) {
-        for (axis = 0; axis < rank - 1; ++axis) {
-            for (k = j = 0; k < rank; ++k) {
-                if (k != axis) {
-                    *(itmp + rank + j) = itmp[k];
-                    *(itmp + 2 * rank + j++) = dims[k] - 1;
-                }
-            }
-            sflatten(tmp, ptr, rank, itmp[axis], dims[axis], 0, itmp);
-            cfft(tmp, dims[axis], direction, sz / dims[axis], normalize);
-            sflatten(ptr, tmp, rank, itmp[axis], dims[axis], 1, itmp);
-        }
-    }
-
-}

Modified: trunk/scipy/fftpack/src/convolve.c
===================================================================
--- trunk/scipy/fftpack/src/convolve.c	2009-01-07 18:26:15 UTC (rev 5370)
+++ trunk/scipy/fftpack/src/convolve.c	2009-01-07 18:26:54 UTC (rev 5371)
@@ -24,7 +24,7 @@
 
 extern void destroy_convolve_cache(void)
 {
-    destroy_dfftpack_caches();
+    destroy_dfftpack_cache();
 }
 
 /**************** convolve **********************/

Modified: trunk/scipy/fftpack/src/drfft.c
===================================================================
--- trunk/scipy/fftpack/src/drfft.c	2009-01-07 18:26:15 UTC (rev 5370)
+++ trunk/scipy/fftpack/src/drfft.c	2009-01-07 18:26:54 UTC (rev 5371)
@@ -14,31 +14,31 @@
 extern void F_FUNC(rffti, RFFTI) (int *, float *);
 
 
-GEN_CACHE(drfftpack, (int n)
+GEN_CACHE(drfft, (int n)
 	  , double *wsave;
-	  , (caches_drfftpack[i].n == n)
-	  , caches_drfftpack[id].wsave =
+	  , (caches_drfft[i].n == n)
+	  , caches_drfft[id].wsave =
 	  (double *) malloc(sizeof(double) * (2 * n + 15));
-	  F_FUNC(dffti, DFFTI) (&n, caches_drfftpack[id].wsave);
-	  , free(caches_drfftpack[id].wsave);
+	  F_FUNC(dffti, DFFTI) (&n, caches_drfft[id].wsave);
+	  , free(caches_drfft[id].wsave);
 	  , 10)
 
-GEN_CACHE(rfftpack, (int n)
+GEN_CACHE(rfft, (int n)
 	  , float *wsave;
-	  , (caches_rfftpack[i].n == n)
-	  , caches_rfftpack[id].wsave =
+	  , (caches_rfft[i].n == n)
+	  , caches_rfft[id].wsave =
 	  (float *) malloc(sizeof(float) * (2 * n + 15));
-	  F_FUNC(rffti, RFFTI) (&n, caches_rfftpack[id].wsave);
-	  , free(caches_rfftpack[id].wsave);
+	  F_FUNC(rffti, RFFTI) (&n, caches_rfft[id].wsave);
+	  , free(caches_rfft[id].wsave);
 	  , 10)
 
-void drfft_fftpack(double *inout, int n, int direction, int howmany,
+void drfft(double *inout, int n, int direction, int howmany,
 			  int normalize)
 {
     int i;
     double *ptr = inout;
     double *wsave = NULL;
-    wsave = caches_drfftpack[get_cache_id_drfftpack(n)].wsave;
+    wsave = caches_drfft[get_cache_id_drfft(n)].wsave;
 
 
     switch (direction) {
@@ -67,13 +67,13 @@
     }
 }
 
-void rfft_fftpack(float *inout, int n, int direction, int howmany,
+void rfft(float *inout, int n, int direction, int howmany,
 			 int normalize)
 {
     int i;
     float *ptr = inout;
     float *wsave = NULL;
-    wsave = caches_rfftpack[get_cache_id_rfftpack(n)].wsave;
+    wsave = caches_rfft[get_cache_id_rfft(n)].wsave;
 
 
     switch (direction) {

Deleted: trunk/scipy/fftpack/src/drfft_fftpack.c
===================================================================
--- trunk/scipy/fftpack/src/drfft_fftpack.c	2009-01-07 18:26:15 UTC (rev 5370)
+++ trunk/scipy/fftpack/src/drfft_fftpack.c	2009-01-07 18:26:54 UTC (rev 5371)
@@ -1,54 +0,0 @@
-/*
- * Last Change: Wed Aug 01 07:00 PM 2007 J
- *
- * FFTPACK implementation
- *
- * Original code by Pearu Peterson.
- */
-
-extern void F_FUNC(dfftf, DFFTF) (int *, double *, double *);
-extern void F_FUNC(dfftb, DFFTB) (int *, double *, double *);
-extern void F_FUNC(dffti, DFFTI) (int *, double *);
-GEN_CACHE(drfftpack, (int n)
-	  , double *wsave;
-	  , (caches_drfftpack[i].n == n)
-	  , caches_drfftpack[id].wsave =
-	  (double *) malloc(sizeof(double) * (2 * n + 15));
-	  F_FUNC(dffti, DFFTI) (&n, caches_drfftpack[id].wsave);
-	  , free(caches_drfftpack[id].wsave);
-	  , 10)
-
-static void drfft_fftpack(double *inout, int n, int direction, int howmany,
-			  int normalize)
-{
-    int i;
-    double *ptr = inout;
-    double *wsave = NULL;
-    wsave = caches_drfftpack[get_cache_id_drfftpack(n)].wsave;
-
-
-    switch (direction) {
-        case 1:
-        for (i = 0; i < howmany; ++i, ptr += n) {
-            dfftf_(&n, ptr, wsave);
-        }
-        break;
-
-    case -1:
-        for (i = 0; i < howmany; ++i, ptr += n) {
-            dfftb_(&n, ptr, wsave);
-        }
-        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;
-        }
-    }
-}

Modified: trunk/scipy/fftpack/src/fftpack.h
===================================================================
--- trunk/scipy/fftpack/src/fftpack.h	2009-01-07 18:26:15 UTC (rev 5370)
+++ trunk/scipy/fftpack/src/fftpack.h	2009-01-07 18:26:54 UTC (rev 5371)
@@ -73,7 +73,7 @@
   last_cache_id_##name = id;\
   return id;\
 }\
-static void destroy_##name##_caches(void) {\
+void destroy_##name##_cache(void) {\
   int id;\
   for (id=0;id<nof_in_cache_##name;++id) {\
     FREE \

Deleted: trunk/scipy/fftpack/src/rfft_fftpack.c
===================================================================
--- trunk/scipy/fftpack/src/rfft_fftpack.c	2009-01-07 18:26:15 UTC (rev 5370)
+++ trunk/scipy/fftpack/src/rfft_fftpack.c	2009-01-07 18:26:54 UTC (rev 5371)
@@ -1,54 +0,0 @@
-/*
- * Last Change: Wed Aug 01 07:00 PM 2007 J
- *
- * FFTPACK implementation
- *
- * Original code by Pearu Peterson.
- */
-
-extern void F_FUNC(rfftf, RFFTF) (int *, float *, float *);
-extern void F_FUNC(rfftb, RFFTB) (int *, float *, float *);
-extern void F_FUNC(rffti, RFFTI) (int *, float *);
-GEN_CACHE(rfftpack, (int n)
-	  , float *wsave;
-	  , (caches_rfftpack[i].n == n)
-	  , caches_rfftpack[id].wsave =
-	  (float *) malloc(sizeof(float) * (2 * n + 15));
-	  F_FUNC(rffti, RFFTI) (&n, caches_rfftpack[id].wsave);
-	  , free(caches_rfftpack[id].wsave);
-	  , 10)
-
-static void rfft_fftpack(float *inout, int n, int direction, int howmany,
-			 int normalize)
-{
-    int i;
-    float *ptr = inout;
-    float *wsave = NULL;
-    wsave = caches_rfftpack[get_cache_id_rfftpack(n)].wsave;
-
-
-    switch (direction) {
-        case 1:
-        for (i = 0; i < howmany; ++i, ptr += n) {
-            rfftf_(&n, ptr, wsave);
-        }
-        break;
-
-    case -1:
-        for (i = 0; i < howmany; ++i, ptr += n) {
-            rfftb_(&n, ptr, wsave);
-        }
-        break;
-
-    default:
-        fprintf(stderr, "rfft: invalid direction=%d\n", direction);
-    }
-
-    if (normalize) {
-        float d = 1.0 / n;
-        ptr = inout;
-        for (i = n * howmany - 1; i >= 0; --i) {
-            (*(ptr++)) *= d;
-        }
-    }
-}

Deleted: trunk/scipy/fftpack/src/zfft_fftpack.c
===================================================================
--- trunk/scipy/fftpack/src/zfft_fftpack.c	2009-01-07 18:26:15 UTC (rev 5370)
+++ trunk/scipy/fftpack/src/zfft_fftpack.c	2009-01-07 18:26:54 UTC (rev 5371)
@@ -1,45 +0,0 @@
-extern void F_FUNC(zfftf,ZFFTF)(int*,double*,double*);
-extern void F_FUNC(zfftb,ZFFTB)(int*,double*,double*);
-extern void F_FUNC(zffti,ZFFTI)(int*,double*);
-GEN_CACHE(zfftpack,(int n)
-	  ,double* wsave;
-	  ,(caches_zfftpack[i].n==n)
-	  ,caches_zfftpack[id].wsave = (double*)malloc(sizeof(double)*(4*n+15));
-	   F_FUNC(zffti,ZFFTI)(&n,caches_zfftpack[id].wsave);
-	  ,free(caches_zfftpack[id].wsave);
-	  ,10)
-
-static void zfft_fftpack(complex_double * inout,
-			 int n, int direction, int howmany, int normalize)
-{
-	int i;
-	complex_double *ptr = inout;
-	double *wsave = NULL;
-
-	wsave = caches_zfftpack[get_cache_id_zfftpack(n)].wsave;
-
-	switch (direction) {
-	case 1:
-		for (i = 0; i < howmany; ++i, ptr += n) {
-			zfftf_(&n, (double *) (ptr), wsave);
-
-		}
-		break;
-
-	case -1:
-		for (i = 0; i < howmany; ++i, ptr += n) {
-			zfftb_(&n, (double *) (ptr), wsave);
-		}
-		break;
-	default:
-		fprintf(stderr, "zfft: invalid direction=%d\n", direction);
-	}
-
-	if (normalize) {
-		ptr = inout;
-		for (i = n * howmany - 1; i >= 0; --i) {
-			*((double *) (ptr)) /= n;
-			*((double *) (ptr++) + 1) /= n;
-		}
-	}
-}

Modified: trunk/scipy/fftpack/src/zfftnd.c
===================================================================
--- trunk/scipy/fftpack/src/zfftnd.c	2009-01-07 18:26:15 UTC (rev 5370)
+++ trunk/scipy/fftpack/src/zfftnd.c	2009-01-07 18:26:54 UTC (rev 5371)
@@ -5,32 +5,32 @@
  */
 #include "fftpack.h"
 
-GEN_CACHE(zfftnd_fftpack, (int n, int rank)
+GEN_CACHE(zfftnd, (int n, int rank)
 	  , complex_double * ptr; int *iptr; int rank;
-	  , ((caches_zfftnd_fftpack[i].n == n)
-	     && (caches_zfftnd_fftpack[i].rank == rank))
-	  , caches_zfftnd_fftpack[id].n = n;
-	  caches_zfftnd_fftpack[id].ptr =
+	  , ((caches_zfftnd[i].n == n)
+	     && (caches_zfftnd[i].rank == rank))
+	  , caches_zfftnd[id].n = n;
+	  caches_zfftnd[id].ptr =
 	  (complex_double *) malloc(2 * sizeof(double) * n);
-	  caches_zfftnd_fftpack[id].iptr =
+	  caches_zfftnd[id].iptr =
 	  (int *) malloc(4 * rank * sizeof(int));
 	  ,
-	  free(caches_zfftnd_fftpack[id].ptr);
-	  free(caches_zfftnd_fftpack[id].iptr);
+	  free(caches_zfftnd[id].ptr);
+	  free(caches_zfftnd[id].iptr);
 	  , 10)
 
-GEN_CACHE(cfftnd_fftpack, (int n, int rank)
+GEN_CACHE(cfftnd, (int n, int rank)
 	  , complex_float * ptr; int *iptr; int rank;
-	  , ((caches_cfftnd_fftpack[i].n == n)
-	     && (caches_cfftnd_fftpack[i].rank == rank))
-	  , caches_cfftnd_fftpack[id].n = n;
-	  caches_cfftnd_fftpack[id].ptr =
+	  , ((caches_cfftnd[i].n == n)
+	     && (caches_cfftnd[i].rank == rank))
+	  , caches_cfftnd[id].n = n;
+	  caches_cfftnd[id].ptr =
 	  (complex_float *) malloc(2 * sizeof(float) * n);
-	  caches_cfftnd_fftpack[id].iptr =
+	  caches_cfftnd[id].iptr =
 	  (int *) malloc(4 * rank * sizeof(int));
 	  ,
-	  free(caches_cfftnd_fftpack[id].ptr);
-	  free(caches_cfftnd_fftpack[id].iptr);
+	  free(caches_cfftnd[id].ptr);
+	  free(caches_cfftnd[id].iptr);
 	  , 10)
 
 static
@@ -127,7 +127,7 @@
 extern void zfft(complex_double * inout,
 		 int n, int direction, int howmany, int normalize);
 
-extern void zfftnd_fftpack(complex_double * inout, int rank,
+extern void zfftnd(complex_double * inout, int rank,
 			   int *dims, int direction, int howmany,
 			   int normalize)
 {
@@ -145,9 +145,9 @@
     zfft(ptr, dims[rank - 1], direction, howmany * sz / dims[rank - 1],
 	 normalize);
 
-    i = get_cache_id_zfftnd_fftpack(sz, rank);
-    tmp = caches_zfftnd_fftpack[i].ptr;
-    itmp = caches_zfftnd_fftpack[i].iptr;
+    i = get_cache_id_zfftnd(sz, rank);
+    tmp = caches_zfftnd[i].ptr;
+    itmp = caches_zfftnd[i].iptr;
 
     itmp[rank - 1] = 1;
     for (i = 2; i <= rank; ++i) {
@@ -170,7 +170,7 @@
 
 }
 
-extern void cfftnd_fftpack(complex_float * inout, int rank,
+extern void cfftnd(complex_float * inout, int rank,
 			   int *dims, int direction, int howmany,
 			   int normalize)
 {
@@ -188,9 +188,9 @@
     cfft(ptr, dims[rank - 1], direction, howmany * sz / dims[rank - 1],
 	 normalize);
 
-    i = get_cache_id_cfftnd_fftpack(sz, rank);
-    tmp = caches_cfftnd_fftpack[i].ptr;
-    itmp = caches_cfftnd_fftpack[i].iptr;
+    i = get_cache_id_cfftnd(sz, rank);
+    tmp = caches_cfftnd[i].ptr;
+    itmp = caches_cfftnd[i].iptr;
 
     itmp[rank - 1] = 1;
     for (i = 2; i <= rank; ++i) {

Deleted: trunk/scipy/fftpack/src/zfftnd_fftpack.c
===================================================================
--- trunk/scipy/fftpack/src/zfftnd_fftpack.c	2009-01-07 18:26:15 UTC (rev 5370)
+++ trunk/scipy/fftpack/src/zfftnd_fftpack.c	2009-01-07 18:26:54 UTC (rev 5371)
@@ -1,118 +0,0 @@
-/*
- * fftpack backend for multi dimensional fft
- *
- * Original code by Pearu Peaterson
- *
- * Last Change: Wed Aug 08 02:00 PM 2007 J
- */
-
-GEN_CACHE(zfftnd_fftpack, (int n, int rank)
-	  , complex_double * ptr; int *iptr; int rank;
-	  , ((caches_zfftnd_fftpack[i].n == n)
-	     && (caches_zfftnd_fftpack[i].rank == rank))
-	  , caches_zfftnd_fftpack[id].n = n;
-	  caches_zfftnd_fftpack[id].ptr =
-	  (complex_double *) malloc(2 * sizeof(double) * n);
-	  caches_zfftnd_fftpack[id].iptr =
-	  (int *) malloc(4 * rank * sizeof(int));
-	  ,
-	  free(caches_zfftnd_fftpack[id].ptr);
-	  free(caches_zfftnd_fftpack[id].iptr);
-	  , 10)
-
-static
-/*inline : disabled because MSVC6.0 fails to compile it. */
-int next_comb(int *ia, int *da, int m)
-{
-    while (m >= 0 && ia[m] == da[m]) {
-        ia[m--] = 0;
-    }
-    if (m < 0) {
-        return 0;
-    }
-    ia[m]++;
-    return 1;
-}
-
-static
-void flatten(complex_double * dest, complex_double * src,
-	     int rank, int strides_axis, int dims_axis, int unflat,
-	     int *tmp)
-{
-    int *new_strides = tmp + rank;
-    int *new_dims = tmp + 2 * rank;
-    int *ia = tmp + 3 * rank;
-    int rm1 = rank - 1, rm2 = rank - 2;
-    int i, j, k;
-    for (i = 0; i < rm2; ++i)
-	ia[i] = 0;
-    ia[rm2] = -1;
-    j = 0;
-    if (unflat) {
-        while (next_comb(ia, new_dims, rm2)) {
-            k = 0;
-            for (i = 0; i < rm1; ++i) {
-                k += ia[i] * new_strides[i];
-            }
-            for (i = 0; i < dims_axis; ++i) {
-                *(dest + k + i * strides_axis) = *(src + j++);
-            }
-        }
-    } else {
-        while (next_comb(ia, new_dims, rm2)) {
-            k = 0;
-            for (i = 0; i < rm1; ++i) {
-                k += ia[i] * new_strides[i];
-            }
-            for (i = 0; i < dims_axis; ++i) {
-                *(dest + j++) = *(src + k + i * strides_axis);
-            }
-        }
-    }
-}
-
-extern void zfft(complex_double * inout,
-		 int n, int direction, int howmany, int normalize);
-
-extern void zfftnd_fftpack(complex_double * inout, int rank,
-			   int *dims, int direction, int howmany,
-			   int normalize)
-{
-    int i, sz;
-    complex_double *ptr = inout;
-    int axis;
-    complex_double *tmp;
-    int *itmp;
-    int k, j;
-
-    sz = 1;
-    for (i = 0; i < rank; ++i) {
-        sz *= dims[i];
-    }
-    zfft(ptr, dims[rank - 1], direction, howmany * sz / dims[rank - 1],
-	 normalize);
-
-    i = get_cache_id_zfftnd_fftpack(sz, rank);
-    tmp = caches_zfftnd_fftpack[i].ptr;
-    itmp = caches_zfftnd_fftpack[i].iptr;
-
-    itmp[rank - 1] = 1;
-    for (i = 2; i <= rank; ++i) {
-        itmp[rank - i] = itmp[rank - i + 1] * dims[rank - i + 1];
-    }
-
-    for (i = 0; i < howmany; ++i, ptr += sz) {
-        for (axis = 0; axis < rank - 1; ++axis) {
-            for (k = j = 0; k < rank; ++k) {
-                if (k != axis) {
-                    *(itmp + rank + j) = itmp[k];
-                    *(itmp + 2 * rank + j++) = dims[k] - 1;
-                }
-            }
-            flatten(tmp, ptr, rank, itmp[axis], dims[axis], 0, itmp);
-            zfft(tmp, dims[axis], direction, sz / dims[axis], normalize);
-            flatten(ptr, tmp, rank, itmp[axis], dims[axis], 1, itmp);
-        }
-    }
-
-}



More information about the Scipy-svn mailing list