Yate: Complex Class Reference

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)
Complex & | set (float r=0, float i=0)
bool | operator== (const Complex &c) const
bool | operator!= (const Complex &c) const
Complex & | operator= (const Complex &c)
Complex & | operator= (float real)
Complex & | operator+= (const Complex &c)
Complex & | operator+= (float real)
Complex & | operator-= (const Complex &c)
Complex & | operator-= (float real)
Complex & | operator*= (const Complex &c)
Complex & | operator*= (float f)
Complex & | operator/= (const Complex &c)
Complex & | operator/= (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

  real | The real part of the complex number
  imag | The imaginary part of a complex number

## ◆ Complex() [3/3]

Complex | ( | const Complex & | c | ) |
| inline

Copy constructor

Parameters

  c | The 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

  i | The 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

  c | Complex number to compare with

Returns
  True if not equal, false otherwise

## ◆ operator*=() [1/2]

Complex & operator*= | ( | const Complex & | c | ) |
| inline

Multiplication operator

Parameters

  c | Complex 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

  f | Value to multiply with

Returns
  A reference to this object

References Complex::set().

## ◆ operator+=() [1/2]

Complex & operator+= | ( | const Complex & | c | ) |
| inline

Addition operator

Parameters

  c | Complex 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

  real | Value to add to real part

Returns
  A reference to this object

## ◆ operator-=() [1/2]

Complex & operator-= | ( | const Complex & | c | ) |
| inline

Substraction operator

Parameters

  c | Complex 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

  real | Value to substract from real part

Returns
  A reference to this object

## ◆ operator/=() [1/2]

Complex & operator/= | ( | const Complex & | c | ) |
| inline

Division operator

Parameters

  c | Complex 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

  f | Float 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

  c | Complex 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

  real | New real part value

Returns
  A reference to this object

References Complex::set().

## ◆ operator==()

bool operator== | ( | const Complex & | c | ) | const
| inline

Equality operator

Parameters

  c | Complex 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

  r | The new real part value

## ◆ set()

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

Set data

Parameters

  r | The real part of the complex number
  i | The 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:

- yatemath.h