#include <Complex.h>
Public Member Functions | |
Complex () | |
Creates an object and initializes it to (0,0). | |
Complex (double re, double im) | |
Creates and initializes this object. | |
Complex (const Complex &rhs) | |
Creates an new instance of this object which is equal to another instance. | |
double | real () |
Real part of this number. | |
double | imaginary () |
Imaginary part of this number. | |
void | operator= (const Complex &rhs) |
Sets two complex numbers equal. | |
void | operator= (const double &rhs) |
Sets a complex number and a real number equal. | |
Complex | operator+ (const Complex &rhs) |
Adds two complex numbers. | |
Complex | operator+ (const double &rhs) |
Adds a complex and a real number. | |
Complex | operator- (const Complex &rhs) |
Subtracts two complex numbers. | |
Complex | operator- (const double &rhs) |
Subtracts a complex and a real number. | |
Complex | operator* (const Complex &rhs) |
Multiplies two complex number. | |
Complex | operator* (const double &rhs) |
Multiplies a complex and a real number. | |
Complex | operator/ (const Complex &rhs) |
Divides two complex numbers. | |
Complex | conjugate () |
Calculates the complex conjugate of this number. | |
double | abs () |
Calculates the magniutde of this complex number. | |
Complex | squareroot () |
Calculates the square root of this complex number. | |
Private Attributes | |
double | re |
double | im |
Friends | |
ostream & | operator<< (ostream &strm, Complex &c) |
Write the number to an output stream. |
Definition at line 25 of file Complex.h.
Complex::Complex | ( | ) |
Complex::Complex | ( | double | re, | |
double | im | |||
) |
Creates and initializes this object.
re | real part of this number. | |
im | imaginary part of this number. |
Definition at line 21 of file Complex.cpp.
Complex::Complex | ( | const Complex & | rhs | ) |
Creates an new instance of this object which is equal to another instance.
rhs | object this new object will be set equal to. |
Definition at line 27 of file Complex.cpp.
double Complex::real | ( | ) |
Real part of this number.
Definition at line 32 of file Complex.cpp.
References re.
Referenced by Polynomial::laguer(), operator<<(), and Polynomial::zroots().
double Complex::imaginary | ( | ) |
Imaginary part of this number.
Definition at line 37 of file Complex.cpp.
References im.
Referenced by Polynomial::laguer(), operator<<(), and Polynomial::zroots().
void Complex::operator= | ( | const Complex & | rhs | ) |
Sets two complex numbers equal.
number to set this one equal to.
Definition at line 42 of file Complex.cpp.
void Complex::operator= | ( | const double & | rhs | ) |
Sets a complex number and a real number equal.
number to set this one equal to.
Definition at line 48 of file Complex.cpp.
Complex Complex::operator+ | ( | const double & | rhs | ) |
Adds a complex and a real number.
Definition at line 64 of file Complex.cpp.
Subtracts two complex numbers.
Definition at line 74 of file Complex.cpp.
Complex Complex::operator- | ( | const double & | rhs | ) |
Subtracts a complex and a real number.
Definition at line 84 of file Complex.cpp.
Multiplies two complex number.
Definition at line 94 of file Complex.cpp.
Complex Complex::operator* | ( | const double & | rhs | ) |
Multiplies a complex and a real number.
Definition at line 104 of file Complex.cpp.
Divides two complex numbers.
Definition at line 114 of file Complex.cpp.
Complex Complex::conjugate | ( | ) |
Calculates the complex conjugate of this number.
Definition at line 136 of file Complex.cpp.
double Complex::abs | ( | ) |
Calculates the magniutde of this complex number.
Definition at line 146 of file Complex.cpp.
Referenced by Polynomial::laguer().
Complex Complex::squareroot | ( | ) |
Calculates the square root of this complex number.
Definition at line 174 of file Complex.cpp.
Referenced by Polynomial::laguer().
ostream& operator<< | ( | ostream & | strm, | |
Complex & | c | |||
) | [friend] |
double Complex::re [private] |
Definition at line 28 of file Complex.h.
Referenced by abs(), Complex(), conjugate(), operator*(), operator+(), operator-(), operator/(), operator=(), real(), and squareroot().
double Complex::im [private] |
Definition at line 29 of file Complex.h.
Referenced by abs(), Complex(), conjugate(), imaginary(), operator*(), operator+(), operator-(), operator/(), operator=(), and squareroot().