kn::Complex< T > Class Template Reference

Generic complex number class (genereic for type). More...

#include <Complex.hpp>

Collaboration diagram for kn::Complex< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Complex (const T &part_re=T(0.0), const T &part_im=T(0.0))
 Constructor taking both real and imaginary parts.
 Complex (const Complex< T > &c)
 Copy constructor.
 ~Complex (void)
 Destructor.
Complex< T > & operator= (const Complex< T > &c)
 Changes the current real and imaginary parts values with those of the given other complex.
bool operator== (const Complex< T > &c) const
 Tests if the current complex number is equal to the given another complex number.
bool operator!= (const Complex< T > &c) const
 Tests if the current complex number is different to the given another complex number.
Complex< T > operator+ (const Complex< T > &c) const
 Adds two complexes.
Complex< T > operator- (const Complex< T > &c) const
 Substracts two complexes.
Complex< T > operator* (const Complex< T > &c) const
 Multiplies two complexes.
Complex< T > operator/ (const Complex< T > &c) const
 Divides two complexes.
Complex< T > & operator+= (const Complex< T > &c)
 Adds two complexes, then overwrite the current instance with the result of the operation.
Complex< T > & operator-= (const Complex< T > &c)
 Substracts two complexes, then overwrite the current instance with the result of the operation.
Complex< T > & operator*= (const Complex< T > &c)
 Multiplies two complexes, then overwrite the current instance with the result of the operation.
Complex< T > & operator/= (const Complex< T > &c)
 Divides two complexes, then overwrite the current instance with the result of the operation.
module () const
 Computes the module of the complex.
Complex< T > conjugate () const
 Computes the conjugate of the complex.

Public Attributes

re
 Real part of the complex number.
im
 Imaginary part of the complex number.


Detailed Description

template<class T>
class kn::Complex< T >

Generic complex number class (genereic for type).

Definition at line 55 of file Complex.hpp.


Constructor & Destructor Documentation

template<class T >
kn::Complex< T >::Complex ( const T &  part_re = T(0.0),
const T &  part_im = T(0.0) 
) [inline]

Constructor taking both real and imaginary parts.

Parameters:
part_real Real part of the complex
part_imag Imaginary part of the complex

Definition at line 222 of file Complex.hpp.

template<class T >
kn::Complex< T >::Complex ( const Complex< T > &  c  )  [inline]

Copy constructor.

Parameters:
c The complex to copy from

Definition at line 225 of file Complex.hpp.

template<class T >
kn::Complex< T >::~Complex ( void   )  [inline]

Destructor.

Definition at line 228 of file Complex.hpp.


Member Function Documentation

template<class T >
Complex< T > kn::Complex< T >::conjugate (  )  const [inline]

Computes the conjugate of the complex.

Returns:
The conjugate of the complex

Definition at line 324 of file Complex.hpp.

template<class T >
T kn::Complex< T >::module (  )  const [inline]

Computes the module of the complex.

Returns:
The module of the complex

Definition at line 320 of file Complex.hpp.

template<class T >
bool kn::Complex< T >::operator!= ( const Complex< T > &  c  )  const [inline]

Tests if the current complex number is different to the given another complex number.

Parameters:
c The other complex to be compared
Returns:
True if the complex numbers are different, false otherwise

Definition at line 253 of file Complex.hpp.

template<class T >
Complex< T > kn::Complex< T >::operator* ( const Complex< T > &  c  )  const [inline]

Multiplies two complexes.

Parameters:
c The complex to be multiplied to the current instance
Returns:
The result of the operation

Definition at line 274 of file Complex.hpp.

template<class T >
Complex< T > & kn::Complex< T >::operator*= ( const Complex< T > &  c  )  [inline]

Multiplies two complexes, then overwrite the current instance with the result of the operation.

Parameters:
c The complex to be multiplied to the current instance
Returns:
A copy of the current instance

Definition at line 302 of file Complex.hpp.

template<class T >
Complex< T > kn::Complex< T >::operator+ ( const Complex< T > &  c  )  const [inline]

Adds two complexes.

Parameters:
c The complex to be added to the current instance
Returns:
The result of the operation

Definition at line 264 of file Complex.hpp.

template<class T >
Complex< T > & kn::Complex< T >::operator+= ( const Complex< T > &  c  )  [inline]

Adds two complexes, then overwrite the current instance with the result of the operation.

Parameters:
c The complex to be added to the current instance
Returns:
A copy of the current instance

Definition at line 290 of file Complex.hpp.

template<class T >
Complex< T > kn::Complex< T >::operator- ( const Complex< T > &  c  )  const [inline]

Substracts two complexes.

Parameters:
c The complex to be substracted to the current instance
Returns:
The result of the operation

Definition at line 269 of file Complex.hpp.

template<class T >
Complex< T > & kn::Complex< T >::operator-= ( const Complex< T > &  c  )  [inline]

Substracts two complexes, then overwrite the current instance with the result of the operation.

Parameters:
c The complex to be substracted to the current instance
Returns:
A copy of the current instance

Definition at line 296 of file Complex.hpp.

template<class T >
Complex< T > kn::Complex< T >::operator/ ( const Complex< T > &  c  )  const [inline]

Divides two complexes.

Parameters:
c The complex to divide the current instance by
Returns:
The result of the operation

Definition at line 279 of file Complex.hpp.

template<class T >
Complex< T > & kn::Complex< T >::operator/= ( const Complex< T > &  c  )  [inline]

Divides two complexes, then overwrite the current instance with the result of the operation.

Parameters:
c The complex to divide the current instance by
Returns:
A copy of the current instance

Definition at line 308 of file Complex.hpp.

template<class T >
Complex< T > & kn::Complex< T >::operator= ( const Complex< T > &  c  )  [inline]

Changes the current real and imaginary parts values with those of the given other complex.

Parameters:
c The other complex to set the current instance with
Returns:
The current instance

Definition at line 236 of file Complex.hpp.

template<class T >
bool kn::Complex< T >::operator== ( const Complex< T > &  c  )  const [inline]

Tests if the current complex number is equal to the given another complex number.

Parameters:
c The other complex to be compared
Returns:
True if the complex numbers are equals, false otherwise

Definition at line 248 of file Complex.hpp.


Member Data Documentation

template<class T>
T kn::Complex< T >::im

Imaginary part of the complex number.

Definition at line 71 of file Complex.hpp.

template<class T>
T kn::Complex< T >::re

Real part of the complex number.

Definition at line 66 of file Complex.hpp.


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

Generated on Thu Nov 12 16:06:35 2009 for OpenKN-math by  doxygen 1.5.8