Mercurial > hg > sv-dependency-builds
diff src/fftw-3.3.5/doc/html/Fortran_002dinterface-routines.html @ 127:7867fa7e1b6b
Current fftw source
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Tue, 18 Oct 2016 13:40:26 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/fftw-3.3.5/doc/html/Fortran_002dinterface-routines.html Tue Oct 18 13:40:26 2016 +0100 @@ -0,0 +1,174 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<!-- This manual is for FFTW +(version 3.3.5, 30 July 2016). + +Copyright (C) 2003 Matteo Frigo. + +Copyright (C) 2003 Massachusetts Institute of Technology. + +Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the +entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation +approved by the Free Software Foundation. --> +<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ --> +<head> +<title>FFTW 3.3.5: Fortran-interface routines</title> + +<meta name="description" content="FFTW 3.3.5: Fortran-interface routines"> +<meta name="keywords" content="FFTW 3.3.5: Fortran-interface routines"> +<meta name="resource-type" content="document"> +<meta name="distribution" content="global"> +<meta name="Generator" content="makeinfo"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<link href="index.html#Top" rel="start" title="Top"> +<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> +<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> +<link href="Calling-FFTW-from-Legacy-Fortran.html#Calling-FFTW-from-Legacy-Fortran" rel="up" title="Calling FFTW from Legacy Fortran"> +<link href="FFTW-Constants-in-Fortran.html#FFTW-Constants-in-Fortran" rel="next" title="FFTW Constants in Fortran"> +<link href="Calling-FFTW-from-Legacy-Fortran.html#Calling-FFTW-from-Legacy-Fortran" rel="prev" title="Calling FFTW from Legacy Fortran"> +<style type="text/css"> +<!-- +a.summary-letter {text-decoration: none} +blockquote.smallquotation {font-size: smaller} +div.display {margin-left: 3.2em} +div.example {margin-left: 3.2em} +div.indentedblock {margin-left: 3.2em} +div.lisp {margin-left: 3.2em} +div.smalldisplay {margin-left: 3.2em} +div.smallexample {margin-left: 3.2em} +div.smallindentedblock {margin-left: 3.2em; font-size: smaller} +div.smalllisp {margin-left: 3.2em} +kbd {font-style:oblique} +pre.display {font-family: inherit} +pre.format {font-family: inherit} +pre.menu-comment {font-family: serif} +pre.menu-preformatted {font-family: serif} +pre.smalldisplay {font-family: inherit; font-size: smaller} +pre.smallexample {font-size: smaller} +pre.smallformat {font-family: inherit; font-size: smaller} +pre.smalllisp {font-size: smaller} +span.nocodebreak {white-space:nowrap} +span.nolinebreak {white-space:nowrap} +span.roman {font-family:serif; font-weight:normal} +span.sansserif {font-family:sans-serif; font-weight:normal} +ul.no-bullet {list-style: none} +--> +</style> + + +</head> + +<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> +<a name="Fortran_002dinterface-routines"></a> +<div class="header"> +<p> +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> +</div> +<hr> +<a name="Fortran_002dinterface-routines-1"></a> +<h3 class="section">8.1 Fortran-interface routines</h3> + +<p>Nearly all of the FFTW functions have Fortran-callable equivalents. +The name of the legacy Fortran routine is the same as that of the +corresponding C routine, but with the ‘<samp>fftw_</samp>’ prefix replaced by +‘<samp>dfftw_</samp>’.<a name="DOCF9" href="#FOOT9"><sup>9</sup></a> The single and long-double precision +versions use ‘<samp>sfftw_</samp>’ and ‘<samp>lfftw_</samp>’, respectively, instead of +‘<samp>fftwf_</samp>’ and ‘<samp>fftwl_</samp>’; quadruple precision (<code>real*16</code>) +is available on some systems as ‘<samp>fftwq_</samp>’ (see <a href="Precision.html#Precision">Precision</a>). +(Note that <code>long double</code> on x86 hardware is usually at most +80-bit extended precision, <em>not</em> quadruple precision.) +</p> +<p>For the most part, all of the arguments to the functions are the same, +with the following exceptions: +</p> +<ul> +<li> <code>plan</code> variables (what would be of type <code>fftw_plan</code> in C), +must be declared as a type that is at least as big as a pointer +(address) on your machine. We recommend using <code>integer*8</code> everywhere, +since this should always be big enough. +<a name="index-portability-6"></a> + +</li><li> Any function that returns a value (e.g. <code>fftw_plan_dft</code>) is +converted into a <em>subroutine</em>. The return value is converted into +an additional <em>first</em> parameter of this subroutine.<a name="DOCF10" href="#FOOT10"><sup>10</sup></a> + +</li><li> <a name="index-column_002dmajor-2"></a> +The Fortran routines expect multi-dimensional arrays to be in +<em>column-major</em> order, which is the ordinary format of Fortran +arrays (see <a href="Multi_002ddimensional-Array-Format.html#Multi_002ddimensional-Array-Format">Multi-dimensional Array Format</a>). They do this +transparently and costlessly simply by reversing the order of the +dimensions passed to FFTW, but this has one important consequence for +multi-dimensional real-complex transforms, discussed below. + +</li><li> Wisdom import and export is somewhat more tricky because one cannot +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>. + +</li><li> Legacy Fortran cannot use the <code>fftw_malloc</code> dynamic-allocation routine. +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 +need to figure out some other way to ensure that your arrays are at +least 16-byte aligned. + +</li><li> <a name="index-fftw_005fiodim-2"></a> +<a name="index-guru-interface-4"></a> +Since Fortran 77 does not have data structures, the <code>fftw_iodim</code> +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 +<code>fftw_iodim</code> array arguments in the C guru interface become three +integer array arguments (<code>n</code>, <code>is</code>, and <code>os</code>) in the +Fortran guru interface, all of whose lengths should be equal to the +corresponding <code>rank</code> argument. + +</li><li> The guru planner interface in Fortran does <em>not</em> do any automatic +translation between column-major and row-major; you are responsible +for setting the strides etcetera to correspond to your Fortran arrays. +However, as a slight bug that we are preserving for backwards +compatibility, the ‘<samp>plan_guru_r2r</samp>’ in Fortran <em>does</em> reverse the +order of its <code>kind</code> array parameter, so the <code>kind</code> array +of that routine should be in the reverse of the order of the iodim +arrays (see above). + +</li></ul> + +<p>In general, you should take care to use Fortran data types that +correspond to (i.e. are the same size as) the C types used by FFTW. +In practice, this correspondence is usually straightforward +(i.e. <code>integer</code> corresponds to <code>int</code>, <code>real</code> +corresponds to <code>float</code>, etcetera). The native Fortran +double/single-precision complex type should be compatible with +<code>fftw_complex</code>/<code>fftwf_complex</code>. Such simple correspondences +are assumed in the examples below. +<a name="index-portability-7"></a> +</p> +<div class="footnote"> +<hr> +<h4 class="footnotes-heading">Footnotes</h4> + +<h3><a name="FOOT9" href="#DOCF9">(9)</a></h3> +<p>Technically, Fortran 77 identifiers are not +allowed to have more than 6 characters, nor may they contain +underscores. Any compiler that enforces this limitation doesn’t +deserve to link to FFTW.</p> +<h3><a name="FOOT10" href="#DOCF10">(10)</a></h3> +<p>The +reason for this is that some Fortran implementations seem to have +trouble with C function return values, and vice versa.</p> +</div> +<hr> +<div class="header"> +<p> +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> +</div> + + + +</body> +</html>