Yate
Public Member Functions | List of all members
Complex Class Reference

A Complex (float) number. More...

#include <yatemath.h>

Public Member Functions

 Complex ()
 
 Complex (float real, float imag=0)
 
 Complex (const Complex &c)
 
float re () const
 
void re (float r)
 
float im () const
 
void im (float i)
 
Complexset (float r=0, float i=0)
 
bool operator== (const Complex &c) const
 
bool operator!= (const Complex &c) const
 
Complexoperator= (const Complex &c)
 
Complexoperator= (float real)
 
Complexoperator+= (const Complex &c)
 
Complexoperator+= (float real)
 
Complexoperator-= (const Complex &c)
 
Complexoperator-= (float real)
 
Complexoperator*= (const Complex &c)
 
Complexoperator*= (float f)
 
Complexoperator/= (const Complex &c)
 
Complexoperator/= (float f)
 
float abs () const
 
float mod () const
 
float arg () const
 
Complex exp () const
 
float norm () const
 
float norm2 () const
 

Detailed Description

A Complex (float) number.

This class implements a complex number

Constructor & Destructor Documentation

◆ Complex() [1/3]

Complex ( )
inline

Constructor

Referenced by Complex::exp().

◆ Complex() [2/3]

Complex ( float  real,
float  imag = 0 
)
inline

Constructor

Parameters
realThe real part of the complex number
imagThe imaginary part of a complex number

◆ Complex() [3/3]

Complex ( const Complex c)
inline

Copy constructor

Parameters
cThe source complex number

Member Function Documentation

◆ abs()

float abs ( ) const
inline

Compute the absolute value of this complex number

Returns
The result

References Complex::norm2().

Referenced by Complex::mod(), and Complex::norm().

◆ arg()

float arg ( ) const
inline

Compute the the argument of this complex number

Returns
Ther result

◆ exp()

Complex exp ( ) const
inline

Computes the exponential of this complex number

Returns
The result

References Complex::Complex().

◆ im() [1/2]

float im ( ) const
inline

Obtain the imaginary part of a complex number

Returns
The imaginary part

◆ im() [2/2]

void im ( float  i)
inline

Set the imaginary part of the complex number

Parameters
iThe new imaginary part value

◆ mod()

float mod ( ) const
inline

Compute the modulus value of this complex number

Returns
The result

References Complex::abs().

◆ norm()

float norm ( ) const
inline

Compute the norm of this complex number

Returns
The result

References Complex::abs().

◆ norm2()

float norm2 ( ) const
inline

Compute the norm2 value of this complex number

Returns
The result

Referenced by Complex::abs(), and Complex::operator/=().

◆ operator!=()

bool operator!= ( const Complex c) const
inline

Inequality operator

Parameters
cComplex number to compare with
Returns
True if not equal, false otherwise

◆ operator*=() [1/2]

Complex & operator*= ( const Complex c)
inline

Multiplication operator

Parameters
cComplex number to multiply with
Returns
A reference to this object

References Complex::set().

◆ operator*=() [2/2]

Complex & operator*= ( float  f)
inline

Multiplication operator. Multiply this number with a float number

Parameters
fValue to multiply with
Returns
A reference to this object

References Complex::set().

◆ operator+=() [1/2]

Complex & operator+= ( const Complex c)
inline

Addition operator

Parameters
cComplex number to add
Returns
A reference to this object

References Complex::set().

◆ operator+=() [2/2]

Complex & operator+= ( float  real)
inline

Addition operator. Add a value to the real part

Parameters
realValue to add to real part
Returns
A reference to this object

◆ operator-=() [1/2]

Complex & operator-= ( const Complex c)
inline

Substraction operator

Parameters
cComplex number to substract from this one
Returns
A reference to this object

References Complex::set().

◆ operator-=() [2/2]

Complex & operator-= ( float  real)
inline

Substraction operator. Substract a value a value from the real part

Parameters
realValue to substract from real part
Returns
A reference to this object

◆ operator/=() [1/2]

Complex & operator/= ( const Complex c)
inline

Division operator

Parameters
cComplex number to devide with
Returns
A reference to this object

References Complex::norm2(), and Complex::set().

◆ operator/=() [2/2]

Complex & operator/= ( float  f)
inline

Division operator

Parameters
fFloat number to devide with
Returns
A reference to this object

References Complex::set().

◆ operator=() [1/2]

Complex & operator= ( const Complex c)
inline

Assignment operator

Parameters
cComplex number to assign
Returns
A reference to this object

References Complex::set().

◆ operator=() [2/2]

Complex & operator= ( float  real)
inline

Assignment operator. Set the real part, reset the imaginary one

Parameters
realNew real part value
Returns
A reference to this object

References Complex::set().

◆ operator==()

bool operator== ( const Complex c) const
inline

Equality operator

Parameters
cComplex number to compare with
Returns
True if equal, false otherwise

◆ re() [1/2]

float re ( ) const
inline

Obtain the real part of the complex number

Returns
The real part

◆ re() [2/2]

void re ( float  r)
inline

Set the real part of the complex number

Parameters
rThe new real part value

◆ set()

Complex & set ( float  r = 0,
float  i = 0 
)
inline

Set data

Parameters
rThe real part of the complex number
iThe imaginary part of a complex number
Returns
A reference to this object

Referenced by Complex::operator*=(), Complex::operator*=(), Complex::operator+=(), Complex::operator-=(), Complex::operator/=(), Complex::operator/=(), Complex::operator=(), and Complex::operator=().


The documentation for this class was generated from the following file: