A Survey of Gaussian Convolution Algorithms
Data Structures | Macros | Typedefs | Functions
complex_arith.h File Reference

Complex arithmetic. More...

Detailed Description

Complex arithmetic.

Author
Pascal Getreuer getre.nosp@m.uer@.nosp@m.cmla..nosp@m.ens-.nosp@m.cacha.nosp@m.n.fr

This file is a light C89-compatible implementation of complex arithmetic. Functions are defined for addition, subtraction, multiplication, division, magnitude, argument (angle), power, sqrt, exp, and logarithm.

Copyright (c) 2013, Pascal Getreuer All rights reserved.

This program is free software: you can redistribute it and/or modify it under, at your option, the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version, or the terms of the simplified BSD license.

You should have received a copy of these licenses along with this program. If not, see http://www.gnu.org/licenses/ and http://www.opensource.org/licenses/bsd-license.html.

Definition in file complex_arith.h.

#include <math.h>

Go to the source code of this file.

Data Structures

struct  _complex_type
 Complex double data type. More...
 

Macros

#define complex   _complex_type
 Short alias for _complex_type.
 

Typedefs

typedef struct _complex_type _complex_type
 Complex double data type.
 

Functions

static complex make_complex (double a, double b)
 Make a complex number z = a + ib.
 
static complex c_conj (complex z)
 Complex conjugate z*.
 
static complex c_add (complex w, complex z)
 Complex addition.
 
static complex c_neg (complex z)
 Complex negation -z.
 
static complex c_sub (complex w, complex z)
 Complex subtraction.
 
static complex c_mul (complex w, complex z)
 Complex multiplication.
 
static complex c_inv (complex z)
 Complex multiplicative inverse 1/z.
 
static complex c_div (complex w, complex z)
 Complex division w/z.
 
static double c_mag (complex z)
 Complex magnitude.
 
static double c_arg (complex z)
 Complex argument (angle) in [-pi,+pi].
 
static complex c_pow (complex w, complex z)
 Complex power w^z.
 
static complex c_real_pow (complex w, double x)
 Complex power w^x with real exponent.
 
static complex c_sqrt (complex z)
 Complex square root (principal branch).
 
static complex c_exp (complex z)
 Complex exponential.
 
static complex c_log (complex z)
 Complex logarithm (principal branch).