mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-18 10:35:11 +00:00
54e93db207
not reliable yet
114 lines
5.1 KiB
HTML
114 lines
5.1 KiB
HTML
<!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.10, 10 December 2020).
|
|
|
|
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 6.7, http://www.gnu.org/software/texinfo/ -->
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>Complex numbers (FFTW 3.3.10)</title>
|
|
|
|
<meta name="description" content="Complex numbers (FFTW 3.3.10)">
|
|
<meta name="keywords" content="Complex numbers (FFTW 3.3.10)">
|
|
<meta name="resource-type" content="document">
|
|
<meta name="distribution" content="global">
|
|
<meta name="Generator" content="makeinfo">
|
|
<link href="index.html" rel="start" title="Top">
|
|
<link href="Concept-Index.html" rel="index" title="Concept Index">
|
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
|
<link href="Data-Types-and-Files.html" rel="up" title="Data Types and Files">
|
|
<link href="Precision.html" rel="next" title="Precision">
|
|
<link href="Data-Types-and-Files.html" rel="prev" title="Data Types and Files">
|
|
<style type="text/css">
|
|
<!--
|
|
a.summary-letter {text-decoration: none}
|
|
blockquote.indentedblock {margin-right: 0em}
|
|
div.display {margin-left: 3.2em}
|
|
div.example {margin-left: 3.2em}
|
|
div.lisp {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}
|
|
span.nolinebreak {white-space: nowrap}
|
|
span.roman {font-family: initial; font-weight: normal}
|
|
span.sansserif {font-family: sans-serif; font-weight: normal}
|
|
ul.no-bullet {list-style: none}
|
|
-->
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
<body lang="en">
|
|
<span id="Complex-numbers"></span><div class="header">
|
|
<p>
|
|
Next: <a href="Precision.html" accesskey="n" rel="next">Precision</a>, Previous: <a href="Data-Types-and-Files.html" accesskey="p" rel="prev">Data Types and Files</a>, Up: <a href="Data-Types-and-Files.html" accesskey="u" rel="up">Data Types and Files</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
<hr>
|
|
<span id="Complex-numbers-1"></span><h4 class="subsection">4.1.1 Complex numbers</h4>
|
|
|
|
<p>The default FFTW interface uses <code>double</code> precision for all
|
|
floating-point numbers, and defines a <code>fftw_complex</code> type to hold
|
|
complex numbers as:
|
|
</p>
|
|
<div class="example">
|
|
<pre class="example">typedef double fftw_complex[2];
|
|
</pre></div>
|
|
<span id="index-fftw_005fcomplex-1"></span>
|
|
|
|
<p>Here, the <code>[0]</code> element holds the real part and the <code>[1]</code>
|
|
element holds the imaginary part.
|
|
</p>
|
|
<p>Alternatively, if you have a C compiler (such as <code>gcc</code>) that
|
|
supports the C99 revision of the ANSI C standard, you can use C’s new
|
|
native complex type (which is binary-compatible with the typedef above).
|
|
In particular, if you <code>#include <complex.h></code> <em>before</em>
|
|
<code><fftw3.h></code>, then <code>fftw_complex</code> is defined to be the native
|
|
complex type and you can manipulate it with ordinary arithmetic
|
|
(e.g. <code>x = y * (3+4*I)</code>, where <code>x</code> and <code>y</code> are
|
|
<code>fftw_complex</code> and <code>I</code> is the standard symbol for the
|
|
imaginary unit);
|
|
<span id="index-C99-1"></span>
|
|
</p>
|
|
|
|
<p>C++ has its own <code>complex<T></code> template class, defined in the
|
|
standard <code><complex></code> header file. Reportedly, the C++ standards
|
|
committee has recently agreed to mandate that the storage format used
|
|
for this type be binary-compatible with the C99 type, i.e. an array
|
|
<code>T[2]</code> with consecutive real <code>[0]</code> and imaginary <code>[1]</code>
|
|
parts. (See report
|
|
<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
|
|
writing, the proposal stated that: “This solution has been tested with
|
|
all current major implementations of the standard library and shown to
|
|
be working.” To the extent that this is true, if you have a variable
|
|
<code>complex<double> *x</code>, you can pass it directly to FFTW via
|
|
<code>reinterpret_cast<fftw_complex*>(x)</code>.
|
|
<span id="index-C_002b_002b-3"></span>
|
|
<span id="index-portability-2"></span>
|
|
</p>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|