namespace AP { /******************************************************************** Class defining a complex number with double precision. ********************************************************************/ public struct Complex { public double x; public double y; public Complex(double _x) { x = _x; y = 0; } public Complex(double _x, double _y) { x = _x; y = _y; } public static implicit operator Complex(double _x) { return new Complex(_x); } public static bool operator==(Complex lhs, Complex rhs) { return (lhs.x==rhs.x) & (lhs.y==rhs.y); } public static bool operator!=(Complex lhs, Complex rhs) { return (lhs.x!=rhs.x) | (lhs.y!=rhs.y); } public static Complex operator+(Complex lhs) { return lhs; } public static Complex operator-(Complex lhs) { return new Complex(-lhs.x,-lhs.y); } public static Complex operator+(Complex lhs, Complex rhs) { return new Complex(lhs.x+rhs.x,lhs.y+rhs.y); } public static Complex operator-(Complex lhs, Complex rhs) { return new Complex(lhs.x-rhs.x,lhs.y-rhs.y); } public static Complex operator*(Complex lhs, Complex rhs) { return new Complex(lhs.x*rhs.x-lhs.y*rhs.y, lhs.x*rhs.y+lhs.y*rhs.x); } public static Complex operator/(Complex lhs, Complex rhs) { Complex result; double e; double f; if( System.Math.Abs(rhs.y)yabs ? xabs : yabs; v = xabs