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 ( )
inline

Constructor

Referenced by Complex::exp().

Complex ( float  real,
float  imag = 0 
)
inline

Constructor

Parameters
realThe real part of the complex number
imagThe imaginary part of a complex number
Complex ( const Complex c)
inline

Copy constructor

Parameters
cThe source complex number

Member Function Documentation

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().

float arg ( ) const
inline

Compute the the argument of this complex number

Returns
Ther result
Complex exp ( ) const
inline

Computes the exponential of this complex number

Returns
The result

References Complex::Complex().

float im ( ) const
inline

Obtain the imaginary part of a complex number

Returns
The imaginary part
void im ( float  i)
inline

Set the imaginary part of the complex number

Parameters
iThe new imaginary part value
float mod ( ) const
inline

Compute the modulus value of this complex number

Returns
The result

References Complex::abs().

float norm ( ) const
inline

Compute the norm of this complex number

Returns
The result

References Complex::abs().

float norm2 ( ) const
inline

Compute the norm2 value of this complex number

Returns
The result

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

bool operator!= ( const Complex c) const
inline

Inequality operator

Parameters
cComplex number to compare with
Returns
True if not equal, false otherwise
Complex& operator*= ( const Complex c)
inline

Multiplication operator

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

References Complex::set().

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().

Complex& operator+= ( const Complex c)
inline

Addition operator

Parameters
cComplex number to add
Returns
A reference to this object

References Complex::set().

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
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().

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
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().

Complex& operator/= ( float  f)
inline

Division operator

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

References Complex::set().

Complex& operator= ( const Complex c)
inline

Assignment operator

Parameters
cComplex number to assign
Returns
A reference to this object

References Complex::set().

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().

bool operator== ( const Complex c) const
inline

Equality operator

Parameters
cComplex number to compare with
Returns
True if equal, false otherwise
float re ( ) const
inline

Obtain the real part of the complex number

Returns
The real part
void re ( float  r)
inline

Set the real part of the complex number

Parameters
rThe new real part value
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/=(), and Complex::operator=().


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