annotate src/fftw-3.3.8/doc/html/Fortran_002dinterface-routines.html @ 167:bd3cc4d1df30

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