1 #ifndef CMU462_COMPLEX_H
2 #define CMU462_COMPLEX_H
44 double r = 1.0/
norm2();
51 inline double arg( )
const {
59 return exp( x ) *
Complex( cos( y ), sin( y ));
63 inline void operator*=(
const Complex& z ) {
73 void operator/=(
const Complex& z ) {
80 double Re(
const Complex& z );
83 double Im(
const Complex& z );
86 inline Complex operator*(
const Complex& z1,
const Complex& z2 ) {
93 inline Complex operator/(
const Complex& z1,
const Complex& z2 ) {
100 std::ostream& operator<<( std::ostream& os,
const Complex& z );
104 #endif // CMU462_COMPLEX_H
Complex(const Vector2D &v)
Constructor.
Definition: complex.h:31
double norm2(void) const
Returns norm squared.
Definition: vector2D.h:103
double arg() const
Return argument.
Definition: complex.h:51
Represents complex numbers as 2D vectors of their real and imaginary components.
Definition: complex.h:12
Defines 2D vectors.
Definition: vector2D.h:12
Complex()
Constructor.
Definition: complex.h:19
Complex(double a, double b)
Constructor.
Definition: complex.h:25
Complex conj() const
Compute the complex conjugate.
Definition: complex.h:36
Complex inv() const
Compute the inverse.
Definition: complex.h:43
Complex exponential() const
Complex exponentiation.
Definition: complex.h:58