annotate src/fftw-3.3.3/doc/html/Complex-numbers.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 37bf6b4a2645
children
rev   line source
Chris@10 1 <html lang="en">
Chris@10 2 <head>
Chris@10 3 <title>Complex numbers - FFTW 3.3.3</title>
Chris@10 4 <meta http-equiv="Content-Type" content="text/html">
Chris@10 5 <meta name="description" content="FFTW 3.3.3">
Chris@10 6 <meta name="generator" content="makeinfo 4.13">
Chris@10 7 <link title="Top" rel="start" href="index.html#Top">
Chris@10 8 <link rel="up" href="Data-Types-and-Files.html#Data-Types-and-Files" title="Data Types and Files">
Chris@10 9 <link rel="prev" href="Data-Types-and-Files.html#Data-Types-and-Files" title="Data Types and Files">
Chris@10 10 <link rel="next" href="Precision.html#Precision" title="Precision">
Chris@10 11 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
Chris@10 12 <!--
Chris@10 13 This manual is for FFTW
Chris@10 14 (version 3.3.3, 25 November 2012).
Chris@10 15
Chris@10 16 Copyright (C) 2003 Matteo Frigo.
Chris@10 17
Chris@10 18 Copyright (C) 2003 Massachusetts Institute of Technology.
Chris@10 19
Chris@10 20 Permission is granted to make and distribute verbatim copies of
Chris@10 21 this manual provided the copyright notice and this permission
Chris@10 22 notice are preserved on all copies.
Chris@10 23
Chris@10 24 Permission is granted to copy and distribute modified versions of
Chris@10 25 this manual under the conditions for verbatim copying, provided
Chris@10 26 that the entire resulting derived work is distributed under the
Chris@10 27 terms of a permission notice identical to this one.
Chris@10 28
Chris@10 29 Permission is granted to copy and distribute translations of this
Chris@10 30 manual into another language, under the above conditions for
Chris@10 31 modified versions, except that this permission notice may be
Chris@10 32 stated in a translation approved by the Free Software Foundation.
Chris@10 33 -->
Chris@10 34 <meta http-equiv="Content-Style-Type" content="text/css">
Chris@10 35 <style type="text/css"><!--
Chris@10 36 pre.display { font-family:inherit }
Chris@10 37 pre.format { font-family:inherit }
Chris@10 38 pre.smalldisplay { font-family:inherit; font-size:smaller }
Chris@10 39 pre.smallformat { font-family:inherit; font-size:smaller }
Chris@10 40 pre.smallexample { font-size:smaller }
Chris@10 41 pre.smalllisp { font-size:smaller }
Chris@10 42 span.sc { font-variant:small-caps }
Chris@10 43 span.roman { font-family:serif; font-weight:normal; }
Chris@10 44 span.sansserif { font-family:sans-serif; font-weight:normal; }
Chris@10 45 --></style>
Chris@10 46 </head>
Chris@10 47 <body>
Chris@10 48 <div class="node">
Chris@10 49 <a name="Complex-numbers"></a>
Chris@10 50 <p>
Chris@10 51 Next:&nbsp;<a rel="next" accesskey="n" href="Precision.html#Precision">Precision</a>,
Chris@10 52 Previous:&nbsp;<a rel="previous" accesskey="p" href="Data-Types-and-Files.html#Data-Types-and-Files">Data Types and Files</a>,
Chris@10 53 Up:&nbsp;<a rel="up" accesskey="u" href="Data-Types-and-Files.html#Data-Types-and-Files">Data Types and Files</a>
Chris@10 54 <hr>
Chris@10 55 </div>
Chris@10 56
Chris@10 57 <h4 class="subsection">4.1.1 Complex numbers</h4>
Chris@10 58
Chris@10 59 <p>The default FFTW interface uses <code>double</code> precision for all
Chris@10 60 floating-point numbers, and defines a <code>fftw_complex</code> type to hold
Chris@10 61 complex numbers as:
Chris@10 62
Chris@10 63 <pre class="example"> typedef double fftw_complex[2];
Chris@10 64 </pre>
Chris@10 65 <p><a name="index-fftw_005fcomplex-139"></a>
Chris@10 66 Here, the <code>[0]</code> element holds the real part and the <code>[1]</code>
Chris@10 67 element holds the imaginary part.
Chris@10 68
Chris@10 69 <p>Alternatively, if you have a C compiler (such as <code>gcc</code>) that
Chris@10 70 supports the C99 revision of the ANSI C standard, you can use C's new
Chris@10 71 native complex type (which is binary-compatible with the typedef above).
Chris@10 72 In particular, if you <code>#include &lt;complex.h&gt;</code> <em>before</em>
Chris@10 73 <code>&lt;fftw3.h&gt;</code>, then <code>fftw_complex</code> is defined to be the native
Chris@10 74 complex type and you can manipulate it with ordinary arithmetic
Chris@10 75 (e.g. <code>x = y * (3+4*I)</code>, where <code>x</code> and <code>y</code> are
Chris@10 76 <code>fftw_complex</code> and <code>I</code> is the standard symbol for the
Chris@10 77 imaginary unit);
Chris@10 78 <a name="index-C99-140"></a>
Chris@10 79
Chris@10 80 <p>C++ has its own <code>complex&lt;T&gt;</code> template class, defined in the
Chris@10 81 standard <code>&lt;complex&gt;</code> header file. Reportedly, the C++ standards
Chris@10 82 committee has recently agreed to mandate that the storage format used
Chris@10 83 for this type be binary-compatible with the C99 type, i.e. an array
Chris@10 84 <code>T[2]</code> with consecutive real <code>[0]</code> and imaginary <code>[1]</code>
Chris@10 85 parts. (See report
Chris@10 86 <a href="http://www.open-std.org/jtc1/sc22/WG21/docs/papers/2002/n1388.pdf WG21/N1388">http://www.open-std.org/jtc1/sc22/WG21/docs/papers/2002/n1388.pdf WG21/N1388</a>.) Although not part of the official standard as of this
Chris@10 87 writing, the proposal stated that: &ldquo;This solution has been tested with
Chris@10 88 all current major implementations of the standard library and shown to
Chris@10 89 be working.&rdquo; To the extent that this is true, if you have a variable
Chris@10 90 <code>complex&lt;double&gt; *x</code>, you can pass it directly to FFTW via
Chris@10 91 <code>reinterpret_cast&lt;fftw_complex*&gt;(x)</code>.
Chris@10 92 <a name="index-C_002b_002b-141"></a><a name="index-portability-142"></a>
Chris@10 93 <!-- =========> -->
Chris@10 94
Chris@10 95 </body></html>
Chris@10 96