template <class T> class basicplx

Complex number template class.

Public Methods

basicplx()
Default constructor.
basicplx(const basicplx& rhs)
Copy constructor.
basicplx(T Re, T Im=0.0)
Initializing constructor.
basicplx& operator=(const basicplx &rhs)
Assignment operator.
basicplx& operator+=(const basicplx &rhs)
Add a complex number.
basicplx& operator-=(const basicplx &rhs)
Subtract a complex number.
basicplx& operator*=(const basicplx &rhs)
Complex * Complex.
basicplx& operator*=(math_t rhs)
Complex * float.
basicplx& operator/=(const basicplx &rhs)
Complex / Complex.
basicplx& operator/=(math_t rhs)
Complex / float.
bool operator==(const basicplx& y) const
Compare two complex numbers.
bool operator!(void) const
Test for complex variable equal to zero.
basicplx operator~(void) const
Complex conjugation.
basicplx operator-(void) const
Unary negate.
basicplx& setMArg(math_t mag, math_t arg)
Set a complex from magnitude and argument.
basicplx& xcc(const basicplx& rhs)
Multiply by ~arg.
math_t MagSq(void) const
Magnitude Squared.
math_t Mag(void) const
Magnitude.
math_t Arg(void) const
Argument.
T Real() const
Real Part.
T Imag() const
Imaginary Part.
void Swap(basicplx& x)
Swap two Complex numbers.

Documentation

basicplx implements complex data type by means f the template mechanism. All functions are in-line to maximize efficiency.
basicplx()
Create a complex number. The data are left uninitialized to increase efficiency.

basicplx(const basicplx& rhs)
Create a complex number and initialize it from another complex number.

basicplx(T Re, T Im=0.0)
Create a complex and initialize it from its real and (optional) imaginary components.

basicplx& operator=(const basicplx &rhs)
The rhs is copied to the lhs variable.

basicplx& operator+=(const basicplx &rhs)
The complex numbers are added and left in the lhs argument. The result is also returned by reference.

basicplx& operator-=(const basicplx &rhs)
The rhs complex number is subtracted from and the result is left in the lhs argument. The result is also returned by reference.

basicplx& operator*=(const basicplx &rhs)
The lhs complex variable is multiplied by the rhs argument. The result replaces the lhs argument and is returned by reference.

basicplx& operator*=(math_t rhs)
The lhs complex variable is multiplied by the rhs float. The result replaces the lhs complex argument and is returned by reference.

basicplx& operator/=(const basicplx &rhs)
The lhs complex variable is divided by the rhs argument. The result replaces the lhs argument and is also returned.

basicplx& operator/=(math_t rhs)
The lhs complex variable is divided by the rhs argument. The result replaces the lhs argument and is also returned.

bool operator==(const basicplx& y) const
Evaluates to true if the lhs is exactly equal to the rhs.

bool operator!(void) const
Evaluates to true if the complex object is zero.

basicplx operator~(void) const
The complex conjugate of the argument is returned.

basicplx operator-(void) const
The negative of the argument is returned.

basicplx& setMArg(math_t mag, math_t arg)
The complex number is set to (mag*cos(arg), mag*sin(arg));

basicplx& xcc(const basicplx& rhs)
The Complex object is multiplied by the conjugate of the complex argument.

math_t MagSq(void) const
The square of the magnitude, i.e (x * ~x), is returned.

math_t Mag(void) const
The magnitude (i.e (x * ~x)^0.5) is returned.

math_t Arg(void) const
Return the argument in the range -pi -> pi.

T Real() const
the real part of the complex number is returned.

T Imag() const
The imaginary part of the complex number is returned.

void Swap(basicplx& x)
The argument and the object are swapped.


This class has no child classes.
Author:
John Zweizig
Version:
1.3; Modified 5/30/00

alphabetic index hierarchy of classes


generated by doc++