last update 20 Sep 2009 |
#include <cvrComplex.h>
Public Member Functions | |
T | real () const |
T | 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 |
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.
cvr::complex< T >::complex | ( | const T & | = T() , |
|
const T & | = T() | |||
) | [inline] |
Default constructor.
cvr::complex< T >::complex | ( | const complex< U > & | other | ) | [inline] |
Copy constructor.
cvr::complex< T >::complex | ( | const std::complex< T > & | other | ) | [inline] |
Cast a std::complex to an cvr::complex of the same type.
void cvr::complex< T >::get | ( | T & | re, | |
T & | im | |||
) | const [inline] |
Get the real and imaginary components at once.
T cvr::complex< T >::imag | ( | ) | const |
Return the imaginary component of the complex number.
cvr::complex< T >::operator std::complex< T > | ( | ) | const [inline] |
Cast a cvr::complex into a std::complex of the same type.
complex<T>& cvr::complex< T >::operator*= | ( | const complex< U > & | other | ) | [inline] |
multiply with another complex number
complex<T>& cvr::complex< T >::operator*= | ( | const T & | other | ) | [inline] |
Multiply this complex number with a real one.
complex<T>& cvr::complex< T >::operator+= | ( | const complex< U > & | other | ) | [inline] |
Add another complex number.
complex<T>& cvr::complex< T >::operator+= | ( | const T & | other | ) | [inline] |
Add a real number to this complex one.
complex<T>& cvr::complex< T >::operator-= | ( | const complex< U > & | other | ) | [inline] |
subtract another complex number
complex<T>& cvr::complex< T >::operator-= | ( | const T & | other | ) | [inline] |
Subtract a real number to this complex one.
complex<T>& cvr::complex< T >::operator/= | ( | const complex< U > & | other | ) | [inline] |
divide with another complex number
complex<T>& cvr::complex< T >::operator/= | ( | const T & | other | ) | [inline] |
Divide this complex number by a real one.
complex<T>& cvr::complex< T >::operator= | ( | const complex< U > & | other | ) | [inline] |
Copy another complex number into this one.
complex<T>& cvr::complex< T >::operator= | ( | const T & | other | ) | [inline] |
Copy a real number into this complex one, making the imaginary part zero.
T cvr::complex< T >::real | ( | ) | const |
Return the real component of the complex number.
void cvr::complex< T >::set | ( | const T & | re, | |
const T & | im = T() | |||
) | [inline] |
Set real and imaginary components at once.
void cvr::complex< T >::setImag | ( | const T & | im | ) | [inline] |
Set imaginary part.
void cvr::complex< T >::setReal | ( | const T & | re | ) | [inline] |
Set real part.