/usr/share/doc/libfftw3-doc/html/FFTW-Fortran-type-reference.html is in libfftw3-doc 3.3.3-7ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | <!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.3, 25 November 2012).
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.3: FFTW Fortran type reference</title>
<meta name="description" content="FFTW 3.3.3: FFTW Fortran type reference">
<meta name="keywords" content="FFTW 3.3.3: FFTW Fortran type reference">
<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-Modern-Fortran.html#Calling-FFTW-from-Modern-Fortran" rel="up" title="Calling FFTW from Modern Fortran">
<link href="Plan-execution-in-Fortran.html#Plan-execution-in-Fortran" rel="next" title="Plan execution in Fortran">
<link href="Reversing-array-dimensions.html#Reversing-array-dimensions" rel="prev" title="Reversing array dimensions">
<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="FFTW-Fortran-type-reference"></a>
<div class="header">
<p>
Next: <a href="Plan-execution-in-Fortran.html#Plan-execution-in-Fortran" accesskey="n" rel="next">Plan execution in Fortran</a>, Previous: <a href="Reversing-array-dimensions.html#Reversing-array-dimensions" accesskey="p" rel="prev">Reversing array dimensions</a>, Up: <a href="Calling-FFTW-from-Modern-Fortran.html#Calling-FFTW-from-Modern-Fortran" accesskey="u" rel="up">Calling FFTW from Modern 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="FFTW-Fortran-type-reference-1"></a>
<h3 class="section">7.3 FFTW Fortran type reference</h3>
<p>The following are the most important type correspondences between the
C interface and Fortran:
</p>
<ul>
<li> <a name="index-fftw_005fplan-2"></a>
Plans (<code>fftw_plan</code> and variants) are <code>type(C_PTR)</code> (i.e. an
opaque pointer).
</li><li> <a name="index-fftw_005fcomplex-3"></a>
<a name="index-precision-8"></a>
<a name="index-C_005fDOUBLE-1"></a>
<a name="index-C_005fFLOAT"></a>
<a name="index-C_005fLONG_005fDOUBLE"></a>
<a name="index-C_005fDOUBLE_005fCOMPLEX-1"></a>
<a name="index-C_005fFLOAT_005fCOMPLEX"></a>
<a name="index-C_005fLONG_005fDOUBLE_005fCOMPLEX"></a>
The C floating-point types <code>double</code>, <code>float</code>, and <code>long
double</code> correspond to <code>real(C_DOUBLE)</code>, <code>real(C_FLOAT)</code>, and
<code>real(C_LONG_DOUBLE)</code>, respectively. The C complex types
<code>fftw_complex</code>, <code>fftwf_complex</code>, and <code>fftwl_complex</code>
correspond in Fortran to <code>complex(C_DOUBLE_COMPLEX)</code>,
<code>complex(C_FLOAT_COMPLEX)</code>, and
<code>complex(C_LONG_DOUBLE_COMPLEX)</code>, respectively.
Just as in C
(see <a href="Precision.html#Precision">Precision</a>), the FFTW subroutines and types are prefixed with
‘<samp>fftw_</samp>’, <code>fftwf_</code>, and <code>fftwl_</code> for the different precisions, and link to different libraries (<code>-lfftw3</code>, <code>-lfftw3f</code>, and <code>-lfftw3l</code> on Unix), but use the <em>same</em> include file <code>fftw3.f03</code> and the <em>same</em> constants (all of which begin with ‘<samp>FFTW_</samp>’). The exception is <code>long double</code> precision, for which you should <em>also</em> include <code>fftw3l.f03</code> (see <a href="Extended-and-quadruple-precision-in-Fortran.html#Extended-and-quadruple-precision-in-Fortran">Extended and quadruple precision in Fortran</a>).
</li><li> <a name="index-ptrdiff_005ft-2"></a>
<a name="index-C_005fINT-1"></a>
<a name="index-C_005fINTPTR_005fT"></a>
<a name="index-C_005fSIZE_005fT"></a>
<a name="index-fftw_005fmalloc-6"></a>
The C integer types <code>int</code> and <code>unsigned</code> (used for planner
flags) become <code>integer(C_INT)</code>. The C integer type <code>ptrdiff_t</code> (e.g. in the <a href="64_002dbit-Guru-Interface.html#g_t64_002dbit-Guru-Interface">64-bit Guru Interface</a>) becomes <code>integer(C_INTPTR_T)</code>, and <code>size_t</code> (in <code>fftw_malloc</code> etc.) becomes <code>integer(C_SIZE_T)</code>.
</li><li> <a name="index-fftw_005fr2r_005fkind-2"></a>
<a name="index-C_005fFFTW_005fR2R_005fKIND"></a>
The <code>fftw_r2r_kind</code> type (see <a href="Real_002dto_002dReal-Transform-Kinds.html#Real_002dto_002dReal-Transform-Kinds">Real-to-Real Transform Kinds</a>)
becomes <code>integer(C_FFTW_R2R_KIND)</code>. The various constant values
of the C enumerated type (<code>FFTW_R2HC</code> etc.) become simply integer
constants of the same names in Fortran.
</li><li> <a name="index-FFTW_005fDESTROY_005fINPUT-2"></a>
<a name="index-in_002dplace-10"></a>
<a name="index-fftw_005fflops-2"></a>
Numeric array pointer arguments (e.g. <code>double *</code>)
become <code>dimension(*), intent(out)</code> arrays of the same type, or
<code>dimension(*), intent(in)</code> if they are pointers to constant data
(e.g. <code>const int *</code>). There are a few exceptions where numeric
pointers refer to scalar outputs (e.g. for <code>fftw_flops</code>), in which
case they are <code>intent(out)</code> scalar arguments in Fortran too.
For the new-array execute functions (see <a href="New_002darray-Execute-Functions.html#New_002darray-Execute-Functions">New-array Execute Functions</a>),
the input arrays are declared <code>dimension(*), intent(inout)</code>, since
they can be modified in the case of in-place or <code>FFTW_DESTROY_INPUT</code>
transforms.
</li><li> <a name="index-fftw_005falloc_005freal-4"></a>
<a name="index-c_005ff_005fpointer-1"></a>
Pointer <em>return</em> values (e.g <code>double *</code>) become
<code>type(C_PTR)</code>. (If they are pointers to arrays, as for
<code>fftw_alloc_real</code>, you can convert them back to Fortran array
pointers with the standard intrinsic function <code>c_f_pointer</code>.)
</li><li> <a name="index-guru-interface-3"></a>
<a name="index-fftw_005fiodim-1"></a>
<a name="index-fftw_005fiodim64-1"></a>
<a name="index-64_002dbit-architecture-2"></a>
The <code>fftw_iodim</code> type in the guru interface (see <a href="Guru-vector-and-transform-sizes.html#Guru-vector-and-transform-sizes">Guru vector and transform sizes</a>) becomes <code>type(fftw_iodim)</code> in Fortran, a
derived data type (the Fortran analogue of C’s <code>struct</code>) with
three <code>integer(C_INT)</code> components: <code>n</code>, <code>is</code>, and
<code>os</code>, with the same meanings as in C. The <code>fftw_iodim64</code> type in the 64-bit guru interface (see <a href="64_002dbit-Guru-Interface.html#g_t64_002dbit-Guru-Interface">64-bit Guru Interface</a>) is the same, except that its components are of type <code>integer(C_INTPTR_T)</code>.
</li><li> <a name="index-C_005fFUNPTR"></a>
Using the wisdom import/export functions from Fortran is a bit tricky,
and is discussed in <a href="Accessing-the-wisdom-API-from-Fortran.html#Accessing-the-wisdom-API-from-Fortran">Accessing the wisdom API from Fortran</a>. In
brief, the <code>FILE *</code> arguments map to <code>type(C_PTR)</code>, <code>const char *</code> to <code>character(C_CHAR), dimension(*), intent(in)</code> (null-terminated!), and the generic read-char/write-char functions map to <code>type(C_FUNPTR)</code>.
</li></ul>
<a name="index-portability-5"></a>
<p>You may be wondering if you need to search-and-replace
<code>real(kind(0.0d0))</code> (or whatever your favorite Fortran spelling
of “double precision” is) with <code>real(C_DOUBLE)</code> everywhere in
your program, and similarly for <code>complex</code> and <code>integer</code>
types. The answer is no; you can still use your existing types. As
long as these types match their C counterparts, things should work
without a hitch. The worst that can happen, e.g. in the (unlikely)
event of a system where <code>real(kind(0.0d0))</code> is different from
<code>real(C_DOUBLE)</code>, is that the compiler will give you a
type-mismatch error. That is, if you don’t use the
<code>iso_c_binding</code> kinds you need to accept at least the theoretical
possibility of having to change your code in response to compiler
errors on some future machine, but you don’t need to worry about
silently compiling incorrect code that yields runtime errors.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Plan-execution-in-Fortran.html#Plan-execution-in-Fortran" accesskey="n" rel="next">Plan execution in Fortran</a>, Previous: <a href="Reversing-array-dimensions.html#Reversing-array-dimensions" accesskey="p" rel="prev">Reversing array dimensions</a>, Up: <a href="Calling-FFTW-from-Modern-Fortran.html#Calling-FFTW-from-Modern-Fortran" accesskey="u" rel="up">Calling FFTW from Modern 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>
|