comparison Lib/fftw-3.2.1/doc/html/.svn/text-base/Fortran_002dinterface-routines.html.svn-base @ 15:585caf503ef5 tip

Tidy up for ROLI
author Geogaddi\David <d.m.ronan@qmul.ac.uk>
date Tue, 17 May 2016 18:50:19 +0100
parents 636c989477e7
children
comparison
equal deleted inserted replaced
14:636c989477e7 15:585caf503ef5
1 <html lang="en">
2 <head>
3 <title>Fortran-interface routines - FFTW 3.2.1</title>
4 <meta http-equiv="Content-Type" content="text/html">
5 <meta name="description" content="FFTW 3.2.1">
6 <meta name="generator" content="makeinfo 4.8">
7 <link title="Top" rel="start" href="index.html#Top">
8 <link rel="up" href="Calling-FFTW-from-Fortran.html#Calling-FFTW-from-Fortran" title="Calling FFTW from Fortran">
9 <link rel="prev" href="Calling-FFTW-from-Fortran.html#Calling-FFTW-from-Fortran" title="Calling FFTW from Fortran">
10 <link rel="next" href="FFTW-Constants-in-Fortran.html#FFTW-Constants-in-Fortran" title="FFTW Constants in Fortran">
11 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12 <!--
13 This manual is for FFTW
14 (version 3.2.1, 5 February 2009).
15
16 Copyright (C) 2003 Matteo Frigo.
17
18 Copyright (C) 2003 Massachusetts Institute of Technology.
19
20 Permission is granted to make and distribute verbatim copies of
21 this manual provided the copyright notice and this permission
22 notice are preserved on all copies.
23
24 Permission is granted to copy and distribute modified versions of
25 this manual under the conditions for verbatim copying, provided
26 that the entire resulting derived work is distributed under the
27 terms of a permission notice identical to this one.
28
29 Permission is granted to copy and distribute translations of this
30 manual into another language, under the above conditions for
31 modified versions, except that this permission notice may be
32 stated in a translation approved by the Free Software Foundation.
33 -->
34 <meta http-equiv="Content-Style-Type" content="text/css">
35 <style type="text/css"><!--
36 pre.display { font-family:inherit }
37 pre.format { font-family:inherit }
38 pre.smalldisplay { font-family:inherit; font-size:smaller }
39 pre.smallformat { font-family:inherit; font-size:smaller }
40 pre.smallexample { font-size:smaller }
41 pre.smalllisp { font-size:smaller }
42 span.sc { font-variant:small-caps }
43 span.roman { font-family:serif; font-weight:normal; }
44 span.sansserif { font-family:sans-serif; font-weight:normal; }
45 --></style>
46 </head>
47 <body>
48 <div class="node">
49 <p>
50 <a name="Fortran-interface-routines"></a>
51 <a name="Fortran_002dinterface-routines"></a>
52 Next:&nbsp;<a rel="next" accesskey="n" href="FFTW-Constants-in-Fortran.html#FFTW-Constants-in-Fortran">FFTW Constants in Fortran</a>,
53 Previous:&nbsp;<a rel="previous" accesskey="p" href="Calling-FFTW-from-Fortran.html#Calling-FFTW-from-Fortran">Calling FFTW from Fortran</a>,
54 Up:&nbsp;<a rel="up" accesskey="u" href="Calling-FFTW-from-Fortran.html#Calling-FFTW-from-Fortran">Calling FFTW from Fortran</a>
55 <hr>
56 </div>
57
58 <h3 class="section">7.1 Fortran-interface routines</h3>
59
60 <p>Nearly all of the FFTW functions have Fortran-callable equivalents. The
61 name of the Fortran routine is the same as that of the corresponding C
62 routine, but with the `<samp><span class="samp">fftw_</span></samp>' prefix replaced by `<samp><span class="samp">dfftw_</span></samp>'.
63 (The single and long-double precision versions use `<samp><span class="samp">sfftw_</span></samp>' and
64 `<samp><span class="samp">lfftw_</span></samp>', respectively, instead of `<samp><span class="samp">fftwf_</span></samp>' and
65 `<samp><span class="samp">fftwl_</span></samp>'.)<a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a>
66
67 <p>For the most part, all of the arguments to the functions are the same,
68 with the following exceptions:
69
70 <ul>
71 <li><code>plan</code> variables (what would be of type <code>fftw_plan</code> in C),
72 must be declared as a type that is at least as big as a pointer
73 (address) on your machine. We recommend using <code>integer*8</code>.
74 <a name="index-portability-332"></a>
75 <li>Any function that returns a value (e.g. <code>fftw_plan_dft</code>) is
76 converted into a <em>subroutine</em>. The return value is converted into
77 an additional <em>first</em> parameter of this subroutine.<a rel="footnote" href="#fn-2" name="fnd-2"><sup>2</sup></a>
78
79 <li><a name="index-column_002dmajor-333"></a>The Fortran routines expect multi-dimensional arrays to be in
80 <em>column-major</em> order, which is the ordinary format of Fortran
81 arrays (see <a href="Multi_002ddimensional-Array-Format.html#Multi_002ddimensional-Array-Format">Multi-dimensional Array Format</a>). They do this
82 transparently and costlessly simply by reversing the order of the
83 dimensions passed to FFTW, but this has one important consequence for
84 multi-dimensional real-complex transforms, discussed below.
85
86 <li>Wisdom import and export is somewhat more tricky because one cannot
87 easily pass files or strings between C and Fortran; see <a href="Wisdom-of-Fortran_003f.html#Wisdom-of-Fortran_003f">Wisdom of Fortran?</a>.
88
89 <li>Fortran cannot use the <code>fftw_malloc</code> dynamic-allocation routine.
90 If you want to exploit the SIMD FFTW (see <a href="Data-Alignment.html#Data-Alignment">Data Alignment</a>), you'll
91 need to figure out some other way to ensure that your arrays are at
92 least 16-byte aligned.
93
94 <li><a name="index-fftw_005fiodim-334"></a><a name="index-guru-interface-335"></a>Since Fortran 77 does not have data structures, the <code>fftw_iodim</code>
95 structure from the guru interface (see <a href="Guru-vector-and-transform-sizes.html#Guru-vector-and-transform-sizes">Guru vector and transform sizes</a>) must be split into separate arguments. In particular, any
96 <code>fftw_iodim</code> array arguments in the C guru interface become three
97 integer array arguments (<code>n</code>, <code>is</code>, and <code>os</code>) in the
98 Fortran guru interface, all of whose lengths should be equal to the
99 corresponding <code>rank</code> argument.
100
101 <li>The guru planner interface in Fortran does <em>not</em> do any automatic
102 translation between column-major and row-major; you are responsible
103 for setting the strides etcetera to correspond to your Fortran arrays.
104 However, as a slight bug that we are preserving for backwards
105 compatibility, the `<samp><span class="samp">plan_guru_r2r</span></samp>' in Fortran <em>does</em> reverse the
106 order of its <code>kind</code> array parameter, so the <code>kind</code> array
107 of that routine should be in the reverse of the order of the iodim
108 arrays (see above).
109
110 </ul>
111
112 <p>In general, you should take care to use Fortran data types that
113 correspond to (i.e. are the same size as) the C types used by FFTW. If
114 your C and Fortran compilers are made by the same vendor, the
115 correspondence is usually straightforward (i.e. <code>integer</code>
116 corresponds to <code>int</code>, <code>real</code> corresponds to <code>float</code>,
117 etcetera). The native Fortran double/single-precision complex type
118 should be compatible with <code>fftw_complex</code>/<code>fftwf_complex</code>.
119 Such simple correspondences are assumed in the examples below.
120 <a name="index-portability-336"></a>
121 <!-- -->
122
123 <div class="footnote">
124 <hr>
125 <h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> Technically, Fortran 77 identifiers are
126 not allowed to have more than 6 characters, nor may they contain
127 underscores. Any compiler that enforces this limitation doesn't deserve
128 to link to FFTW.</p>
129
130 <p class="footnote"><small>[<a name="fn-2" href="#fnd-2">2</a>]</small> The
131 reason for this is that some Fortran implementations seem to have
132 trouble with C function return values, and vice versa.</p>
133
134 <p><hr></div>
135
136 </body></html>
137