Complex operator-(double b, const Complex & a) { return Complex(b - a.real(), -a.imag()); }
Complex operator*(double a, const Complex & b) { return Complex(a * b.real(), a * b.imag()); }
Complex Complex::operator-(const Complex & a) const { return Complex(real() - a.real(), imag() - a.imag()); }
Complex operator+(const Complex & a, const Complex & b) { return Complex(a.real() + b.real(), a.imag() + b.imag()); }
bool Complex::operator>=(const Complex & a) const { if (real() >= a.real() || imag() >= a.imag()) return true; else return false; }
Complex exp(const Complex & a) { double r = exp(a.real()), theta = a.imag(); Complex temp(r * cos(theta), r * sin(theta)); return temp; }
void NCO::getIQ(Complex& c) { c.real(m_table[m_phase]); c.imag(-m_table[(m_phase + TableSize / 4) % TableSize]); }
bool operator==(Complex z1, Complex z2){ if ((z1.imag() == z2.imag()) && (z1.real() == z2.imag())) return true; else return false; }