rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

DComplex Class Reference
[DComplex]

Complex class for compilers that do not have access to a native complex class. More...

#include <rw/rcomplex.h>

List of all members.

Public Member Functions

 DComplex ()
 DComplex (double r)
 DComplex (double r, double i)
void operator+= (const DComplex &a)
void operator-= (const DComplex &a)
void operator*= (const DComplex &a)
void operator/= (const DComplex &a)

Friends

int operator== (const DComplex &a, const DComplex &b)
int operator!= (const DComplex &a, const DComplex &b)
std::ostream & operator<< (std::ostream &s, const DComplex &a)
std::istream & operator>> (std::istream &s, DComplex &a)

Related Functions

(Note that these are not member functions.)



double real (const DComplex &a)
double imag (const DComplex &a)
double abs (const DComplex &a)
double norm (const DComplex &a)
double arg (const DComplex &a)
DComplex conj (const DComplex &a)
DComplex cos (const DComplex &a)
DComplex cosh (const DComplex &a)
DComplex exp (const DComplex &a)
DComplex log (const DComplex &a)
DComplex pow (double x, const DComplex &y)
DComplex pow (const DComplex &x, int y)
DComplex pow (const DComplex &x, double y)
DComplex pow (const DComplex &x, const DComplex &y)
DComplex polar (double r, double t=0)
DComplex sin (const DComplex &a)
DComplex sinh (const DComplex &a)
DComplex sqrt (const DComplex &a)
DComplex operator+ (const DComplex &a1, const DComplex &a2)
DComplex operator+ (double s, const DComplex &a2)
DComplex operator+ (const DComplex &a1, double s)
DComplex operator- (const DComplex &a)
DComplex operator- (const DComplex &a1, const DComplex &a2)
DComplex operator- (double s, const DComplex &a2)
DComplex operator- (const DComplex &a1, double s)
DComplex operator* (const DComplex &a1, const DComplex &a2)
DComplex operator* (const DComplex &a1, double s)
DComplex operator* (double s, const DComplex &a1)
DComplex operator/ (const DComplex &a1, const DComplex &a2)
DComplex operator/ (const DComplex &a1, double s)
DComplex operator/ (double s, const DComplex &a1)

Detailed Description

Note:
Class DComplex is used with compilers that do not have a native complex class. If you're using a Standard C++ Library build and a native complex class exists, DComplex expands to a typedef for std::complex<double>.

Synopsis

 #include <rw/dcomplex.h>
 DComplex a;

Constructor & Destructor Documentation

DComplex::DComplex (  )  [inline]

Unadorned constructor. The real and imaginary parts are initialized to 0.

DComplex::DComplex ( double  r  )  [inline]

Constructs a complex number with real part equal to r and imaginary part equal to 0.

DComplex::DComplex ( double  r,
double  i 
) [inline]

Constructs a complex number with real part equal to r and imaginary part equal to i.


Member Function Documentation

void DComplex::operator*= ( const DComplex a  ) 

Multiplies self by a, then returns the result.

this.real() replaced by: this.real() * a.real();

this.imag() replaced by: this.imag() * a.imag().

void DComplex::operator+= ( const DComplex a  )  [inline]

Adds a to self, then returns the result.

this.real() replaced by: this.real() + a.real();

this.imag() replaced by: this.imag() + a.imag().

void DComplex::operator-= ( const DComplex a  )  [inline]

Subtracts a from self, then returns the result.

this.real() replaced by: this.real() - a.real();

this.imag() replaced by: this.imag() - a.imag().

void DComplex::operator/= ( const DComplex a  ) 

Divides self by a, then returns the result.

this.real() replaced by: this.real() / a.real();

this.imag() replaced by: this.imag() / a.imag().


Friends And Related Function Documentation

double abs ( const DComplex a  )  [friend]

Returns the absolute value of a complex number as a double precision number: [norm( a ) = abs( a )2].

double arg ( const DComplex a  )  [friend]

Returns the argument in radians of a complex number as a double precision number.

DComplex conj ( const DComplex a  )  [friend]

Returns the complex conjugate of a complex number.

DComplex cos ( const DComplex a  )  [friend]

Returns the cosine of a complex number.

DComplex cosh ( const DComplex a  )  [friend]

Returns the hyperbolic cosine of a complex number.

DComplex exp ( const DComplex a  )  [friend]

Return the exponential of a complex number.

double imag ( const DComplex a  )  [friend]

Returns the imaginary part of a complex number as a double precision number.

DComplex log ( const DComplex a  )  [friend]

Return the principal value of the logarithm of a complex number.

double norm ( const DComplex a  )  [friend]

Returns the norm of a complex number as a double precision number: [norm( a ) = abs( a )2].

int operator!= ( const DComplex a,
const DComplex b 
) [friend]

Tests for inequality. For operator!=() to return 1, either a.real() == b.real() or a.imag() == b.imag() must be false.

DComplex operator* ( double  s,
const DComplex a1 
) [friend]

Returns the product of s and a1.

DComplex operator* ( const DComplex a1,
double  s 
) [friend]

Returns the product of a1 and s.

DComplex operator* ( const DComplex a1,
const DComplex a2 
) [friend]

Returns the product of a1 and a2.

DComplex operator+ ( const DComplex a1,
double  s 
) [friend]

Returns the sum of a1 and s.

DComplex operator+ ( double  s,
const DComplex a2 
) [friend]

Returns the sum of s and a2.

DComplex operator+ ( const DComplex a1,
const DComplex a2 
) [friend]

Returns the sum of a1 and a2.

DComplex operator- ( const DComplex a1,
double  s 
) [friend]

Returns the difference of a1 and s.

DComplex operator- ( double  s,
const DComplex a2 
) [friend]

Returns the difference of s and a2.

DComplex operator- ( const DComplex a1,
const DComplex a2 
) [friend]

Returns the difference of a1 and a2.

DComplex operator- ( const DComplex a  )  [friend]

Returns the inverse of a.

DComplex operator/ ( double  s,
const DComplex a1 
) [friend]

Returns the quotient of s and a1.

DComplex operator/ ( const DComplex a1,
double  s 
) [friend]

Returns the quotient of a1 and s.

DComplex operator/ ( const DComplex a1,
const DComplex a2 
) [friend]

Returns the quotient of a1 and a2.

std::ostream& operator<< ( std::ostream &  s,
const DComplex a 
) [friend]

Writes a complex number a to std::ostream s in the form:

( Re(a), Im(a) )

int operator== ( const DComplex a,
const DComplex b 
) [friend]

Tests for equality. For operator==() to return 1, both a.real() == b.real() and a.imag() == b.imag() must be true.

std::istream& operator>> ( std::istream &  s,
DComplex a 
) [friend]

Reads a complex number from std::istream s in any of the following forms:

u

( u )

or:

( u, v )

where u is the real part and v is the imaginary part of the number.

DComplex polar ( double  r,
double  t = 0 
) [friend]

For arguments r and t, where complex number a = reit, returns a complex number in Cartesian form.

DComplex pow ( const DComplex x,
const DComplex y 
) [friend]

Return x raised to the y power.

DComplex pow ( const DComplex x,
double  y 
) [friend]

Return x raised to the y power.

DComplex pow ( const DComplex x,
int  y 
) [friend]

Return x raised to the y power.

DComplex pow ( double  x,
const DComplex y 
) [friend]

Return x raised to the y power.

double real ( const DComplex a  )  [friend]

Returns the real part of a complex number as a double precision number.

DComplex sin ( const DComplex a  )  [friend]

Return the sine of a complex number.

DComplex sinh ( const DComplex a  )  [friend]

Return the hyperbolic sine of a complex number.

DComplex sqrt ( const DComplex a  )  [friend]

Return the principal value of the square root of a complex number.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.