Using FFTW in Blitz and SL++ (fwd)

From: Todd Veldhuizen (tveldhui@oonumerics.org)
Date: Thu Jun 11 1998 - 10:53:14 EST


Forwarded message:
>From tveldhui Thu Jun 11 11:44:39 1998
From: Todd Veldhuizen <tveldhui>
Message-Id: <199806111544.LAA31500@oonumerics.org>
Subject: Using FFTW in Blitz and SL++
To: fftw@theory.lcs.mit.edu
Date: Thu, 11 Jun 1998 11:44:31 -0400 (EDT)
Cc: laurent.deniau@cern.ch, karmesin@lanl.gov, swhaney@lanl.gov
X-Mailer: ELM [version 2.4 PL25]
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hi guys. I met Matteo briefly at ICASSP'98 and talked about using
FFTW in Blitz++, a C++ class library for scientific computing. The
folks working on sl++ are also interested in incorporating FFTW.
The POOMA library people might also want to use FFTW some day.

Home pages--
  http://wwwinfo.cern.ch/~ldeniau/sl.html
  http://oonumerics.org/blitz/
  http://www.acl.lanl.gov/PoomaFramework/
  http://theory.lcs.mit.edu/~fftw/

I've done a quick pass through the FFTW documentation. One difficulty
will be handling float vs. double. As I understand it, currently FFTW
is double precision by default; if you want single precision, you
compile with -DFFTW_ENABLE_FLOAT. In a C++ class library like sl++
or Blitz++, this won't work very well. Array/matrix classes in sl++
and Blitz++ are templated on numeric type, e.g. Array<float>,
Array<double>, Array<long double>. Deciding in advance that users may
only do FFTs in double precision (or single precision) would be too
restrictive.

Did you have plans or thoughts about how to address this? Offhand
I was thinking that perhaps FFTW_REAL could be made a template
parameter when compiled with a C++ compiler:

// e.g. in fftw.h
#ifdef FFTW_CPP // Compiled with a C++ compiler; use templates
 #define FFTW_FUNCTION template<class FFTW_REAL>
 #define FFTW_COMPLEX complex<FFTW_REAL>

#else // Compiled with a C compiler; use -DFFTW_ENABLE_FLOAT
 #define FFTW_FUNCTION
 #ifdef FFTW_ENABLE_FLOAT
  typedef float FFTW_REAL;
 #else
  typedef double FFTW_REAL;
 #endif
 typedef struct {
     FFTW_REAL re, im;
 } FFTW_COMPLEX;
#endif

// e.g. in fftwnd.c
FFTW_FUNCTION
void fftwnd(fftwnd_plan p, int howmany,
            FFTW_COMPLEX *in, int istride, int idist,
            FFTW_COMPLEX *out, int ostride, int odist)
{
  ...
}

This could be done without too many changes to the actual code.

So, questions:
- Did you have other ideas about how to handle this?
- Would you be willing to incorporate such changes back into the
main FFTW source tree, provided they weren't too ugly?

Cheers,
Todd



This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 04:30:04 EST