public WWComplexF Mul(WWComplexF rhs) { #if false // straightforward but slow float tR = real * rhs.real - imaginary * rhs.imaginary; float tI = real * rhs.imaginary + imaginary * rhs.real; real = tR; imaginary = tI; #else // more efficient way float k1 = real * (rhs.real + rhs.imaginary); float k2 = rhs.imaginary * (real + imaginary); float k3 = rhs.real * (imaginary - real); real = k1 - k2; imaginary = k1 + k3; #endif return this; }
public WWComplexF Mul(WWComplexF rhs) { #if false // straightforward but slow float tR = real * rhs.real - imaginary * rhs.imaginary; float tI = real * rhs.imaginary + imaginary * rhs.real; real = tR; imaginary = tI; #else // more efficient way float k1 = real * (rhs.real + rhs.imaginary); float k2 = rhs.imaginary * (real + imaginary); float k3 = rhs.real * (imaginary - real); real = k1 - k2; imaginary = k1 + k3; #endif return(this); }
public void CopyFrom(WWComplexF rhs) { real = rhs.real; imaginary = rhs.imaginary; }
public WWComplexF Add(WWComplexF rhs) { real += rhs.real; imaginary += rhs.imaginary; return(this); }
public WWComplexF(WWComplexF rhs) { this.real = rhs.real; this.imaginary = rhs.imaginary; }
public WWComplexF Add(WWComplexF rhs) { real += rhs.real; imaginary += rhs.imaginary; return this; }