LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::complex< T > Class Template Reference

Class to represent and manipulate complex numbers. More...

#include <ltiComplex.h>

List of all members.

Public Member Functions

 complex (const T &=T(), const T &=T())
template<class U >
 complex (const complex< U > &other)
 complex (const std::complex< T > &other)
 operator std::complex< T > ()
real () const
imag () const
complex< T > & operator= (const T &other)
complex< T > & operator+= (const T &other)
complex< T > & operator-= (const T &other)
complex< T > & operator*= (const T &other)
complex< T > & operator/= (const T &other)
template<typename U >
complex< T > & operator= (const complex< U > &other)
template<typename U >
complex< T > & operator+= (const complex< U > &other)
template<typename U >
complex< T > & operator-= (const complex< U > &other)
template<typename U >
complex< T > & operator*= (const complex< U > &other)
template<typename U >
complex< T > & operator/= (const complex< U > &other)

Detailed Description

template<typename T>
class lti::complex< T >

Class to represent and manipulate complex numbers.

The complex numbers contain a real and an imaginary part, which can be accessed through the methods real() and imag().

The interface of this class is similar to the one provided by the Standard C++ library. It has being included in the LTI-Lib because different library versions do not provide the same functionality.

Note that many of the provided mathematical operations make only sense if the type used for the components of the complex number is double or float.


Constructor & Destructor Documentation

template<typename T >
lti::complex< T >::complex ( const T &  re = T(),
const T &  im = T() 
) [inline]

default constructor.

template<typename T>
template<class U >
lti::complex< T >::complex ( const complex< U > &  other  )  [inline]

copy constructor

template<typename T >
lti::complex< T >::complex ( const std::complex< T > &  other  )  [inline]

cast a std::complex to an lti::complex of the same type


Member Function Documentation

template<typename T >
T lti::complex< T >::imag (  )  const [inline]
template<typename T>
lti::complex< T >::operator std::complex< T > (  )  [inline]

cast a lti::complex into a std::complex of the same type

References lti::complex< T >::imag(), and lti::complex< T >::real().

template<typename T>
template<typename U >
complex<T>& lti::complex< T >::operator*= ( const complex< U > &  other  )  [inline]

multiply with another complex number

References lti::complex< T >::imag(), and lti::complex< T >::real().

template<typename T >
complex< T > & lti::complex< T >::operator*= ( const T &  other  )  [inline]

multiply this complex number with a real one.

template<typename T>
template<typename U >
complex<T>& lti::complex< T >::operator+= ( const complex< U > &  other  )  [inline]

add another complex number

template<typename T >
complex< T > & lti::complex< T >::operator+= ( const T &  other  )  [inline]

add a real number to this complex one.

template<typename T>
template<typename U >
complex<T>& lti::complex< T >::operator-= ( const complex< U > &  other  )  [inline]

subtract another complex number

template<typename T >
complex< T > & lti::complex< T >::operator-= ( const T &  other  )  [inline]

subtract a real number to this complex one.

template<typename T>
template<typename U >
complex<T>& lti::complex< T >::operator/= ( const complex< U > &  other  )  [inline]

divide with another complex number

References lti::complex< T >::imag(), lti::norm(), and lti::complex< T >::real().

template<typename T >
complex< T > & lti::complex< T >::operator/= ( const T &  other  )  [inline]

divide this complex number by a real one.

template<typename T>
template<typename U >
complex<T>& lti::complex< T >::operator= ( const complex< U > &  other  )  [inline]

copy another complex number into this one

template<typename T >
complex< T > & lti::complex< T >::operator= ( const T &  other  )  [inline]

copy a real number into this complex one, making the imaginary part zero.

template<typename T >
T lti::complex< T >::real (  )  const [inline]

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

Generated on Sat Apr 10 15:28:11 2010 for LTI-Lib by Doxygen 1.6.1