Back
//---------------------------------------------------------------------------
// N.V.Shokhirev
// created: 20041020
// modified: 20051020
// modified: 20060103 - switched to real
//---------------------------------------------------------------------------
#ifndef complexH
#define complexH
#include "MatUtils.h"
//---------------------------------------------------------------------------
class Complex {
public:
real Re, Im;
Complex::Complex(const Complex& c); //copy-constructor
Complex( real r = 0.0, real i = 0.0 ); //constructor
const Complex& operator=(const Complex& c);
const Complex& operator=(const real r);
Complex operator* (const Complex& c);
Complex operator/(const Complex& c);
Complex operator-(const Complex& c);
Complex operator+(const Complex& c);
//scalar math
Complex operator*(real r);
Complex operator/(real r);
Complex operator-(real r);
Complex operator+(real r);
//scalar math where scalars come first
friend Complex operator*(real r, const Complex& c);
friend Complex operator/(real r, const Complex& c);
friend Complex operator-(real r, const Complex& c);
friend Complex operator+(real r, const Complex& c);
//private:
};
real mod2(const Complex& c);
real mod(const Complex& c);
bool Equal(Complex c1, Complex c2, real eps = eps0);
bool Equal(Complex c1, real r, real i, real eps = eps0);
#endif
|