Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/Deprecated/Complex.old/COMPLEX.CPP File Reference

#include <j2k/Fred/Math/Complex.hpp>

Go to the source code of this file.

Functions

JComplexoperator *= (JComplex &x, const JComplex &y)
JComplexoperator/= (JComplex &x, const JComplex &y)
JComplex operator * (const JComplex &left, const JComplex &right)
JComplex operator/ (const JComplex &left, const JComplex &right)
CplxNumber Real (const CplxNumber &x)
CplxNumber Imag (const CplxNumber &y)
CplxNumber Real () const
CplxNumber Imag () const
JComplexoperator= (const CplxNumber &x)
JComplexoperator= (const JComplex &c)
JComplexoperator+= (const CplxNumber &x)
JComplexoperator+= (JComplex &x, const JComplex &y)
JComplexoperator-= (const CplxNumber &x)
JComplexoperator-= (JComplex &x, const JComplex &y)
JComplexoperator *= (const CplxNumber &x)
JComplexoperator/= (const CplxNumber &x)
BOOL Compare (const JComplex &l, const JComplex &r)
BOOL operator== (const JComplex &l, const JComplex &r)
BOOL operator!= (const Number &l, const Number &r)
CplxNumber _Infv (CplxNumber)
bool _Isinf (CplxNumber x)
bool _Isnan (CplxNumber x)
CplxNumber _Nanv (CplxNumber)

Variables

CplxNumber Real
CplxNumber Imag


Function Documentation

BOOL Compare const JComplex   l,
const JComplex   r
[static]
 

Definition at line 160 of file COMPLEX.CPP.

00160                                                               {            
00161     return ( (l.Real == r.Real) && (l.Imag == r.Imag) );                   
00162   }                                                                        

CplxNumber Imag   const
 

Definition at line 103 of file COMPLEX.CPP.

00103                            {                                               
00104       return (Imag);                                                       
00105    }                                                                       

CplxNumber Imag const CplxNumber   y
 

Definition at line 95 of file COMPLEX.CPP.

00095                                         {                                  
00096       return (Imag = y);                                                   
00097    }                                                                       

CplxNumber Real   const
 

Definition at line 99 of file COMPLEX.CPP.

00099                            {                                               
00100       return (Real);                                                       
00101    }                                                                       

CplxNumber Real const CplxNumber   x
 

Utilities /////////////////////////////////////////////////////////////////////////////.

Definition at line 91 of file COMPLEX.CPP.

00091                                         {                                  
00092       return (Real = x);                                                   
00093    }                                                                       

CplxNumber _Infv CplxNumber    [static]
 

Definition at line 207 of file COMPLEX.CPP.

00207                                        {                                   
00208      return ( _Inf._D );                                                   
00209    }                                                                       

bool _Isinf CplxNumber    x [static]
 

Definition at line 211 of file COMPLEX.CPP.

00211                                     {                                      
00212      double temp = (double)x;                                              
00213      return (_Dtest(&temp) == _INFCODE);                                   
00214    }                                                                       

bool _Isnan CplxNumber    x [static]
 

Definition at line 216 of file COMPLEX.CPP.

00216                                     {                                      
00217      double temp = (double)x;                                              
00218      return (_Dtest(&temp) == _NANCODE);                                   
00219    }                                                                       

CplxNumber _Nanv CplxNumber    [static]
 

Definition at line 221 of file COMPLEX.CPP.

00221                                        {                                   
00222      return (_Nan._D);                                                     
00223    }                                                                       

JComplex operator * const JComplex   left,
const JComplex   right
 

Definition at line 61 of file COMPLEX.CPP.

00061                                                                 {
00062   return JComplex (
00063    (left.Real * right.Real) - (left.Imag * right.Imag),
00064    (left.Real * right.Imag) + (left.Imag * right.Real)
00065   );
00066 }

JComplex& operator *= const CplxNumber   x
 

Definition at line 142 of file COMPLEX.CPP.

00142                                              {                             
00143       Real = Real * x;                                                     
00144       Imag = Imag * x;                                                     
00145       return (*this);                                                      
00146    }                                                                       

JComplex & operator *= JComplex   x,
const JComplex   y
 

Multiplication and Division operations /////////////////////////////////////////////////////////////////////////////.

Definition at line 22 of file COMPLEX.CPP.

00022                                                        {
00023    // Reminder: (a+bj)(c+dj) = (ac + bcj + adj + bdjj)
00024    // Result:   (ac - bd) + ( bc + ad )j
00025    // jj = -1, by definition.
00026 
00027    CplxNumber Temp_Re = (x.Real * y.Real) - (x.Imag * y.Imag);
00028    CplxNumber Temp_Im = (x.Imag * y.Real) + (x.Real * y.Imag);
00029 
00030    x.Real = Temp_Re;
00031    x.Imag = Temp_Im;
00032 
00033    return (x);
00034 }

friend BOOL operator!= const Number &    l,
const Number &    r
[inline]
 

Definition at line 168 of file COMPLEX.CPP.

00168                                                                     {      
00169     return !Compare( l, r );                                               
00170   }                                                                        

JComplex & operator+= JComplex   x,
const JComplex   y
 

Definition at line 125 of file COMPLEX.CPP.

00125                                                           {                
00126      x.Real = x.Real + y.Real;
00127      x.Imag = y.Imag + y.Imag;
00128      return (x);                                                           
00129    }                                                                       

JComplex& operator+= const CplxNumber   x
 

Definition at line 120 of file COMPLEX.CPP.

00120                                               {                            
00121       Real = Real + x;                                                     
00122       return (*this);                                                      
00123    }                                                                       

JComplex & operator-= JComplex   x,
const JComplex   y
 

Definition at line 136 of file COMPLEX.CPP.

00136                                                           {                
00137      x.Real = x.Real - y.Real;
00138      x.Imag = y.Imag - y.Imag;
00139      return (x);                                                           
00140    }                                                                       

JComplex& operator-= const CplxNumber   x
 

Definition at line 131 of file COMPLEX.CPP.

00131                                              {                             
00132       Real = Real - x;                                                     
00133       return (*this);                                                      
00134    }                                                                       

JComplex operator/ const JComplex   left,
const JComplex   right
 

Definition at line 78 of file COMPLEX.CPP.

00078                                                                 {
00079  const CplxDouble Tmp1 = right.Real / right.Imag;
00080  const CplxDouble Tmp2 = right.Imag + (Tmp1 * right.Real);
00081 
00082  return JComplex(
00083   ( (left.Real * Tmp1 + left.Imag) / Tmp2 ),
00084   ( (left.Imag * Tmp1 - left.Real) / Tmp2 )
00085  );
00086 }

JComplex& operator/= const CplxNumber   x
 

Definition at line 148 of file COMPLEX.CPP.

00148                                              {                             
00149       Real = Real / x;                                                     
00150       Imag = Imag / x;                                                     
00151       return (*this);                                                      
00152    }                                                                       

JComplex & operator/= JComplex   x,
const JComplex   y
 

Definition at line 36 of file COMPLEX.CPP.

00036                                                        {
00037    // Reminder: (a+bj)/(c+dj) = (a+bj)(c-dj) / [ (c+dj)(c-dj) ]
00038    // = (ac + bcj - adj - bdjj) / (cc - ddjj)
00039    // = [ (ac + bd) + ( bc - ad )j ] / [ cc + dd ]
00040    // jj = -1, by definition.
00041 
00042    // Doesn't handle Divide by Zero, but STL does it.
00043 
00044    CplxNumber Temp_delta = (y.Real * y.Real) + (y.Imag * y.Imag);
00045    CplxNumber Temp_Re    = (x.Real * y.Real) + (x.Imag * y.Imag);
00046    CplxNumber Temp_Im    = (x.Imag * y.Real) - (x.Real * y.Imag);
00047 
00048    x.Real = Temp_Re / Temp_delta;
00049    x.Imag = Temp_Im / Temp_delta;
00050 
00051    return (x);
00052 }

JComplex& operator= const JComplex   c
 

Definition at line 114 of file COMPLEX.CPP.

00114                                             {
00115       Real = c.Real;                                                       
00116       Imag = c.Imag;                                                       
00117       return (*this);                                                      
00118    }                                                                       

JComplex& operator= const CplxNumber   x
 

Definition at line 108 of file COMPLEX.CPP.

00108                                               {                            
00109       Real = x;                                                            
00110       Imag = 0;                                                            
00111       return (*this);                                                      
00112    }                                                                       

friend BOOL operator== const JComplex   l,
const JComplex   r
[inline]
 

Definition at line 164 of file COMPLEX.CPP.

00164                                                                         {  
00165     return Compare( l, r );                                                
00166   }                                                                        


Variable Documentation

CplxNumber Imag
 

Definition at line 156 of file COMPLEX.CPP.

CplxNumber Real
 

Definition at line 155 of file COMPLEX.CPP.


Generated on Sun Oct 14 18:47:04 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001