![]() |
![]() |
![]() |
|||||||||||||||||
![]() |
![]() |
![]() |
|||||||||||||||||
![]() |
|
![]() |
|||||||||||||||||
![]() |
![]() |
![]() |
![]() |
xcomplex< T > Class Template Reference |
Public Member Functions | |
xcomplex () | |
xcomplex (const T &re_, const T &im_) | |
xcomplex (const T &re_) | |
template<typename U> | |
xcomplex (const xcomplex< U > &orig) | |
T & | real () |
const T & | real () const |
T & | imag () |
const T & | imag () const |
void | Set (const T &re_, const T &im_) |
template<typename U> | |
xcomplex & | operator= (const xcomplex< U > &orig) |
xcomplex & | operator= (const T &orig) |
xcomplex & | operator+= (const xcomplex &orig) |
xcomplex & | operator-= (const xcomplex &orig) |
xcomplex & | operator*= (const xcomplex &orig) |
xcomplex & | operator*= (const T &fact) |
xcomplex | operator* (const T &fact) const |
xcomplex | operator* (const xcomplex &b) const |
xcomplex | operator+ (const xcomplex &b) const |
xcomplex | operator- (const xcomplex &b) const |
xcomplex | operator- () const |
void | Negate () |
void | Conjugate () |
xcomplex | conj () 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> | |
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 57 of file xcomplex.h.
Default constructor. re and im are not initialised.
Definition at line 64 of file xcomplex.h.
Creates the complex number (re_, im_).
Definition at line 66 of file xcomplex.h.
Creates the complex number (re_, 0).
Definition at line 69 of file xcomplex.h.
xcomplex< T >::xcomplex | ( | const xcomplex< U > & | orig | ) | [inline] |
Creates a complex number as a copy of orig.
Definition at line 72 of file xcomplex.h.
T& xcomplex< T >::real | ( | ) | [inline] |
Returns the real part as lvalue.
Definition at line 76 of file xcomplex.h.
const T& xcomplex< T >::real | ( | ) | const [inline] |
Returns the real part.
Definition at line 78 of file xcomplex.h.
T& xcomplex< T >::imag | ( | ) | [inline] |
Returns the imaginary part as lvalue.
Definition at line 80 of file xcomplex.h.
const T& xcomplex< T >::imag | ( | ) | const [inline] |
Returns the imaginary part.
Definition at line 82 of file xcomplex.h.
void xcomplex< T >::Set | ( | const T & | re_, | |
const T & | im_ | |||
) | [inline] |
Sets the number to (re_, im_).
Definition at line 85 of file xcomplex.h.
xcomplex& xcomplex< T >::operator= | ( | const xcomplex< U > & | orig | ) | [inline] |
Sets the number to orig.
Definition at line 89 of file xcomplex.h.
Sets the number to (orig, 0).
Definition at line 92 of file xcomplex.h.
Adds orig to *this.
Definition at line 95 of file xcomplex.h.
Subtracts orig from *this.
Definition at line 98 of file xcomplex.h.
Multiplies *this by orig.
Definition at line 101 of file xcomplex.h.
Multiplies *this by fact.
Definition at line 108 of file xcomplex.h.
Returns *this * fact.
Definition at line 111 of file xcomplex.h.
Returns *this * b.
Definition at line 114 of file xcomplex.h.
Returns *this + b.
Definition at line 117 of file xcomplex.h.
Returns *this - b.
Definition at line 120 of file xcomplex.h.
Returns -(*this)
Definition at line 123 of file xcomplex.h.
void xcomplex< T >::Negate | ( | ) | [inline] |
Flips the signs of both components.
Definition at line 127 of file xcomplex.h.
void xcomplex< T >::Conjugate | ( | ) | [inline] |
Flips the signs of the imaginary component.
Definition at line 130 of file xcomplex.h.
Returns the complex conjugate of *this.
Definition at line 133 of file xcomplex.h.
T xcomplex< T >::norm | ( | ) | const [inline] |
Returns the norm of *this.
Definition at line 137 of file xcomplex.h.
real part
Definition at line 60 of file xcomplex.h.
imaginary part
Definition at line 60 of file xcomplex.h.
![]() |
![]() |
![]() |
||||
![]() |
|
![]() |
||||
![]() |
![]() |
![]() |
||||
![]() |
|
![]() |
||||
![]() |
![]() |
![]() |
||||
![]() |
![]() |
![]() |