annotate src/fftw-3.3.8/doc/html/Fortran_002dinterface-routines.html @ 83:ae30d91d2ffe

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