Complex class implements a set of data types, conversions, and operations for complex numbers. More...

`#include <Complex.h>`

## Public Member Functions | |

Complex () | |

Default constructor. | |

Complex (Real i) | |

Construct Complex from real part. | |

Complex (Real r, Real i) | |

Construct Complex from real and imaginary. | |

Real | r (Void) |

Get the real part of Complex number as a Real. | |

Real | i (Void) |

Get the imaginary part of the Complex number as a Real. | |

Void | r (Real r) |

Set the real part of Complex number. | |

Void | i (Real i) |

Set the imaginary part of Complex number. | |

Complex & | operator= (Const Real &x) |

Asignment operator for Complex = Real. | |

Bool | operator== (Const Complex &x) Const |

Equality operator for Complex == Complex. | |

Bool | operator!= (Const Complex &x) Const |

Inquality operator for Complex != Complex. | |

Bool | operator< (Const Complex &x) Const |

Less-than operator for Complex < Complex. | |

Bool | operator<= (Const Complex &x) Const |

Less-than or equal operator for Complex < Complex. | |

Bool | operator>= (Const Complex &x) Const |

Greater-than or equal operator for Complex < Complex. | |

Bool | operator> (Const Complex &x) Const |

Greater-than operator for Complex < Complex. | |

Complex | operator+ (Const Complex &c) |

Addition operator for Complex + Complex. | |

Complex | operator- (Const Complex &c) |

Subtraction operator for Complex - Complex. | |

Complex | operator- () |

Negation operator for Complex. | |

Complex | operator~ () |

Conjugation operator for Complex. | |

Complex | operator* (Const Complex &c) |

Multiplication operator for Complex * Complex. | |

Complex | operator* (Const Real &r) |

Multiplication operator for Complex * Real. | |

Complex | operator/ (Const Complex &c) |

Division operator for Complex / Complex. | |

Complex | operator/ (Const Real &r) |

Division operator for Complex / Real. | |

Complex & | operator+= (const Complex x) |

Increment operator for Complex += Complex. | |

Complex & | operator-= (const Complex x) |

Decrement operator for Complex -= Complex. | |

Complex & | operator*= (const Complex x) |

Multiply scale operator for Complex *= Complex. | |

Complex & | operator/= (const Complex x) |

Divide scale operator for Complex /= Complex. | |

Complex & | operator/= (const Real r) |

Divide scale operator for Complex /= Real. | |

Complex | Abs () |

Complex absolute value. | |

Complex | Conjugate () |

Complex conjugate. | |

Complex | Exp (Complex e) |

Complex exponentiation. | |

Void | print (String s=0) |

Print complex value, prepended by String s if not null. | |

## Friends | |

ostream & | operator<< (ostream &os, const Complex &c) |

Print to output stream. | |

istream & | operator>> (istream &is, Complex &c) |

Read from input stream. |

Complex class implements a set of data types, conversions, and operations for complex numbers.

Definition at line 27 of file Complex.h.

Complex::Complex | ( | Real | i ) |
` [inline]` |

Complex Complex::Abs | ( | ) | ` [inline]` |

Complex Complex::Conjugate | ( | ) | ` [inline]` |

Void Complex::i | ( | Real | i ) |
` [inline]` |

Real Complex::i | ( | Void | ) | ` [inline]` |

Get the imaginary part of the Complex number as a Real.

**Returns:**- The imaginary part of the complex number as a Real

Definition at line 78 of file Complex.h.

Referenced by ImagPart().

{

Complex Complex::operator- | ( | ) | ` [inline]` |

Negation operator for Complex.

Both real and imaginary parts are negated.

**See also:**- operator~()

Definition at line 139 of file Complex.h.

{

Complex Complex::operator~ | ( | ) | ` [inline]` |

Conjugation operator for Complex.

Only imaginary part is negated.

**See also:**- operator-()

Definition at line 145 of file Complex.h.

{

Void Complex::print | ( | String | s = `0` ) |
` [inline]` |

Void Complex::r | ( | Real | r ) |
` [inline]` |

Real Complex::r | ( | Void | ) | ` [inline]` |

Get the real part of Complex number as a Real.

**Returns:**- The real part of the complex number as a Real

Definition at line 72 of file Complex.h.

Referenced by i(), and RealPart().

{

ostream& operator<< | ( | ostream & | os, |

const Complex & | c |
||

) | ` [friend]` |

Print to output stream.

Complex number is printed as '(' <real_part> ',' <imag_part> ')'

Definition at line 27 of file Complex.h.

{ friend ostream& operator<<( ostream& os, const Complex& c ) { cout << "("; // cout.precision(2); // Use this to set precision, if desired cout << c.m_r << ", ";

istream& operator>> | ( | istream & | is, |

Complex & | c |
||

) | ` [friend]` |

Read from input stream.

Complex number is scanned as '{' <real_part> ',' <imag_part> '}' Alternately, parenthesis can be used to bracket complex number.

Definition at line 39 of file Complex.h.

{' <real_part> ',' <imag_part> '}' friend istream& operator>>( istream& is, Complex& c ) { char ch; is >> ch && (ch == '{' || ch == '(')

The documentation for this class was generated from the following file:

- /Users/garethloy/Musimathics/Musimat1.2/include/Complex.h

Generated on Fri Nov 26 2010 16:18:25 for MusimatLib by 1.7.2