CVR-Lib last update 20 Sep 2009

cvr::complex< T > Class Template Reference

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

#include <cvrComplex.h>

List of all members.

Public Member Functions

real () const
imag () const
 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 > () 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)
void set (const T &re, const T &im=T())
void setReal (const T &re)
void setImag (const T &im)
void get (T &re, T &im) const


Detailed Description

template<typename T>
class cvr::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 CVR-Lib because different library versions do not provide the same functionality.

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


Constructor & Destructor Documentation

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

Default constructor.

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

Copy constructor.

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

Cast a std::complex to an cvr::complex of the same type.


Member Function Documentation

template<typename T>
void cvr::complex< T >::get ( T &  re,
T &  im 
) const [inline]

Get the real and imaginary components at once.

template<typename T>
T cvr::complex< T >::imag (  )  const

Return the imaginary component of the complex number.

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

Cast a cvr::complex into a std::complex of the same type.

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

multiply with another complex number

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

Multiply this complex number with a real one.

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

Add another complex number.

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

Add a real number to this complex one.

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

subtract another complex number

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

Subtract a real number to this complex one.

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

divide with another complex number

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

Divide this complex number by a real one.

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

Copy another complex number into this one.

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

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

template<typename T>
T cvr::complex< T >::real (  )  const

Return the real component of the complex number.

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

Set real and imaginary components at once.

template<typename T>
void cvr::complex< T >::setImag ( const T &  im  )  [inline]

Set imaginary part.

template<typename T>
void cvr::complex< T >::setReal ( const T &  re  )  [inline]

Set real part.


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

Generated on Sun Sep 20 22:08:56 2009 for CVR-Lib by Doxygen 1.5.8