Diff of /fftn.c [a531c2] .. [8b9751]  Maximize  Restore

  Switch to unified view

a/fftn.c b/fftn.c
...
...
50
 *
50
 *
51
 * Private:
51
 * Private:
52
 *  fftradix / fftradixf
52
 *  fftradix / fftradixf
53
 *
53
 *
54
 * ----------------------------------------------------------------------*
54
 * ----------------------------------------------------------------------*
55
 * int fftradix (REAL Re[], REAL Im[], size_t nTotal, size_t nPass,
55
 * int fftradix (REAL Re[], REAL Im[], unsigned int nTotal, unsigned int nPass,
56
 *       size_t nSpan, int iSign, size_t maxFactors,
56
 *       unsigned int nSpan, int iSign, unsigned int maxFactors,
57
 *       size_t maxPerm);
57
 *       unsigned int maxPerm);
58
 *
58
 *
59
 * RE and IM hold the real and imaginary components of the data, and
59
 * RE and IM hold the real and imaginary components of the data, and
60
 * return the resulting real and imaginary Fourier coefficients.
60
 * return the resulting real and imaginary Fourier coefficients.
61
 * Multidimensional data *must* be allocated contiguously.  There is
61
 * Multidimensional data *must* be allocated contiguously.  There is
62
 * no limit on the number of dimensions.
62
 * no limit on the number of dimensions.
...
...
214
}
214
}
215
/*}}}*/
215
/*}}}*/
216
216
217
/* return the number of factors */
217
/* return the number of factors */
218
static int
218
static int
219
factorize (int nPass, int * kt)
219
factorize (unsigned int nPass, int * kt)
220
{
220
{
221
   int nFactor = 0;
221
   int nFactor = 0;
222
   int j, jj;
222
   int j;
223
   unsigned int jj;
223
224
224
   *kt = 0;
225
   *kt = 0;
225
   /* determine the factors of n */
226
   /* determine the factors of n */
226
   while ((nPass % 16) == 0)    /* factors of 4 */
227
   while ((nPass % 16) == 0)    /* factors of 4 */
227
     {
228
     {
...
...
293
# define FFTRADIX   fftradix
294
# define FFTRADIX   fftradix
294
# define FFTRADIXS  "fftradix"
295
# define FFTRADIXS  "fftradix"
295
/* double precision routine */
296
/* double precision routine */
296
static int
297
static int
297
fftradix (double Re[], double Im[],
298
fftradix (double Re[], double Im[],
298
      size_t nTotal, size_t nPass, size_t nSpan, int isign,
299
      unsigned int nTotal, unsigned int nPass, unsigned int nSpan, int isign,
299
      int maxFactors, int maxPerm);
300
      unsigned int maxFactors, unsigned int maxPerm);
300
# include __FILE__          /* include this file again */
301
# include __FILE__          /* include this file again */
301
#endif
302
#endif
302
/*}}}*/
303
/*}}}*/
303
304
304
/*{{{ defines for re-including float precision */
305
/*{{{ defines for re-including float precision */
...
...
315
# define FFTRADIX   fftradixf   /* trailing 'f' for float */
316
# define FFTRADIX   fftradixf   /* trailing 'f' for float */
316
# define FFTRADIXS  "fftradixf" /* name for error message */
317
# define FFTRADIXS  "fftradixf" /* name for error message */
317
/* float precision routine */
318
/* float precision routine */
318
static int
319
static int
319
fftradixf (float Re[], float Im[],
320
fftradixf (float Re[], float Im[],
320
       size_t nTotal, size_t nPass, size_t nSpan, int isign,
321
       unsigned int nTotal, unsigned int nPass, unsigned int nSpan, int isign,
321
       int maxFactors, size_t maxPerm);
322
       unsigned int maxFactors, unsigned int maxPerm);
322
# include  __FILE__         /* include this file again */
323
# include  __FILE__         /* include this file again */
323
#endif
324
#endif
324
/*}}}*/
325
/*}}}*/
325
#else   /* _FFTN_C */
326
#else   /* _FFTN_C */
326
327
...
...
337
/*
338
/*
338
 *
339
 *
339
 */
340
 */
340
int
341
int
341
FFTN (int ndim,
342
FFTN (int ndim,
342
      const int dims [],
343
      const unsigned int dims [],
343
      REAL Re [],
344
      REAL Re [],
344
      REAL Im [],
345
      REAL Im [],
345
      int iSign,
346
      int iSign,
346
      double scaling)
347
      double scaling)
347
{
348
{
348
   size_t nTotal;
349
   unsigned int nTotal;
349
   int maxFactors, maxPerm;
350
   unsigned int maxFactors, maxPerm;
350
351
351
   /*
352
   /*
352
    * tally the number of elements in the data array
353
    * tally the number of elements in the data array
353
    * and determine the number of dimensions
354
    * and determine the number of dimensions
354
    */
355
    */
...
...
407
   maxPerm = 209;
408
   maxPerm = 209;
408
#endif
409
#endif
409
   /* loop over the dimensions: */
410
   /* loop over the dimensions: */
410
   if (dims != NULL)
411
   if (dims != NULL)
411
     {
412
     {
412
    size_t nSpan = 1;
413
    unsigned int nSpan = 1;
413
    int i;
414
    int i;
414
415
415
    for (i = 0; i < ndim; i++)
416
    for (i = 0; i < ndim; i++)
416
      {
417
      {
417
         int ret;
418
         int ret;
...
...
464
 * possible to make this a standalone function
465
 * possible to make this a standalone function
465
 */
466
 */
466
static int
467
static int
467
FFTRADIX (REAL Re [],
468
FFTRADIX (REAL Re [],
468
      REAL Im [],
469
      REAL Im [],
469
      size_t nTotal,
470
      unsigned int nTotal,
470
      size_t nPass,
471
      unsigned int nPass,
471
      size_t nSpan,
472
      unsigned int nSpan,
472
      int iSign,
473
      int iSign,
473
      int maxFactors,
474
      unsigned int maxFactors,
474
      int maxPerm)
475
      unsigned int maxPerm)
475
{
476
{
476
   int ii, nFactor, kspan, ispan, inc;
477
   int ii, nFactor, kspan, ispan, inc;
477
   int j, jc, jf, jj, k, k1, k3, kk, kt, nn, ns, nt;
478
   int j, jc, jf, jj, k, k1, k3, kk, kt, nn, ns, nt;
478
479
479
   REAL radf;
480
   REAL radf;