1 #ifndef CMU462_COMPLEX_H
2 #define CMU462_COMPLEX_H
45 double r = 1.0/
norm2();
52 inline double arg( )
const {
60 return exp( x ) *
Complex( cos( y ), sin( y ));
64 inline void operator*=(
const Complex& z ) {
74 void operator/=(
const Complex& z ) {
81 double Re(
const Complex& z );
84 double Im(
const Complex& z );
87 inline Complex operator*(
const Complex& z1,
const Complex& z2 ) {
94 inline Complex operator/(
const Complex& z1,
const Complex& z2 ) {
101 std::ostream& operator<<( std::ostream& os,
const Complex& z );
105 #endif // CMU462_COMPLEX_H
Complex(const Vector2D &v)
Constructor.
Definition: complex.h:32
double norm2(void) const
Returns norm squared.
Definition: vector2D.h:105
double arg() const
Return argument.
Definition: complex.h:52
Represents complex numbers as 2D vectors of their real and imaginary components.
Definition: complex.h:13
Defines 2D vectors.
Definition: vector2D.h:14
Complex()
Constructor.
Definition: complex.h:20
Complex(double a, double b)
Constructor.
Definition: complex.h:26
Complex conj() const
Compute the complex conjugate.
Definition: complex.h:37
Complex inv() const
Compute the inverse.
Definition: complex.h:44
Complex exponential() const
Complex exponentiation.
Definition: complex.h:59