Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals

TComplex Class Reference

#include <TComplex.h>


Public Member Functions

 TComplex ()
 TComplex (Double_t x, Double_t y=0)
 TComplex (const TComplex &z)
Double_t Re () const
Double_t Im () const
Double_t Phase ()
void Set (Double_t x, Double_t y)
void SetReal (Double_t x)
void SetIm (Double_t y)
void C ()
void PureReal ()
void PureIm ()
void SetNeg ()
void Dump ()
 operator Bool_t ()
 operator Double_t ()
 operator Int_t ()
Bool_t operator! ()
Bool_t operator && (TComplex &z)
TComplex operator+ (const TComplex &z)
TComplex operator+ (const Double_t x)
TComplex operator+ (const Int_t x)
TComplex operator- ()
TComplex operator- (const TComplex &z)
TComplex operator- (const Double_t x)
TComplex operator- (const Int_t x)
TComplexoperator= (const TComplex &z)
TComplexoperator= (const Double_t x)
TComplexoperator+= (const Double_t &x)
TComplexoperator+= (const TComplex &z)
TComplexoperator-= (const Double_t &x)
TComplexoperator-= (const TComplex &z)
TComplexoperator/= (const Double_t &x)
TComplexoperator/= (const TComplex &z)
TComplexoperator *= (const Double_t &x)
TComplexoperator *= (const TComplex &z)
void FromRhoPhi (TCplxRhoPhi &r)
Bool_t IsComplex (Double_t limreal)
void BetterConj (TComplex &z2)
void CosFromSin ()
void RPhi (Double_t &r, Double_t &phi)
TComplex operator * (const Double_t x)
TComplex operator * (const Int_t x)
TComplex operator/ (const TComplex &z)
TComplex operator/ (const Double_t x)
TComplex operator/ (const Int_t x)
void Print ()
void Test (Double_t, const TComplex &)
TClass * IsA () const
void ShowMembers (TMemberInspector &insp, char *parent)
void Streamer (TBuffer &b)
void StreamerNVirtual (TBuffer &b)

Static Public Member Functions

TClass * Class ()
const char * Class_Name ()
Version_t Class_Version ()
void Dictionary ()
const char * DeclFileName ()
int DeclFileLine ()
const char * ImplFileName ()
int ImplFileLine ()

Data Fields

TComplexBase fRe
TComplexBase fIm

Friends

TComplex operator+ (const Double_t, const TComplex &)
TComplex operator- (const Double_t, const TComplex &)
TComplex operator * (const Int_t, const TComplex &)
TComplex operator * (const Double_t, const TComplex &)
TComplex operator * (const TComplex &, const TComplex &)
TComplex operator * (TComplex &, TComplex &)
TComplex operator% (const TComplex &, const TComplex &)
TComplex operator/ (const Double_t, const TComplex &)
Bool_t operator== (const TComplex &, const TComplex &)
Bool_t operator!= (const TComplex &, const TComplex &)
Bool_t operator== (const TComplex &, const Double_t &)
Bool_t operator!= (const TComplex &, const Double_t &)
Double_t Abs (const TComplex &)
Double_t Abs2 (const TComplex &)
TComplex Sqrt (const TComplex &)
TComplex Sqrt3 (const TComplex &, Int_t)
TComplex Exp (const TComplex &)
TComplex Log (const TComplex &)
TComplex Log10 (const TComplex &)
TComplex Log2 (const TComplex &)
TComplex Sin (const TComplex &)
TComplex Cos (const TComplex &)
TComplex Power (const TComplex &z, Int_t n)
TComplex Power (const TComplex &z, Double_t x)
Double_t Phase (TComplex z)
istream & operator>> (istream &, TComplex &)
ostream & operator<< (ostream &, TComplex &)
void ROOT__ShowMembersFunc (TComplex *obj, TMemberInspector &R__insp, char *R__parent)


Constructor & Destructor Documentation

TComplex::TComplex  )  [inline]
 

Definition at line 75 of file TComplex.h.

References fIm, and fRe.

00075 { fRe=0.0; fIm =0.0; }

TComplex::TComplex Double_t  x,
Double_t  y = 0
[inline]
 

Definition at line 76 of file TComplex.h.

References fIm, and fRe.

00076 { fRe = x; fIm=y; }

TComplex::TComplex const TComplex z  )  [inline]
 

Definition at line 77 of file TComplex.h.

References fIm, and fRe.

00077 { fRe = z.fRe; fIm = z.fIm; }


Member Function Documentation

void TComplex::BetterConj TComplex z2  )  [inline]
 

Definition at line 258 of file TComplex.h.

References fIm, and fRe.

00258                                 {
00259     //Make this and z2 better complex conjugate
00260     const Double_t deux = 2.0;
00261     Double_t a,b;
00262     a = (fRe + z2.fRe)/deux;
00263     b = (fIm - z2.fIm)/deux;
00264     z2.fRe =  a;
00265     z2.fIm = -b;
00266     fRe    = a;
00267     fIm    = b;
00268   }

void TComplex::C  )  [inline]
 

Definition at line 84 of file TComplex.h.

References fIm.

00084 { fIm = - fIm; }

TClass* TComplex::Class  )  [static]
 

Referenced by IsA().

const char* TComplex::Class_Name  )  [static]
 

Version_t TComplex::Class_Version  )  [inline, static]
 

Definition at line 385 of file TComplex.h.

00385 { return 0; } 

void TComplex::CosFromSin  )  [inline]
 

Definition at line 269 of file TComplex.h.

References Abs(), and Sqrt.

00269                     {
00270     //  Given a complex number representing the sinus of a complex angle, returns
00271     //the complex value of the cosinus of the same complex angle. The value chosen
00272     //is the one with a positive real part, if the imaginary part is 0.
00273     //If the imaginary part is non-zero, the value chosen is the one with a
00274     //negative imaginary part. THE IMAGINARY PART OF THE RESULT IS ALWAYS CHOSEN
00275     //NEGATIVE IF IT IS NON-ZERO. This is an arbitrary choice motivated by the
00276     //fact that in Litrani, the phases of waves have to be negative when a wave
00277     //is absorbed, never positive which would correspond to an unphysical explosion
00278     //of the wave.
00279     const Double_t zero   = 0.0;
00280     const Double_t un     = 1.0;
00281     const Double_t vsmall = 1.0e-12;
00282     TComplex z;
00283     z = *this;z*=z;
00284     z = Sqrt(un - z);
00285     if (z.fIm>vsmall) z = zero - z;
00286     if (TMath::Abs(z.fIm)<=vsmall) z.fIm = zero;
00287     *this = z;
00288   }

int TComplex::DeclFileLine  )  [inline, static]
 

Definition at line 392 of file TComplex.h.

00392 { return __LINE__; } 

const char* TComplex::DeclFileName  )  [inline, static]
 

Definition at line 391 of file TComplex.h.

00391 { return __FILE__; } 

void TComplex::Dictionary  )  [static]
 

void TComplex::Dump  ) 
 

void TComplex::FromRhoPhi TCplxRhoPhi r  )  [inline]
 

Definition at line 238 of file TComplex.h.

References Cos(), fIm, fRe, TCplxRhoPhi::GetPhi(), TCplxRhoPhi::GetRho(), and Sin().

Referenced by Sqrt().

00238                                   {
00239     //returns from phase representation
00240     register Double_t rho;
00241     register Double_t phi;
00242     rho = r.GetRho();
00243     phi = r.GetPhi();
00244     fRe = rho*TMath::Cos(phi);
00245     fIm = rho*TMath::Sin(phi);
00246   }

Double_t TComplex::Im  )  const [inline]
 

Definition at line 79 of file TComplex.h.

References fIm.

00079 { return fIm; }

int TComplex::ImplFileLine  )  [static]
 

const char* TComplex::ImplFileName  )  [static]
 

TClass* TComplex::IsA  )  const [inline]
 

Definition at line 387 of file TComplex.h.

References Class().

00387 { return TComplex::Class(); } 

Bool_t TComplex::IsComplex Double_t  limreal  )  [inline]
 

Definition at line 247 of file TComplex.h.

References Abs(), and fIm.

00247                                      {
00248     //if the abs. value of the imaginary part is smaller than limreal, make the
00249     //number real and returns kFALSE else returns kTRUE.
00250     const Double_t zero = 0.0;
00251     Bool_t cplx = kTRUE;
00252     if (TMath::Abs(fIm)<TMath::Abs(limreal)) {
00253       fIm = zero;
00254       cplx = kFALSE;
00255     }
00256     return cplx;
00257   }

Bool_t TComplex::operator && TComplex z  )  [inline]
 

Definition at line 98 of file TComplex.h.

00098                                     {
00099     return Bool_t()&&Bool_t(z);
00100   }

TComplex TComplex::operator * const Int_t  x  )  [inline]
 

Definition at line 326 of file TComplex.h.

References fIm, and fRe.

00326                                     {
00327     TComplex z4;
00328     Double_t xx = x;
00329     z4.fRe = fRe*xx;
00330     z4.fIm = fIm*xx;
00331     return z4;
00332   }

TComplex TComplex::operator * const Double_t  x  )  [inline]
 

Definition at line 320 of file TComplex.h.

References fIm, and fRe.

00320                                        {
00321     TComplex z4;
00322     z4.fRe = fRe*x;
00323     z4.fIm = fIm*x;
00324     return z4;
00325   }

TComplex& TComplex::operator *= const TComplex z  )  [inline]
 

Definition at line 226 of file TComplex.h.

References fIm, and fRe.

00226                                           {
00227     //Multiply itself with a complex numbers
00228     register Double_t tmp =  fRe*z.fRe - fIm*z.fIm;
00229     fIm = fRe*z.fIm + fIm*z.fRe;
00230     fRe = tmp;
00231     return *this;
00232   }

TComplex& TComplex::operator *= const Double_t &  x  )  [inline]
 

Definition at line 219 of file TComplex.h.

References fIm, and fRe.

00219                                            {
00220     //Multiply itself with a float numbers
00221     fIm *=x;
00222     fRe *=x;
00223     return *this;
00224   }

TComplex::operator Bool_t  )  [inline]
 

Definition at line 90 of file TComplex.h.

References fIm, and fRe.

00090 { return fRe||fIm; };

TComplex::operator Double_t  )  [inline]
 

Definition at line 91 of file TComplex.h.

References fRe.

00091 { return fRe;};

TComplex::operator Int_t  )  [inline]
 

Definition at line 92 of file TComplex.h.

References fRe.

00092 { return Int_t(fRe);};

Bool_t TComplex::operator!  )  [inline]
 

Definition at line 97 of file TComplex.h.

References fIm, and fRe.

00097 { return (!fRe)&&(!fIm);};

TComplex TComplex::operator+ const Int_t  x  )  [inline]
 

Definition at line 116 of file TComplex.h.

References fIm, and fRe.

00116                                      {
00117     TComplex z4;
00118     z4.fRe = fRe + x;
00119     z4.fIm = fIm;
00120     return z4;
00121   }

TComplex TComplex::operator+ const Double_t  x  )  [inline]
 

Definition at line 110 of file TComplex.h.

References fIm, and fRe.

00110                                         {
00111     TComplex z4;
00112     z4.fRe = fRe + x;
00113     z4.fIm = fIm;
00114     return z4;
00115   }

TComplex TComplex::operator+ const TComplex z  )  [inline]
 

Definition at line 102 of file TComplex.h.

References fIm, and fRe.

00102                                          {
00103     //+ with other complex number
00104     TComplex z4;
00105     z4.fRe = fRe + z.fRe;
00106     z4.fIm = fIm + z.fIm;
00107     return z4;
00108   }

TComplex& TComplex::operator+= const TComplex z  )  [inline]
 

Definition at line 181 of file TComplex.h.

References fIm, and fRe.

00181                                           {
00182     //Add itself with a complex numbers
00183     fRe += z.fRe;
00184     fIm += z.fIm;
00185     return *this;
00186   }

TComplex& TComplex::operator+= const Double_t &  x  )  [inline]
 

Definition at line 177 of file TComplex.h.

References fRe.

00177                                           {
00178     fRe += x;
00179     return *this;
00180   }

TComplex TComplex::operator- const Int_t  x  )  [inline]
 

Definition at line 146 of file TComplex.h.

References fIm, and fRe.

00146                                      {
00147     //- with other complex number
00148     TComplex z4;
00149     z4.fRe = fRe - x;
00150     z4.fIm = fIm;
00151     return z4;
00152   }

TComplex TComplex::operator- const Double_t  x  )  [inline]
 

Definition at line 139 of file TComplex.h.

References fIm, and fRe.

00139                                         {
00140     //- with other complex number
00141     TComplex z4;
00142     z4.fRe = fRe - x;
00143     z4.fIm = fIm;
00144     return z4;
00145   }

TComplex TComplex::operator- const TComplex z  )  [inline]
 

Definition at line 131 of file TComplex.h.

References fIm, and fRe.

00131                                          {
00132     //+ with other complex number
00133     TComplex z4;
00134     z4.fRe = fRe - z.fRe;
00135     z4.fIm = fIm - z.fIm;
00136     return z4;
00137   }

TComplex TComplex::operator-  )  [inline]
 

Definition at line 124 of file TComplex.h.

References fIm, and fRe.

00124                         {
00125     TComplex z;
00126     z.fRe = -fRe;
00127     z.fIm  = -fIm;
00128     return z;
00129   }

TComplex& TComplex::operator-= const TComplex z  )  [inline]
 

Definition at line 192 of file TComplex.h.

References fIm, and fRe.

00192                                           {
00193     //Add itself with a complex numbers
00194     fRe -= z.fRe;
00195     fIm -= z.fIm;
00196     return *this;
00197   }

TComplex& TComplex::operator-= const Double_t &  x  )  [inline]
 

Definition at line 188 of file TComplex.h.

References fRe.

00188                                           {
00189     fRe -= x;
00190     return *this;
00191   }

TComplex TComplex::operator/ const Int_t  x  )  [inline]
 

Definition at line 350 of file TComplex.h.

References fIm, and fRe.

00350                                     {
00351     //division with other complex number
00352     TComplex z4;
00353     Double_t xx = x;
00354     z4.fRe = fRe/xx;
00355     z4.fIm = fIm/xx;
00356     return z4;
00357   }

TComplex TComplex::operator/ const Double_t  x  )  [inline]
 

Definition at line 343 of file TComplex.h.

References fIm, and fRe.

00343                                        {
00344     //division with other complex number
00345     TComplex z4;
00346     z4.fRe = fRe/x;
00347     z4.fIm = fIm/x;
00348     return z4;
00349   }

TComplex TComplex::operator/ const TComplex z  )  [inline]
 

Definition at line 334 of file TComplex.h.

References fIm, and fRe.

00334                                         {
00335     //division with other complex number
00336     TComplex z4;
00337     Double_t d;
00338     d = z.fRe*z.fRe + z.fIm*z.fIm;
00339     z4.fRe = (fRe*z.fRe + fIm*z.fIm)/d;
00340     z4.fIm = (fIm*z.fRe - fRe*z.fIm)/d;
00341     return z4;
00342   }

TComplex& TComplex::operator/= const TComplex z  )  [inline]
 

Definition at line 207 of file TComplex.h.

References fIm, and fRe.

00207                                           {
00208     Double_t tmp,d;
00209     d = z.fRe*z.fRe + z.fIm*z.fIm;
00210     tmp = (fRe*z.fRe + fIm*z.fIm)/d;
00211     fIm = (fIm*z.fRe - fRe*z.fIm)/d;
00212     fRe = tmp;
00213     
00214     return *this;
00215   }

TComplex& TComplex::operator/= const Double_t &  x  )  [inline]
 

Definition at line 201 of file TComplex.h.

References fIm, and fRe.

00201                                           {
00202     fRe /= x;
00203     fIm /= x;
00204     return *this;
00205   }

TComplex& TComplex::operator= const Double_t  x  )  [inline]
 

Definition at line 168 of file TComplex.h.

References fIm, and fRe.

00168                                         {
00169     //defines = for complex
00170     fRe = x;
00171     fIm = 0.0;
00172     return *this;
00173   }

TComplex& TComplex::operator= const TComplex z  )  [inline]
 

Definition at line 160 of file TComplex.h.

References fIm, and fRe.

00160                                          {
00161     //defines = for complex
00162     if (this != &z) {
00163       fRe = z.fRe;
00164       fIm = z.fIm;
00165     }
00166     return *this;
00167   }

Double_t TComplex::Phase  )  [inline]
 

Definition at line 80 of file TComplex.h.

References fIm, and fRe.

00080 { return TMath::ATan2(fIm,fRe);};

void TComplex::Print  ) 
 

void TComplex::PureIm  )  [inline]
 

Definition at line 86 of file TComplex.h.

References fRe.

00086 { fRe = 0.0; }

void TComplex::PureReal  )  [inline]
 

Definition at line 85 of file TComplex.h.

References fIm.

00085 { fIm = 0.0; }

Double_t TComplex::Re  )  const [inline]
 

Definition at line 78 of file TComplex.h.

References fRe.

00078 { return fRe; }

void TComplex::RPhi Double_t &  r,
Double_t &  phi
[inline]
 

Definition at line 289 of file TComplex.h.

References Abs(), fIm, fRe, Pi, and Sqrt().

00289                                         {
00290     //  Calculates module (with sign !) and phase of a complex number.
00291     //If the real part of the complex number is negativ, returns a negative module.
00292     //Advantage : in case of a negative real number, the module stays negative and
00293     //the phase 0. A negative real number is not considered as a non-real, complex
00294     //number with a phase of pi.
00295     const Double_t zero   = 0.0;
00296     const Double_t wsmall = 1.0e-300;
00297     Double_t axr,axi;
00298     axr = TMath::Abs(fRe);
00299     axi = TMath::Abs(fIm);
00300     if ((axr<wsmall) && (axi<wsmall)) {
00301       r   = zero;
00302       phi = zero;
00303     }
00304     else {
00305       r   = TMath::Sqrt(fRe*fRe+fIm*fIm);
00306       if (fRe<zero) r = -r;
00307       if (axi<wsmall) {
00308     phi = zero;
00309       }
00310       else {
00311     phi = atan2(fIm,fRe);
00312     if (fRe<zero) {
00313       if (fIm>=zero) phi = phi - TMath::Pi();
00314       else phi = phi + TMath::Pi();
00315     }
00316       }
00317     }
00318   }

void TComplex::Set Double_t  x,
Double_t  y
[inline]
 

Definition at line 81 of file TComplex.h.

References fIm, and fRe.

00081 { fRe = x; fIm = y; }

void TComplex::SetIm Double_t  y  )  [inline]
 

Definition at line 83 of file TComplex.h.

References fIm.

00083 { fIm = y; }

void TComplex::SetNeg  )  [inline]
 

Definition at line 87 of file TComplex.h.

References fIm, and fRe.

00087 { fRe = -fRe; fIm = -fIm; }

void TComplex::SetReal Double_t  x  )  [inline]
 

Definition at line 82 of file TComplex.h.

References fRe.

00082 { fRe = x; }

void TComplex::ShowMembers TMemberInspector &  insp,
char *  parent
 

void TComplex::Streamer TBuffer &  b  ) 
 

Referenced by StreamerNVirtual().

void TComplex::StreamerNVirtual TBuffer &  b  )  [inline]
 

Definition at line 390 of file TComplex.h.

References Streamer().

00390 { TComplex::Streamer(b); } 

void TComplex::Test Double_t  ,
const TComplex
 


Friends And Related Function Documentation

Double_t Abs const TComplex z  )  [friend]
 

Definition at line 466 of file TComplex.h.

00466                                        {
00467 //Calculates the absolute value of a complex number
00468   return TMath::Sqrt(Abs2(z));
00469 }

Double_t Abs2 const TComplex z  )  [friend]
 

Definition at line 470 of file TComplex.h.

00470                                         {
00471 //Calculates the absolute value of a complex number
00472   return z.fRe*z.fRe + z.fIm*z.fIm;
00473 }

TComplex Cos const TComplex z  )  [friend]
 

Definition at line 588 of file TComplex.h.

00588                                        {
00589 //Calculates the cosinus of a complex number
00590   const Double_t un   = 1.0;
00591   const Double_t deux = 2.0;
00592   TComplex zz;
00593   Double_t a,b;
00594   a = TMath::Exp(z.fIm);
00595   b = un/a;
00596   zz.fRe = ((a+b)*TMath::Cos(z.fRe))/deux;
00597   zz.fIm = ((b-a)*TMath::Sin(z.fRe))/deux;
00598   return zz;
00599 }

TComplex Exp const TComplex z  )  [friend]
 

Definition at line 540 of file TComplex.h.

00540                                        {
00541 //Calculates the exponential of a complex number
00542   register Double_t ex;
00543   TComplex zz;
00544   ex = TMath::Exp(z.fRe);
00545   zz.fRe = ex*TMath::Cos(z.fIm);
00546   zz.fIm = ex*TMath::Sin(z.fIm);
00547   return zz;
00548 }

TComplex Log const TComplex z  )  [friend]
 

Definition at line 550 of file TComplex.h.

00550                                        {
00551 //Calculates the logarithm of a complex number
00552   TComplex zz;
00553   TCplxRhoPhi r(z.fRe,z.fIm);
00554   zz.fRe = TMath::Log(r.GetRho());
00555   zz.fIm = r.GetPhi();
00556   return zz;
00557 }

TComplex Log10 const TComplex z  )  [friend]
 

Definition at line 566 of file TComplex.h.

00566                                          {
00567 //Calculates the logarithm of a complex number
00568   TComplex zz;
00569   TCplxRhoPhi r(z.fRe,z.fIm);
00570   zz.fRe = TMath::Log10(r.GetRho());
00571   zz.fIm = r.GetPhi();
00572   return zz;
00573 }

TComplex Log2 const TComplex z  )  [friend]
 

Definition at line 558 of file TComplex.h.

00558                                         {
00559 //Calculates the logarithm of a complex number
00560   TComplex zz;
00561   TCplxRhoPhi r(z.fRe,z.fIm);
00562   zz.fRe = TMath::Log2(r.GetRho());
00563   zz.fIm = r.GetPhi();
00564   return zz;
00565 }

TComplex operator * TComplex x,
TComplex y
[friend]
 

Definition at line 434 of file TComplex.h.

00434                                                       {
00435 //multiplication of a complex by a complex
00436   return TComplex(x.fRe*y.fRe - x.fIm*y.fIm,x.fRe*y.fIm + x.fIm*y.fRe);
00437 }

TComplex operator * const TComplex x,
const TComplex y
[friend]
 

Definition at line 430 of file TComplex.h.

00430                                                                   {
00431 //multiplication of a complex by a complex
00432   return TComplex(x.fRe*y.fRe - x.fIm*y.fIm,x.fRe*y.fIm + x.fIm*y.fRe);
00433 }

TComplex operator * const Double_t  x,
const TComplex z
[friend]
 

Definition at line 426 of file TComplex.h.

00426                                                                  {
00427 //multiplication of a real by a complex
00428   return TComplex(x*z.fRe,x*z.fIm);
00429 }

TComplex operator * const Int_t  x,
const TComplex z
[friend]
 

Definition at line 422 of file TComplex.h.

00422                                                               {
00423 //multiplication of a real by a complex
00424   return TComplex(x*z.fRe,x*z.fIm);
00425 }

Bool_t operator!= const TComplex z1,
const Double_t &  d
[friend]
 

Definition at line 463 of file TComplex.h.

00463                                                                  {
00464   return ((z1.fRe!=d)||(z1.fIm!=0.0));
00465 }

Bool_t operator!= const TComplex z1,
const TComplex z2
[friend]
 

Definition at line 456 of file TComplex.h.

00456                                                                   {
00457   return ((z1.fRe!=z2.fRe)||(z1.fIm!=z2.fIm));
00458 }

TComplex operator% const TComplex x,
const TComplex y
[friend]
 

Definition at line 438 of file TComplex.h.

00438                                                                   {
00439 //multiplication of a complex-transposed by a complex
00440   return TComplex(x.fRe*y.fRe + x.fIm*y.fIm,x.fRe*y.fIm - x.fIm*y.fRe);
00441 }

TComplex operator+ const Double_t  x,
const TComplex z
[friend]
 

Definition at line 413 of file TComplex.h.

00413                                                                  {
00414 //addition of a real and a complex
00415   return TComplex(x + z.fRe,z.fIm);
00416 }

TComplex operator- const Double_t  x,
const TComplex z
[friend]
 

Definition at line 418 of file TComplex.h.

00418                                                                  {
00419 //substraction of a complex from a real
00420   return TComplex(x - z.fRe,-z.fIm);
00421 }

TComplex operator/ const Double_t  x,
const TComplex z
[friend]
 

Definition at line 442 of file TComplex.h.

00442                                                                  {
00443 //division of a real by a complex
00444   TComplex z4;
00445   Double_t d;
00446   d = z.fRe*z.fRe + z.fIm*z.fIm;
00447   z4.fRe =  (x*z.fRe)/d;
00448   z4.fIm = -(x*z.fIm)/d;
00449   return z4;
00450 }

ostream& operator<< ostream &  ,
TComplex
[friend]
 

Bool_t operator== const TComplex z1,
const Double_t &  d
[friend]
 

Definition at line 459 of file TComplex.h.

00459                                                                  {
00460   return ((z1.fRe==d)&&(z1.fIm==0.0));
00461 }

Bool_t operator== const TComplex z1,
const TComplex z2
[friend]
 

Definition at line 452 of file TComplex.h.

00452                                                                   {
00453   return ((z1.fRe==z2.fRe)&&(z1.fIm==z2.fIm));
00454 }

istream& operator>> istream &  ,
TComplex
[friend]
 

Double_t Phase TComplex  z  )  [friend]
 

Definition at line 67 of file TComplex.h.

Referenced by TDSPVector::Phase().

00067 { return TMath::ATan2(z.fIm,z.fRe);};

TComplex Power const TComplex z,
Double_t  x
[friend]
 

Definition at line 66 of file TComplex.h.

00066 { return Exp(x*Log(z)); }

TComplex Power const TComplex z,
Int_t  n
[friend]
 

Definition at line 65 of file TComplex.h.

00065 { return Exp(n*Log(z)); }

void ROOT__ShowMembersFunc TComplex obj,
TMemberInspector &  R__insp,
char *  R__parent
[friend]
 

TComplex Sin const TComplex z  )  [friend]
 

Definition at line 575 of file TComplex.h.

00575                                        {
00576 //Calculates the sinus of a complex number
00577   const Double_t un   = 1.0;
00578   const Double_t deux = 2.0;
00579   TComplex zz;
00580   Double_t a,b;
00581   a = TMath::Exp(z.fIm);
00582   b = un/a;
00583   zz.fRe = ((a+b)*TMath::Sin(z.fRe))/deux;
00584   zz.fIm = ((a-b)*TMath::Cos(z.fRe))/deux;
00585   return zz;
00586 }

TComplex Sqrt const TComplex z  )  [friend]
 

Definition at line 475 of file TComplex.h.

Referenced by CosFromSin().

00475                                         {
00476 //Calculates the square root of a complex number
00477   const Double_t zero = 0.0;
00478   TComplex zz;
00479   if (z.fRe >= zero) {
00480     TCplxRhoPhi r(z.fRe,z.fIm);
00481     r.Sqrt();
00482     zz.FromRhoPhi(r);
00483   }
00484   else {
00485     TCplxRhoPhi r(-z.fRe,-z.fIm);
00486     r.Sqrt();
00487     zz.FromRhoPhi(r);
00488     TComplex j(0,1);
00489     //zz = zz*j;
00490     zz*=j;
00491   }
00492   return zz;
00493 }

TComplex Sqrt3 const TComplex z,
Int_t  k
[friend]
 

Definition at line 495 of file TComplex.h.

00495                                                  {
00496 //
00497 //  Calculates the cubic root of a complex number.
00498 //  If the real part is negative, calculates the cubic root of minus the complex
00499 //number and then changes the sign of the solution.
00500 //  There are 3 possible solutions. k decides which one is taken :
00501 //    - k = 0  ==>  phi --> phi/3
00502 //    - k = 1  ==>  phi --> (phi+2pi)/3
00503 //    - k = 2  ==>  phi --> (phi-2pi)/3
00504 //
00505   const Double_t zero   = 0.0;
00506   const Double_t deux   = 2.0;
00507   const Double_t trois  = 3.0;
00508   const Double_t small  = 1.0e-7;
00509   const Double_t wsmall = 1.0e-300;
00510   Double_t rho,phi;
00511   Bool_t isreal,isneg;
00512   TComplex z1,zz;
00513   isreal = (TMath::Abs(z.fIm)<wsmall);
00514   isneg  = (z.fRe<zero);
00515   if (isneg) z1 = zero - z;
00516   else       z1 = z;
00517   k      = k % 3;
00518   TCplxRhoPhi r(z1.fRe,z1.fIm);
00519   rho = r.GetRho();
00520   phi = r.GetPhi();
00521   rho = TMath::Exp(TMath::Log(rho)/trois);
00522   switch (k) {
00523   case 0:
00524     phi = phi/trois;
00525     break;
00526   case 1:
00527     phi = (phi + deux*TMath::Pi())/trois;
00528     break;
00529   case 2:
00530     phi = (phi - deux*TMath::Pi())/trois;
00531     break;
00532   }
00533   zz.fRe = rho*TMath::Cos(phi);
00534   zz.fIm = rho*TMath::Sin(phi);
00535   if (isreal && (TMath::Abs(zz.fIm)<small)) zz.fIm = zero;
00536   if (isneg) zz = zero - zz;
00537   return zz;
00538 }


Field Documentation

TComplexBase TComplex::fIm
 

Definition at line 74 of file TComplex.h.

Referenced by Abs2(), TDSPVector::Adjoint(), TDSPMatrix::Adjoint(), TDSPVector::AdjointMe(), BetterConj(), C(), TDSPStochasticScalar::ChangeRepresentation(), Cos(), TDSPFastQpsk::DetectSymbol(), TDSPVector::Dot2(), Exp(), FromRhoPhi(), Im(), IsComplex(), Log(), Log10(), Log2(), TDSPVector::MaxAbs2(), TDSPVector::MaxImag(), TDSPVector::MinAbs2(), TDSPVector::MinImag(), operator *(), operator *(), operator *=(), operator Bool_t(), operator!(), operator!=(), operator%(), operator+(), operator+(), operator+=(), operator-(), operator-(), operator-=(), operator/(), operator/(), operator/=(), operator=(), operator==(), Phase(), PureReal(), TDSPVector::RandN(), TDSPVector::RandNimag(), TDSPVector::RandRayleigh(), RPhi(), TDSPVector::Set(), TDSPFifo::Set(), Set(), SetIm(), TDSPVector::SetImag(), SetNeg(), Sin(), Sqrt(), Sqrt3(), TDSPVector::SqrtImag(), and TComplex().

TComplexBase TComplex::fRe
 

Definition at line 73 of file TComplex.h.

Referenced by Abs2(), TDSPVector::Adjoint(), TDSPMatrix::Adjoint(), BetterConj(), TDSPStochasticScalar::ChangeRepresentation(), Cos(), TDSPFastQpsk::DetectSymbol(), TDSPFastBpsk::DetectSymbol(), TDSPVector::Dot2(), Exp(), FromRhoPhi(), Log(), Log10(), Log2(), TDSPVector::MaxAbs2(), TDSPVector::MaxReal(), TDSPVector::MinAbs2(), TDSPVector::MinReal(), operator *(), operator *(), operator *=(), operator Bool_t(), operator Double_t(), operator Int_t(), operator!(), operator!=(), operator%(), operator+(), operator+(), operator+=(), operator-(), operator-(), operator-=(), operator/(), operator/(), operator/=(), operator=(), operator==(), Phase(), PureIm(), TDSPVector::RandN(), TDSPVector::RandNreal(), TDSPVector::RandRayleigh(), Re(), RPhi(), TDSPVector::Set(), TDSPFifo::Set(), Set(), SetNeg(), TDSPVector::SetReal(), SetReal(), Sin(), TDSPVector::Sqr(), Sqrt(), Sqrt3(), TDSPVector::SqrtReal(), and TComplex().


The documentation for this class was generated from the following file:
Generated on Fri Apr 23 16:23:48 2004 by doxygen 1.3.2