#include <xcomplex.h>
Public Member Functions | |
xcomplex () | |
xcomplex (const T &re_, const T &im_) | |
xcomplex (const T &re_) | |
xcomplex (const std::complex< T > &orig) | |
template<typename U> | |
xcomplex (const xcomplex< U > &orig) | |
operator std::complex< T > () const | |
T & | real () |
const T & | real () const |
T & | imag () |
const T & | imag () const |
void | Set (const T &re_, const T &im_) |
xcomplex & | operator= (const xcomplex &orig) |
xcomplex & | operator= (const std::complex< T > &orig) |
xcomplex & | operator= (const T &orig) |
xcomplex & | operator+= (const xcomplex &b) |
xcomplex & | operator-= (const xcomplex &b) |
xcomplex & | operator*= (const xcomplex &b) |
xcomplex & | operator/= (const xcomplex &b) |
xcomplex & | operator*= (const T &fact) |
xcomplex & | operator/= (const T &div) |
xcomplex | operator* (const T &fact) const |
xcomplex | operator* (const xcomplex &b) const |
xcomplex | operator/ (const xcomplex &b) const |
xcomplex | operator/ (const T &div) const |
xcomplex | operator+ (const xcomplex &b) const |
xcomplex | operator- (const xcomplex &b) const |
xcomplex | operator- () const |
void | Negate () |
void | Conjugate () |
void | Rotate (T angle) |
xcomplex | conj () const |
xcomplex | times_i () const |
T | norm () const |
Public Attributes | |
T | re |
T | im |
Related Functions | |
(Note that these are not member functions.) | |
template<typename T> | |
xcomplex< T > | conj (const xcomplex< T > &num) |
template<typename T> | |
T | norm (const xcomplex< T > &num) |
template<typename T> | |
T | abs (const xcomplex< T > &num) |
template<typename T> | |
xcomplex< T > | exp (const xcomplex< T > &num) |
template<typename T> | |
xcomplex< T > | operator* (const T &f1, const xcomplex< T > &f2) |
template<typename T> | |
xcomplex< T > | operator/ (const T &f1, const xcomplex< T > &f2) |
template<typename T> | |
std::ostream & | operator<< (std::ostream &os, const xcomplex< T > &val) |
This template is intended as an (under-encapsulated) replacement for the (over-encapsulated) std::complex<>. The goal is to include the whole functionality of std::complex<>, with some additional methods that allow higher performance.
The (known and intentional) differences between xcomplex<> and std::complex<> are:
Definition at line 56 of file xcomplex.h.
Default constructor. re and im are not initialised.
Definition at line 63 of file xcomplex.h.
Creates the complex number (re_, im_).
Definition at line 65 of file xcomplex.h.
Creates the complex number (re_, 0).
Definition at line 68 of file xcomplex.h.
Creates an xcomplex from a std::complex of identical precision.
Definition at line 71 of file xcomplex.h.
xcomplex< T >::xcomplex | ( | const xcomplex< U > & | orig | ) | [inline, explicit] |
Creates a complex number as a copy of orig.
Definition at line 74 of file xcomplex.h.
xcomplex< T >::operator std::complex< T > | ( | ) | const [inline] |
Conversion operator to std::complex<T>
Definition at line 78 of file xcomplex.h.
T& xcomplex< T >::real | ( | ) | [inline] |
Returns the real part as lvalue.
Definition at line 82 of file xcomplex.h.
const T& xcomplex< T >::real | ( | ) | const [inline] |
Returns the real part.
Definition at line 84 of file xcomplex.h.
T& xcomplex< T >::imag | ( | ) | [inline] |
Returns the imaginary part as lvalue.
Definition at line 86 of file xcomplex.h.
const T& xcomplex< T >::imag | ( | ) | const [inline] |
Returns the imaginary part.
Definition at line 88 of file xcomplex.h.
void xcomplex< T >::Set | ( | const T & | re_, | |
const T & | im_ | |||
) | [inline] |
Sets the number to (re_, im_).
Definition at line 91 of file xcomplex.h.
Sets the number to orig.
Definition at line 95 of file xcomplex.h.
Sets the number to orig.
Definition at line 98 of file xcomplex.h.
Sets the number to (orig, 0).
Definition at line 101 of file xcomplex.h.
Adds b to *this.
Definition at line 104 of file xcomplex.h.
Subtracts b from *this.
Definition at line 107 of file xcomplex.h.
Multiplies *this by b.
Definition at line 110 of file xcomplex.h.
Divides *this by b.
Definition at line 117 of file xcomplex.h.
Multiplies *this by fact.
Definition at line 125 of file xcomplex.h.
Divides *this by div.
Definition at line 128 of file xcomplex.h.
Returns *this * fact.
Definition at line 131 of file xcomplex.h.
Returns *this * b.
Definition at line 134 of file xcomplex.h.
Returns *this / b.
Definition at line 137 of file xcomplex.h.
Returns *this / div.
Definition at line 140 of file xcomplex.h.
Returns *this + b.
Definition at line 143 of file xcomplex.h.
Returns *this - b.
Definition at line 146 of file xcomplex.h.
Returns -(*this)
Definition at line 149 of file xcomplex.h.
void xcomplex< T >::Negate | ( | ) | [inline] |
Flips the signs of both components.
Definition at line 153 of file xcomplex.h.
void xcomplex< T >::Conjugate | ( | ) | [inline] |
Flips the signs of the imaginary component.
Definition at line 156 of file xcomplex.h.
void xcomplex< T >::Rotate | ( | T | angle | ) | [inline] |
Multiplies the number by exp(i*angle)
Definition at line 159 of file xcomplex.h.
Returns the complex conjugate of *this.
Definition at line 166 of file xcomplex.h.
Returns *this*i.
Definition at line 170 of file xcomplex.h.
T xcomplex< T >::norm | ( | ) | const [inline] |
Returns the norm of *this.
Definition at line 174 of file xcomplex.h.
real part
Definition at line 59 of file xcomplex.h.
imaginary part
Definition at line 59 of file xcomplex.h.