Example #1
0
 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;
 }
Example #2
0
        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);
        }
Example #3
0
 public void CopyFrom(WWComplexF rhs)
 {
     real      = rhs.real;
     imaginary = rhs.imaginary;
 }
Example #4
0
 public WWComplexF Add(WWComplexF rhs)
 {
     real      += rhs.real;
     imaginary += rhs.imaginary;
     return(this);
 }
Example #5
0
 public WWComplexF(WWComplexF rhs)
 {
     this.real      = rhs.real;
     this.imaginary = rhs.imaginary;
 }
Example #6
0
 public void CopyFrom(WWComplexF rhs)
 {
     real      = rhs.real;
     imaginary = rhs.imaginary;
 }
Example #7
0
 public WWComplexF Add(WWComplexF rhs)
 {
     real      += rhs.real;
     imaginary += rhs.imaginary;
     return this;
 }
Example #8
0
 public WWComplexF(WWComplexF rhs)
 {
     this.real      = rhs.real;
     this.imaginary = rhs.imaginary;
 }