- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Exponent::MathTools::TComplex< TypeName > Class Template Reference

Inheritance diagram for Exponent::MathTools::TComplex< TypeName >:

List of all members.

## Detailed Description

### template<class TypeName>
class Exponent::MathTools::TComplex< TypeName >

Complex object.

Date:
  14/06/2006

Author:
  Paul Chana

Version:
  1.0.0 Initial version

Note:
  All contents of this source code are copyright 2005 Exp Digital Uk.
  This source file is covered by the licence conditions of the Infinity API. You should have recieved a copy
  with the source code. If you didnt, please refer to http://www.expdigital.co.uk All content is the Intellectual property of Exp Digital Uk.
  Certain sections of this code may come from other sources. They are credited where applicable.
  If you have comments, suggestions or bug reports please visit http://support.expdigital.co.uk

Id
  TComplex.hpp,v 1.3 2007/02/08 21:06:44 paul Exp

Definition at line 30 of file TComplex.hpp.

## Public Member Functions

- TypeName getImaginary () const
- TypeName getMagnitude () const
- TypeName getMagnitudeSquared () const
- TypeName getPhase () const
- TypeName getReal () const
- TComplex< TypeName > operator * (const TypeName value)
- TComplex< TypeName > operator * (const TComplex< TypeName > &complex)
- TComplex< TypeName > operator+ (const TComplex< TypeName > &complex)
- TComplex< TypeName > operator- (const TComplex< TypeName > &complex)
- TComplex< TypeName > operator/ (const TypeName value)
- TComplex< TypeName > operator/ (const TComplex< TypeName > &complex)
- TComplex< TypeName > operator= (const TComplex< TypeName > &complex)
- void setRealAndImaginary (const TypeName real, const TypeName imag)
- void setRealAndImaginaryFromMagnitudeAndPhase (const TypeName magnitude, const TypeName phase)
- TComplex (const TypeName real=0, const TypeName imag=0)
- virtual ~TComplex ()

## Protected Attributes

- TypeName m_imag
- TypeName m_real

## Constructor & Destructor Documentation

template<class TypeName>

Exponent::MathTools::TComplex< TypeName >::TComplex | ( | const TypeName | real = `0`,
|  | const TypeName | imag = `0` |
| ) |  |  | `[inline]`

Construction

Parameters:

  | real | The real part
  | imag | The imag part

Definition at line 47 of file TComplex.hpp.

References EXPONENT_CLASS_CONSTRUCTION.

template<class TypeName>

virtual Exponent::MathTools::TComplex< TypeName >::~TComplex | ( |  | ) | `[inline, virtual]`

Destruction

Definition at line 55 of file TComplex.hpp.

References EXPONENT_CLASS_DESTRUCTION.

## Member Function Documentation

template<class TypeName>

TypeName Exponent::MathTools::TComplex< TypeName >::getImaginary | ( |  | ) | const`[inline]`

Get the imaginary part

Return values:

  | TypeName | The imaginary part

Definition at line 208 of file TComplex.hpp.

References Exponent::MathTools::TComplex< TypeName >::m_imag.

template<class TypeName>

TypeName Exponent::MathTools::TComplex< TypeName >::getMagnitude | ( |  | ) | const`[inline]`

Get the magnitude

Return values:

  | TypeName | The magnitude (as defined sqrt(m_real^2+m_imag^2))

Definition at line 170 of file TComplex.hpp.

References Exponent::MathTools::TComplex< TypeName >::m_imag, and Exponent::MathTools::TComplex< TypeName >::m_real.

template<class TypeName>

TypeName Exponent::MathTools::TComplex< TypeName >::getMagnitudeSquared | ( |  | ) | const`[inline]`

Get magnitude squared

Return values:

  | TypeName | Magnitude^2

Definition at line 179 of file TComplex.hpp.

References Exponent::MathTools::TComplex< TypeName >::m_imag, and Exponent::MathTools::TComplex< TypeName >::m_real.

Referenced by Exponent::MathTools::TComplex< TypeName >::operator/().

template<class TypeName>

TypeName Exponent::MathTools::TComplex< TypeName >::getPhase | ( |  | ) | const`[inline]`

Get the phase

Return values:

  | TypeName | The phase (as defined atan2(m_imag, m_real))

Definition at line 188 of file TComplex.hpp.

References Exponent::MathTools::TComplex< TypeName >::m_imag, and Exponent::MathTools::TComplex< TypeName >::m_real.

template<class TypeName>

TypeName Exponent::MathTools::TComplex< TypeName >::getReal | ( |  | ) | const`[inline]`

Get the real part

Return values:

  | TypeName | The real part

Definition at line 199 of file TComplex.hpp.

References Exponent::MathTools::TComplex< TypeName >::m_real.

template<class TypeName>

TComplex<TypeName> Exponent::MathTools::TComplex< TypeName >::operator * | ( | const TypeName | value | ) | `[inline]`

Multiplication operation

Parameters:

  | value | The value to times this to

Return values:

  | TComplex | This * complex

Definition at line 122 of file TComplex.hpp.

References Exponent::MathTools::TComplex< TypeName >::m_imag, and Exponent::MathTools::TComplex< TypeName >::m_real.

template<class TypeName>

TComplex<TypeName> Exponent::MathTools::TComplex< TypeName >::operator * | ( | const TComplex< TypeName > & | complex | ) | `[inline]`

Multiplication operation

Parameters:

  | complex | The complex to times this to

Return values:

  | TComplex | This * complex

Definition at line 89 of file TComplex.hpp.

References Exponent::MathTools::TComplex< TypeName >::m_imag, and Exponent::MathTools::TComplex< TypeName >::m_real.

template<class TypeName>

TComplex<TypeName> Exponent::MathTools::TComplex< TypeName >::operator+ | ( | const TComplex< TypeName > & | complex | ) | `[inline]`

Addition operation

Parameters:

  | complex | The complex to add this to

Return values:

  | TComplex | This + complex

Definition at line 67 of file TComplex.hpp.

References Exponent::MathTools::TComplex< TypeName >::m_imag, and Exponent::MathTools::TComplex< TypeName >::m_real.

template<class TypeName>

TComplex<TypeName> Exponent::MathTools::TComplex< TypeName >::operator- | ( | const TComplex< TypeName > & | complex | ) | `[inline]`

Subtraction operation

Parameters:

  | complex | The complex to subtract this to

Return values:

  | TComplex | This - complex

Definition at line 78 of file TComplex.hpp.

References Exponent::MathTools::TComplex< TypeName >::m_imag, and Exponent::MathTools::TComplex< TypeName >::m_real.

template<class TypeName>

TComplex<TypeName> Exponent::MathTools::TComplex< TypeName >::operator/ | ( | const TypeName | value | ) | `[inline]`

Division operation

Parameters:

  | value | The value to divide this to

Return values:

  | TComplex | This / value

Definition at line 133 of file TComplex.hpp.

References Exponent::MathTools::TComplex< TypeName >::m_imag, and Exponent::MathTools::TComplex< TypeName >::m_real.

template<class TypeName>

TComplex<TypeName> Exponent::MathTools::TComplex< TypeName >::operator/ | ( | const TComplex< TypeName > & | complex | ) | `[inline]`

Division operation

Parameters:

  | complex | The complex to divide this to

Return values:

  | TComplex | This / complex

Definition at line 100 of file TComplex.hpp.

References Exponent::MathTools::TComplex< TypeName >::getMagnitudeSquared(), Exponent::MathTools::TComplex< TypeName >::m_imag, and Exponent::MathTools::TComplex< TypeName >::m_real.

template<class TypeName>

TComplex<TypeName> Exponent::MathTools::TComplex< TypeName >::operator= | ( | const TComplex< TypeName > & | complex | ) | `[inline]`

Assignment operation

Parameters:

  | complex | The complex to assign this to

Return values:

  | TComplex | This

Definition at line 111 of file TComplex.hpp.

References Exponent::MathTools::TComplex< TypeName >::m_imag, and Exponent::MathTools::TComplex< TypeName >::m_real.

template<class TypeName>

void Exponent::MathTools::TComplex< TypeName >::setRealAndImaginary | ( | const TypeName | real,
|  | const TypeName | imag |
| ) |  |  | `[inline]`

Set real and imaginary parts

Parameters:

  | real | The real part
  | imag | The imag part

Definition at line 158 of file TComplex.hpp.

References Exponent::MathTools::TComplex< TypeName >::m_imag, and Exponent::MathTools::TComplex< TypeName >::m_real.

template<class TypeName>

void Exponent::MathTools::TComplex< TypeName >::setRealAndImaginaryFromMagnitudeAndPhase | ( | const TypeName | magnitude,
|  | const TypeName | phase |
| ) |  |  | `[inline]`

Set the real and imaginary from a magnitude and phase components

Parameters:

  | magnitude | The magnitude part
  | phase | The phase part

Definition at line 147 of file TComplex.hpp.

References Exponent::MathTools::TComplex< TypeName >::m_imag, and Exponent::MathTools::TComplex< TypeName >::m_real.

## Member Data Documentation

template<class TypeName>

TypeName Exponent::MathTools::TComplex< TypeName >::m_imag`[protected]`

imaginary component

Definition at line 220 of file TComplex.hpp.

Referenced by Exponent::MathTools::TComplex< TypeName >::getImaginary(), Exponent::MathTools::TComplex< TypeName >::getMagnitude(), Exponent::MathTools::TComplex< TypeName >::getMagnitudeSquared(), Exponent::MathTools::TComplex< TypeName >::getPhase(), Exponent::MathTools::TComplex< TypeName >::operator *(), Exponent::MathTools::TComplex< TypeName >::operator+(), Exponent::MathTools::TComplex< TypeName >::operator-(), Exponent::MathTools::TComplex< TypeName >::operator/(), Exponent::MathTools::TComplex< TypeName >::operator=(), Exponent::MathTools::TComplex< TypeName >::setRealAndImaginary(), and Exponent::MathTools::TComplex< TypeName >::setRealAndImaginaryFromMagnitudeAndPhase().

template<class TypeName>

TypeName Exponent::MathTools::TComplex< TypeName >::m_real`[protected]`

real value

Definition at line 219 of file TComplex.hpp.

Referenced by Exponent::MathTools::TComplex< TypeName >::getMagnitude(), Exponent::MathTools::TComplex< TypeName >::getMagnitudeSquared(), Exponent::MathTools::TComplex< TypeName >::getPhase(), Exponent::MathTools::TComplex< TypeName >::getReal(), Exponent::MathTools::TComplex< TypeName >::operator *(), Exponent::MathTools::TComplex< TypeName >::operator+(), Exponent::MathTools::TComplex< TypeName >::operator-(), Exponent::MathTools::TComplex< TypeName >::operator/(), Exponent::MathTools::TComplex< TypeName >::operator=(), Exponent::MathTools::TComplex< TypeName >::setRealAndImaginary(), and Exponent::MathTools::TComplex< TypeName >::setRealAndImaginaryFromMagnitudeAndPhase().