In file complex/Complex.hh:

template <class T> class basicplx

Complex number template class.

Inheritance:


Public Methods

basicplx ()
Default constructor.
~basicplx ()
Destructor.
template <class U> basicplx (const basicplx<U>& rhs)
Copy constructor.
basicplx (T Re, T Im=0.0)
Initializing constructor.
template <class U> basicplx& operator= (const basicplx<U>& 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_type rhs)
Complex * float.
basicplx& operator/= (const basicplx &rhs)
Complex / Complex.
basicplx& operator/= (math_type rhs)
Complex / float.
bool operator== (const basicplx& y) const
Compare two complex numbers.
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_type mag, math_type arg)
Set a complex from magnitude and argument.
basicplx& xcc (const basicplx& rhs)
Multiply by ~arg.
math_type MagSq (void) const
Magnitude Squared.
math_type Mag (void) const
Magnitude.
math_type 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()
Destroy a complex number.

template <class U> basicplx(const basicplx<U>& 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.

template <class U> basicplx& operator=(const basicplx<U>& 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_type 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_type 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!=(const basicplx& y) const
Evaluates to true if the lhs is unequal 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_type mag, math_type 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_type MagSq(void) const
The square of the magnitude, i.e (x * ~x), is returned.

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

math_type 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


Please send questions and comments to zweizig_j@ligo.caltech.edu


generated by doc++