|
Complex< T > | operator+ (Complex< T > z, const Complex< T > &w) |
| Takes two complex numbers \(z=a+bi\) and \(w=c+di\) and returns the complex number \(z+w=(a+c)+(b+d)i\). More...
|
|
Complex< T > | operator+ (Complex< T > z, const T &x) |
| Takes a complex number \(z=a+bi\) and real number \(x\) and returns the complex number \(z+x=(a+x)+bi\). More...
|
|
Complex< T > | operator+ (const T &x, const Complex< T > &z) |
| Takes a real number \(x\) and complex number \(z=a+bi\) returns the complex number \(x+z=(x+a)+bi\). More...
|
|
Complex< T > | operator- (Complex< T > z, const Complex< T > &w) |
| Takes two complex numbers \(z=a+bi\) and \(w=c+di\) and returns the complex number \(z-w=(a-c)+(b-d)i\). More...
|
|
Complex< T > | operator- (Complex< T > z, const T &x) |
| Takes a complex number \(z=a+bi\) and real number \(x\) and returns the complex number \(z-x=(a-x)+bi\). More...
|
|
Complex< T > | operator- (const T &x, const Complex< T > &z) |
| Takes a real number \(x\) and complex number \(z=a+bi\) returns the complex number \(x-z=(x-a)-bi\). More...
|
|
Complex< T > | operator* (Complex< T > z, const Complex< T > &w) |
| Takes two complex numbers \(z=a+bi\) and \(w=c+di\) and returns the complex number \(zw=(ac-bd)+(ad+bc)i\). More...
|
|
Complex< T > | operator* (Complex< T > z, const T &x) |
| Takes a complex number \(z=a+bi\) and real number \(x\) and returns the complex number \(zx=ax+bxi\). More...
|
|
Complex< T > | operator* (const T &x, Complex< T > z) |
| Takes a real number \(x\) and complex number \(z=a+bi\) returns the complex number \(xz=xa+xbi\). More...
|
|
Complex< T > | operator/ (Complex< T > z, const Complex< T > &w) |
| Takes two complex numbers \(z=a+bi\) and \(w=c+di\) and returns the complex number \(\frac{z}{w}=\frac{1}{c^2+d^2}((ac+bd)+(bc-ad)i)\). More...
|
|
Complex< T > | operator/ (Complex< T > z, const T &x) |
| Takes a complex number \(z=a+bi\) and real number \(x\) and returns the complex number \(\frac{z}{x}=\frac{a}{x}+\frac{b}{x}i\). More...
|
|
Complex< T > | operator/ (const T &x, const Complex< T > &z) |
| Takes a real number \(x\) and complex number \(z=a+bi\) returns the complex number \(\frac{x}{z}=\frac{1}{a^2+b^2}(xa-xbi)\). More...
|
|
std::ostream & | operator<< (std::ostream &out, const Complex< T > &z) |
| Takes a complex number \(z=a+bi\) and writes to out. More...
|
|
bool | operator== (const Complex< T > &z, const Complex< T > &w) |
| Compares two complex numbers \(z=a+bi\) and \(w=c+di\). More...
|
|
bool | operator== (const Complex< T > &z, const T &x) |
| Compares a complex number \(z=a+bi\) and a real number \(x\). More...
|
|
bool | operator== (const T &x, const Complex< T > &z) |
| Compares a real number \(x\) and a complex numbers \(z=a+bi\). More...
|
|
bool | operator!= (const Complex< T > &z, const Complex< T > &w) |
| Compares two complex numbers \(z=a+bi\) and \(w=c+di\). More...
|
|
bool | operator!= (const Complex< T > &z, const T &x) |
| Compares a complex number \(z=a+bi\) and a real number \(x\). More...
|
|
bool | operator!= (const T &x, const Complex< T > &z) |
| Compares a real number \(x\) and a complex numbers \(z=a+bi\). More...
|
|
template<typename T>
class Linear::Complex< T >
Class for complex numbers.
- Parameters
-
T | Type to store the real and imaginary part as. |
template<typename T >
std::ostream& operator<< |
( |
std::ostream & |
out, |
|
|
const Complex< T > & |
z |
|
) |
| |
|
friend |
Takes a complex number \(z=a+bi\) and writes to out.
If \(z=0\), then simply \(0\) will be written. If \(z=bi\), then it will write just \(bi\). If \(z=a\), then it will write just \(a\). Otherwise the full \(a+bi\) will be written, with "+" replaced by "-" if \(b<0\).
- Parameters
-
out | Reference to std::ostream. |
z | Complex number. |