HILA
|
#include <cmplx.h>
Public Member Functions | |
Complex ()=default | |
Construct a new Complex object. | |
T | real () const |
Real part of Complex number. | |
T | imag () const |
Imaginary part of Complex number. | |
Complex< T > & | operator= (const Complex< T > &s) &=default |
Assignment operator. | |
T | squarenorm () const |
Compute square norm of Complex number. | |
T | abs () const |
Compute absolute value of Complex number. | |
T | arg () const |
Compute argument of Complex number. | |
Complex< T > | conj () const |
Compute conjugate of Complex number. | |
Complex< T > | dagger () const |
Compute dagger of Complex number. | |
Complex< T > | polar (const T r, const T theta) |
Stores and returns Complex number given in polar coordinates. | |
Complex< T > & | random () |
Assign random values to Complex real and imaginary part. | |
Complex< T > & | gaussian_random (double width=1.0) |
Produces complex gaussian random values. | |
Complex< T > | operator+ () const |
Unary + operator. | |
Complex< T > | operator- () const |
Unary - operator. | |
template<typename A > | |
Complex< T > & | operator+= (const Complex< A > &lhs) & |
+= addition assignment operator | |
template<typename A > | |
Complex< T > & | operator-= (const Complex< A > &lhs) & |
-= subtraction assignment operator | |
template<typename A > | |
Complex< T > & | operator*= (const Complex< A > &lhs) & |
*= multiply assignment operator | |
template<typename A > | |
Complex< T > & | operator/= (const Complex< A > &lhs) & |
/= divide assignment operator | |
Complex< T > & | operator++ () |
++ increment operator | |
Complex< T > & | operator-- () |
– decrement operator | |
template<typename A > | |
Complex< T > | conj_mul (const Complex< A > &b) const |
Conjugate multiply method. | |
template<typename A > | |
Complex< T > | mul_conj (const Complex< A > &b) const |
Multiply conjugate method. | |
Complex definition.
Define complex type as a class. This allows Hilapp to replace the internal type with a vector.
NOTE: T must be arithmetic and integrable. In the following documentation MyType refers to T, as in an arithmetic and integrable type.
re | Real part |
im | Imaginary part |
T | Arithmetic type |
Construct a new Complex object.
The following ways of constructing a Complex object are
Default constructor:
The default constructor initializes Complex::re
and Complex::im
to 0
Complex constructor:
Initialize both real and imaginary element
Copy constructor:
Initialize form already existing Complex number
Equivalent initializing is Complex<MyType> B(C)
Real constructor:
Initialize only real element and sets imaginary to 0
Not equivalent to Complex<MyType> C = a
Zero constructor:
Initialize to zero with nullpointer trick
|
inline |
|
inline |
Compute dagger of Complex number.
Alias to Complex::conj
\begin{align} z^* = z^\dagger \end{align}
Produces complex gaussian random values.
Uses hila::gaussrand2 for both real and imaignary part Assigns same random value for both real and imaginary part
width | gaussian_random |
|
inline |
|
inline |
*= multiply assignment operator
Multiply assignment for Complex numbers can be performed in the following ways
Complex multiply assign:
Standard Complex number multiplication
\begin{align}z &= x + iy, w = x' + iy' \\ z w &= (x + iy)(x' + iy') = (xx'-yy') + i(xy' + yx')\end{align}
Real multiply assign:
Multiply assign by real number to both components of Complex number
++ increment operator
Increments real part of Complex number
|
inline |
+= addition assignment operator
Addition assignment for Complex numbers can be performed in the following ways
Complex addition assignment:
Real addition assignment:
Add assign only to real part of Complex number
– decrement operator
Decrement real part of Complex number
|
inline |
-= subtraction assignment operator
Subtraction assignment for Complex numbers can be performed in the following ways
Complex subtract assign:
Real subtract assign:
Subtract assign only to real part of Complex number
|
inline |
/= divide assignment operator
Divide assignment for Complex numbers can be performed in the following ways
Complex divide assign:
Standard Complex number division
\begin{align}z &= x + iy, w = x' + iy' \\ \frac{z}{w} &= \frac{x + iy}{x' + iy'} = \frac{(xx'+ yy') + i( yx' - xy')}{|w|^2}\end{align}
Real divide assign:
Divide assign by real number to both components of Complex number
|
inlinedefault |
Stores and returns Complex number given in polar coordinates.
\begin{align} z = r\cdot e^{i\theta} \end{align}
r | Radius of Complex number |
theta | Angle of complex number in radians |
Assign random values to Complex real and imaginary part.
Uses hila::random for both real and imaginary part
|
inline |
|
inline |