Mercurial > hg > sv-dependency-builds
comparison src/fftw-3.3.5/doc/html/Fortran_002dinterface-routines.html @ 42:2cd0e3b3e1fd
Current fftw source
author | Chris Cannam |
---|---|
date | Tue, 18 Oct 2016 13:40:26 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
41:481f5f8c5634 | 42:2cd0e3b3e1fd |
---|---|
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.5, 30 July 2016). | |
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 5.2, http://www.gnu.org/software/texinfo/ --> | |
24 <head> | |
25 <title>FFTW 3.3.5: Fortran-interface routines</title> | |
26 | |
27 <meta name="description" content="FFTW 3.3.5: Fortran-interface routines"> | |
28 <meta name="keywords" content="FFTW 3.3.5: 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.smallquotation {font-size: smaller} | |
43 div.display {margin-left: 3.2em} | |
44 div.example {margin-left: 3.2em} | |
45 div.indentedblock {margin-left: 3.2em} | |
46 div.lisp {margin-left: 3.2em} | |
47 div.smalldisplay {margin-left: 3.2em} | |
48 div.smallexample {margin-left: 3.2em} | |
49 div.smallindentedblock {margin-left: 3.2em; font-size: smaller} | |
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.nocodebreak {white-space:nowrap} | |
61 span.nolinebreak {white-space:nowrap} | |
62 span.roman {font-family:serif; font-weight:normal} | |
63 span.sansserif {font-family:sans-serif; font-weight:normal} | |
64 ul.no-bullet {list-style: none} | |
65 --> | |
66 </style> | |
67 | |
68 | |
69 </head> | |
70 | |
71 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> | |
72 <a name="Fortran_002dinterface-routines"></a> | |
73 <div class="header"> | |
74 <p> | |
75 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> [<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> | |
76 </div> | |
77 <hr> | |
78 <a name="Fortran_002dinterface-routines-1"></a> | |
79 <h3 class="section">8.1 Fortran-interface routines</h3> | |
80 | |
81 <p>Nearly all of the FFTW functions have Fortran-callable equivalents. | |
82 The name of the legacy Fortran routine is the same as that of the | |
83 corresponding C routine, but with the ‘<samp>fftw_</samp>’ prefix replaced by | |
84 ‘<samp>dfftw_</samp>’.<a name="DOCF9" href="#FOOT9"><sup>9</sup></a> The single and long-double precision | |
85 versions use ‘<samp>sfftw_</samp>’ and ‘<samp>lfftw_</samp>’, respectively, instead of | |
86 ‘<samp>fftwf_</samp>’ and ‘<samp>fftwl_</samp>’; quadruple precision (<code>real*16</code>) | |
87 is available on some systems as ‘<samp>fftwq_</samp>’ (see <a href="Precision.html#Precision">Precision</a>). | |
88 (Note that <code>long double</code> on x86 hardware is usually at most | |
89 80-bit extended precision, <em>not</em> quadruple precision.) | |
90 </p> | |
91 <p>For the most part, all of the arguments to the functions are the same, | |
92 with the following exceptions: | |
93 </p> | |
94 <ul> | |
95 <li> <code>plan</code> variables (what would be of type <code>fftw_plan</code> in C), | |
96 must be declared as a type that is at least as big as a pointer | |
97 (address) on your machine. We recommend using <code>integer*8</code> everywhere, | |
98 since this should always be big enough. | |
99 <a name="index-portability-6"></a> | |
100 | |
101 </li><li> Any function that returns a value (e.g. <code>fftw_plan_dft</code>) is | |
102 converted into a <em>subroutine</em>. The return value is converted into | |
103 an additional <em>first</em> parameter of this subroutine.<a name="DOCF10" href="#FOOT10"><sup>10</sup></a> | |
104 | |
105 </li><li> <a name="index-column_002dmajor-2"></a> | |
106 The Fortran routines expect multi-dimensional arrays to be in | |
107 <em>column-major</em> order, which is the ordinary format of Fortran | |
108 arrays (see <a href="Multi_002ddimensional-Array-Format.html#Multi_002ddimensional-Array-Format">Multi-dimensional Array Format</a>). They do this | |
109 transparently and costlessly simply by reversing the order of the | |
110 dimensions passed to FFTW, but this has one important consequence for | |
111 multi-dimensional real-complex transforms, discussed below. | |
112 | |
113 </li><li> Wisdom import and export is somewhat more tricky because one cannot | |
114 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>. | |
115 | |
116 </li><li> Legacy Fortran cannot use the <code>fftw_malloc</code> dynamic-allocation routine. | |
117 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’ll | |
118 need to figure out some other way to ensure that your arrays are at | |
119 least 16-byte aligned. | |
120 | |
121 </li><li> <a name="index-fftw_005fiodim-2"></a> | |
122 <a name="index-guru-interface-4"></a> | |
123 Since Fortran 77 does not have data structures, the <code>fftw_iodim</code> | |
124 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 | |
125 <code>fftw_iodim</code> array arguments in the C guru interface become three | |
126 integer array arguments (<code>n</code>, <code>is</code>, and <code>os</code>) in the | |
127 Fortran guru interface, all of whose lengths should be equal to the | |
128 corresponding <code>rank</code> argument. | |
129 | |
130 </li><li> The guru planner interface in Fortran does <em>not</em> do any automatic | |
131 translation between column-major and row-major; you are responsible | |
132 for setting the strides etcetera to correspond to your Fortran arrays. | |
133 However, as a slight bug that we are preserving for backwards | |
134 compatibility, the ‘<samp>plan_guru_r2r</samp>’ in Fortran <em>does</em> reverse the | |
135 order of its <code>kind</code> array parameter, so the <code>kind</code> array | |
136 of that routine should be in the reverse of the order of the iodim | |
137 arrays (see above). | |
138 | |
139 </li></ul> | |
140 | |
141 <p>In general, you should take care to use Fortran data types that | |
142 correspond to (i.e. are the same size as) the C types used by FFTW. | |
143 In practice, this correspondence is usually straightforward | |
144 (i.e. <code>integer</code> corresponds to <code>int</code>, <code>real</code> | |
145 corresponds to <code>float</code>, etcetera). The native Fortran | |
146 double/single-precision complex type should be compatible with | |
147 <code>fftw_complex</code>/<code>fftwf_complex</code>. Such simple correspondences | |
148 are assumed in the examples below. | |
149 <a name="index-portability-7"></a> | |
150 </p> | |
151 <div class="footnote"> | |
152 <hr> | |
153 <h4 class="footnotes-heading">Footnotes</h4> | |
154 | |
155 <h3><a name="FOOT9" href="#DOCF9">(9)</a></h3> | |
156 <p>Technically, Fortran 77 identifiers are not | |
157 allowed to have more than 6 characters, nor may they contain | |
158 underscores. Any compiler that enforces this limitation doesn’t | |
159 deserve to link to FFTW.</p> | |
160 <h3><a name="FOOT10" href="#DOCF10">(10)</a></h3> | |
161 <p>The | |
162 reason for this is that some Fortran implementations seem to have | |
163 trouble with C function return values, and vice versa.</p> | |
164 </div> | |
165 <hr> | |
166 <div class="header"> | |
167 <p> | |
168 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> [<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> | |
169 </div> | |
170 | |
171 | |
172 | |
173 </body> | |
174 </html> |