comparison src/fftw-3.3.8/doc/html/Fortran_002dinterface-routines.html @ 82:d0c2a83c1364

Add FFTW 3.3.8 source, and a Linux build
author Chris Cannam
date Tue, 19 Nov 2019 14:52:55 +0000
parents
children
comparison
equal deleted inserted replaced
81:7029a4916348 82:d0c2a83c1364
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <!-- This manual is for FFTW
4 (version 3.3.8, 24 May 2018).
5
6 Copyright (C) 2003 Matteo Frigo.
7
8 Copyright (C) 2003 Massachusetts Institute of Technology.
9
10 Permission is granted to make and distribute verbatim copies of this
11 manual provided the copyright notice and this permission notice are
12 preserved on all copies.
13
14 Permission is granted to copy and distribute modified versions of this
15 manual under the conditions for verbatim copying, provided that the
16 entire resulting derived work is distributed under the terms of a
17 permission notice identical to this one.
18
19 Permission is granted to copy and distribute translations of this manual
20 into another language, under the above conditions for modified versions,
21 except that this permission notice may be stated in a translation
22 approved by the Free Software Foundation. -->
23 <!-- Created by GNU Texinfo 6.3, http://www.gnu.org/software/texinfo/ -->
24 <head>
25 <title>FFTW 3.3.8: Fortran-interface routines</title>
26
27 <meta name="description" content="FFTW 3.3.8: Fortran-interface routines">
28 <meta name="keywords" content="FFTW 3.3.8: Fortran-interface routines">
29 <meta name="resource-type" content="document">
30 <meta name="distribution" content="global">
31 <meta name="Generator" content="makeinfo">
32 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
33 <link href="index.html#Top" rel="start" title="Top">
34 <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
35 <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
36 <link href="Calling-FFTW-from-Legacy-Fortran.html#Calling-FFTW-from-Legacy-Fortran" rel="up" title="Calling FFTW from Legacy Fortran">
37 <link href="FFTW-Constants-in-Fortran.html#FFTW-Constants-in-Fortran" rel="next" title="FFTW Constants in Fortran">
38 <link href="Calling-FFTW-from-Legacy-Fortran.html#Calling-FFTW-from-Legacy-Fortran" rel="prev" title="Calling FFTW from Legacy Fortran">
39 <style type="text/css">
40 <!--
41 a.summary-letter {text-decoration: none}
42 blockquote.indentedblock {margin-right: 0em}
43 blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
44 blockquote.smallquotation {font-size: smaller}
45 div.display {margin-left: 3.2em}
46 div.example {margin-left: 3.2em}
47 div.lisp {margin-left: 3.2em}
48 div.smalldisplay {margin-left: 3.2em}
49 div.smallexample {margin-left: 3.2em}
50 div.smalllisp {margin-left: 3.2em}
51 kbd {font-style: oblique}
52 pre.display {font-family: inherit}
53 pre.format {font-family: inherit}
54 pre.menu-comment {font-family: serif}
55 pre.menu-preformatted {font-family: serif}
56 pre.smalldisplay {font-family: inherit; font-size: smaller}
57 pre.smallexample {font-size: smaller}
58 pre.smallformat {font-family: inherit; font-size: smaller}
59 pre.smalllisp {font-size: smaller}
60 span.nolinebreak {white-space: nowrap}
61 span.roman {font-family: initial; font-weight: normal}
62 span.sansserif {font-family: sans-serif; font-weight: normal}
63 ul.no-bullet {list-style: none}
64 -->
65 </style>
66
67
68 </head>
69
70 <body lang="en">
71 <a name="Fortran_002dinterface-routines"></a>
72 <div class="header">
73 <p>
74 Next: <a href="FFTW-Constants-in-Fortran.html#FFTW-Constants-in-Fortran" accesskey="n" rel="next">FFTW Constants in Fortran</a>, Previous: <a href="Calling-FFTW-from-Legacy-Fortran.html#Calling-FFTW-from-Legacy-Fortran" accesskey="p" rel="prev">Calling FFTW from Legacy Fortran</a>, Up: <a href="Calling-FFTW-from-Legacy-Fortran.html#Calling-FFTW-from-Legacy-Fortran" accesskey="u" rel="up">Calling FFTW from Legacy Fortran</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
75 </div>
76 <hr>
77 <a name="Fortran_002dinterface-routines-1"></a>
78 <h3 class="section">8.1 Fortran-interface routines</h3>
79
80 <p>Nearly all of the FFTW functions have Fortran-callable equivalents.
81 The name of the legacy Fortran routine is the same as that of the
82 corresponding C routine, but with the &lsquo;<samp>fftw_</samp>&rsquo; prefix replaced by
83 &lsquo;<samp>dfftw_</samp>&rsquo;.<a name="DOCF9" href="#FOOT9"><sup>9</sup></a> The single and long-double precision
84 versions use &lsquo;<samp>sfftw_</samp>&rsquo; and &lsquo;<samp>lfftw_</samp>&rsquo;, respectively, instead of
85 &lsquo;<samp>fftwf_</samp>&rsquo; and &lsquo;<samp>fftwl_</samp>&rsquo;; quadruple precision (<code>real*16</code>)
86 is available on some systems as &lsquo;<samp>fftwq_</samp>&rsquo; (see <a href="Precision.html#Precision">Precision</a>).
87 (Note that <code>long double</code> on x86 hardware is usually at most
88 80-bit extended precision, <em>not</em> quadruple precision.)
89 </p>
90 <p>For the most part, all of the arguments to the functions are the same,
91 with the following exceptions:
92 </p>
93 <ul>
94 <li> <code>plan</code> variables (what would be of type <code>fftw_plan</code> in C),
95 must be declared as a type that is at least as big as a pointer
96 (address) on your machine. We recommend using <code>integer*8</code> everywhere,
97 since this should always be big enough.
98 <a name="index-portability-6"></a>
99
100 </li><li> Any function that returns a value (e.g. <code>fftw_plan_dft</code>) is
101 converted into a <em>subroutine</em>. The return value is converted into
102 an additional <em>first</em> parameter of this subroutine.<a name="DOCF10" href="#FOOT10"><sup>10</sup></a>
103
104 </li><li> <a name="index-column_002dmajor-2"></a>
105 The Fortran routines expect multi-dimensional arrays to be in
106 <em>column-major</em> order, which is the ordinary format of Fortran
107 arrays (see <a href="Multi_002ddimensional-Array-Format.html#Multi_002ddimensional-Array-Format">Multi-dimensional Array Format</a>). They do this
108 transparently and costlessly simply by reversing the order of the
109 dimensions passed to FFTW, but this has one important consequence for
110 multi-dimensional real-complex transforms, discussed below.
111
112 </li><li> Wisdom import and export is somewhat more tricky because one cannot
113 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>.
114
115 </li><li> Legacy Fortran cannot use the <code>fftw_malloc</code> dynamic-allocation routine.
116 If you want to exploit the SIMD FFTW (see <a href="SIMD-alignment-and-fftw_005fmalloc.html#SIMD-alignment-and-fftw_005fmalloc">SIMD alignment and fftw_malloc</a>), you&rsquo;ll
117 need to figure out some other way to ensure that your arrays are at
118 least 16-byte aligned.
119
120 </li><li> <a name="index-fftw_005fiodim-2"></a>
121 <a name="index-guru-interface-4"></a>
122 Since Fortran 77 does not have data structures, the <code>fftw_iodim</code>
123 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
124 <code>fftw_iodim</code> array arguments in the C guru interface become three
125 integer array arguments (<code>n</code>, <code>is</code>, and <code>os</code>) in the
126 Fortran guru interface, all of whose lengths should be equal to the
127 corresponding <code>rank</code> argument.
128
129 </li><li> The guru planner interface in Fortran does <em>not</em> do any automatic
130 translation between column-major and row-major; you are responsible
131 for setting the strides etcetera to correspond to your Fortran arrays.
132 However, as a slight bug that we are preserving for backwards
133 compatibility, the &lsquo;<samp>plan_guru_r2r</samp>&rsquo; in Fortran <em>does</em> reverse the
134 order of its <code>kind</code> array parameter, so the <code>kind</code> array
135 of that routine should be in the reverse of the order of the iodim
136 arrays (see above).
137
138 </li></ul>
139
140 <p>In general, you should take care to use Fortran data types that
141 correspond to (i.e. are the same size as) the C types used by FFTW.
142 In practice, this correspondence is usually straightforward
143 (i.e. <code>integer</code> corresponds to <code>int</code>, <code>real</code>
144 corresponds to <code>float</code>, etcetera). The native Fortran
145 double/single-precision complex type should be compatible with
146 <code>fftw_complex</code>/<code>fftwf_complex</code>. Such simple correspondences
147 are assumed in the examples below.
148 <a name="index-portability-7"></a>
149 </p>
150 <div class="footnote">
151 <hr>
152 <h4 class="footnotes-heading">Footnotes</h4>
153
154 <h3><a name="FOOT9" href="#DOCF9">(9)</a></h3>
155 <p>Technically, Fortran 77 identifiers are not
156 allowed to have more than 6 characters, nor may they contain
157 underscores. Any compiler that enforces this limitation doesn&rsquo;t
158 deserve to link to FFTW.</p>
159 <h3><a name="FOOT10" href="#DOCF10">(10)</a></h3>
160 <p>The
161 reason for this is that some Fortran implementations seem to have
162 trouble with C function return values, and vice versa.</p>
163 </div>
164 <hr>
165 <div class="header">
166 <p>
167 Next: <a href="FFTW-Constants-in-Fortran.html#FFTW-Constants-in-Fortran" accesskey="n" rel="next">FFTW Constants in Fortran</a>, Previous: <a href="Calling-FFTW-from-Legacy-Fortran.html#Calling-FFTW-from-Legacy-Fortran" accesskey="p" rel="prev">Calling FFTW from Legacy Fortran</a>, Up: <a href="Calling-FFTW-from-Legacy-Fortran.html#Calling-FFTW-from-Legacy-Fortran" accesskey="u" rel="up">Calling FFTW from Legacy Fortran</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
168 </div>
169
170
171
172 </body>
173 </html>