Mercurial > hg > sv-dependency-builds
view src/fftw-3.3.3/doc/html/Complex-numbers.html @ 169:223a55898ab9 tip default
Add null config files
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Mon, 02 Mar 2020 14:03:47 +0000 |
parents | 89f5e221ed7b |
children |
line wrap: on
line source
<html lang="en"> <head> <title>Complex numbers - FFTW 3.3.3</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="FFTW 3.3.3"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Data-Types-and-Files.html#Data-Types-and-Files" title="Data Types and Files"> <link rel="prev" href="Data-Types-and-Files.html#Data-Types-and-Files" title="Data Types and Files"> <link rel="next" href="Precision.html#Precision" title="Precision"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- 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. --> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Complex-numbers"></a> <p> Next: <a rel="next" accesskey="n" href="Precision.html#Precision">Precision</a>, Previous: <a rel="previous" accesskey="p" href="Data-Types-and-Files.html#Data-Types-and-Files">Data Types and Files</a>, Up: <a rel="up" accesskey="u" href="Data-Types-and-Files.html#Data-Types-and-Files">Data Types and Files</a> <hr> </div> <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: <pre class="example"> typedef double fftw_complex[2]; </pre> <p><a name="index-fftw_005fcomplex-139"></a> Here, the <code>[0]</code> element holds the real part and the <code>[1]</code> element holds the imaginary part. <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); <a name="index-C99-140"></a> <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>. <a name="index-C_002b_002b-141"></a><a name="index-portability-142"></a> <!-- =========> --> </body></html>