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