Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

util::Complex< T > Class Template Reference

#include <Complex.h>

Inheritance diagram for util::Complex< T >:

util::Object List of all members.

Detailed Description

template<class T>
class util::Complex< T >

A class for complex calculations.

Compared to the STL correspondent, this class provides more support for mathematical operations and XML serialization.


Public Methods

 Complex (T r=0, T i=0)
 Create a new complex number with the given real and imaginary parts.

 Complex (const Complex &other)
 Create a copy of a complex number.

template<class U>  Complex (const Complex< U > &other)
 Create a typecast copy of a complex number.

Complex & conjugate (void)
 Convert this number to its complex conjugate.

Complex getConjugate (void) const
 Get a new complex number that is the conjucate of this number.

getModulus (void) const
 Get the modulus of this complex number (sqrt(real^2 + imag^2)).

getPhase (void) const
 Get the phase of this complex number (tan^-1(imag/real)).

Complex & operator= (const Complex &other)
 Copy a complex number.

template<class U> Complex & operator= (const Complex< U > &other)
 Compare two complex numbers.

template<class U>  operator Complex ()
 Cast this number to another type.

Complex & operator= (T value)
 Insert value T to complex number.

void operator+= (const Complex &other)
 Add a complex number to this number.

void operator-= (const Complex &other)
 Subtract a complex number from this number.

void operator+= (T value)
 Add a real number to this complex number (affects only real part):.

void operator-= (T value)
 Subtract a real number from this complex number (affects only real part):.

void operator *= (T value)
 Multiply this complex number by a real value.

void operator/= (T value)
 Divide this complex number by a real value.

void operator *= (const Complex &other)
 Multiply this complex number by a complex value.

void operator/= (const Complex &other)
 Divide this complex number by a complex value.


Public Attributes

real
 The real part of this complex number.

imag
 The imaginary part of this complex number.


Member Function Documentation

template<class T>
Complex& util::Complex< T >::operator=   value [inline]
 

Insert value T to complex number.

Means that the value is given for the real part of complex number and the imag is set to zero.


The documentation for this class was generated from the following file:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.