Chris@42: Chris@42: Chris@42: Chris@42: Chris@42:
Chris@42:Chris@42: Next: FFTW Constants in Fortran, Previous: Calling FFTW from Legacy Fortran, Up: Calling FFTW from Legacy Fortran [Contents][Index]
Chris@42:Nearly all of the FFTW functions have Fortran-callable equivalents.
Chris@42: The name of the legacy Fortran routine is the same as that of the
Chris@42: corresponding C routine, but with the ‘fftw_’ prefix replaced by
Chris@42: ‘dfftw_’.9 The single and long-double precision
Chris@42: versions use ‘sfftw_’ and ‘lfftw_’, respectively, instead of
Chris@42: ‘fftwf_’ and ‘fftwl_’; quadruple precision (real*16
)
Chris@42: is available on some systems as ‘fftwq_’ (see Precision).
Chris@42: (Note that long double
on x86 hardware is usually at most
Chris@42: 80-bit extended precision, not quadruple precision.)
Chris@42:
For the most part, all of the arguments to the functions are the same, Chris@42: with the following exceptions: Chris@42:
Chris@42:plan
variables (what would be of type fftw_plan
in C),
Chris@42: must be declared as a type that is at least as big as a pointer
Chris@42: (address) on your machine. We recommend using integer*8
everywhere,
Chris@42: since this should always be big enough.
Chris@42:
Chris@42:
Chris@42: fftw_plan_dft
) is
Chris@42: converted into a subroutine. The return value is converted into
Chris@42: an additional first parameter of this subroutine.10
Chris@42:
Chris@42: fftw_malloc
dynamic-allocation routine.
Chris@42: If you want to exploit the SIMD FFTW (see SIMD alignment and fftw_malloc), you’ll
Chris@42: need to figure out some other way to ensure that your arrays are at
Chris@42: least 16-byte aligned.
Chris@42:
Chris@42: fftw_iodim
Chris@42: structure from the guru interface (see Guru vector and transform sizes) must be split into separate arguments. In particular, any
Chris@42: fftw_iodim
array arguments in the C guru interface become three
Chris@42: integer array arguments (n
, is
, and os
) in the
Chris@42: Fortran guru interface, all of whose lengths should be equal to the
Chris@42: corresponding rank
argument.
Chris@42:
Chris@42: kind
array parameter, so the kind
array
Chris@42: of that routine should be in the reverse of the order of the iodim
Chris@42: arrays (see above).
Chris@42:
Chris@42: In general, you should take care to use Fortran data types that
Chris@42: correspond to (i.e. are the same size as) the C types used by FFTW.
Chris@42: In practice, this correspondence is usually straightforward
Chris@42: (i.e. integer
corresponds to int
, real
Chris@42: corresponds to float
, etcetera). The native Fortran
Chris@42: double/single-precision complex type should be compatible with
Chris@42: fftw_complex
/fftwf_complex
. Such simple correspondences
Chris@42: are assumed in the examples below.
Chris@42:
Chris@42:
Technically, Fortran 77 identifiers are not Chris@42: allowed to have more than 6 characters, nor may they contain Chris@42: underscores. Any compiler that enforces this limitation doesn’t Chris@42: deserve to link to FFTW.
Chris@42:The Chris@42: reason for this is that some Fortran implementations seem to have Chris@42: trouble with C function return values, and vice versa.
Chris@42:Chris@42: Next: FFTW Constants in Fortran, Previous: Calling FFTW from Legacy Fortran, Up: Calling FFTW from Legacy Fortran [Contents][Index]
Chris@42: