#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) |
| TComplex & | operator= (const TComplex &z) |
| TComplex & | operator= (const Double_t x) |
| TComplex & | operator+= (const Double_t &x) |
| TComplex & | operator+= (const TComplex &z) |
| TComplex & | operator-= (const Double_t &x) |
| TComplex & | operator-= (const TComplex &z) |
| TComplex & | operator/= (const Double_t &x) |
| TComplex & | operator/= (const TComplex &z) |
| TComplex & | operator *= (const Double_t &x) |
| TComplex & | operator *= (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) |
|
|
Definition at line 75 of file TComplex.h.
|
|
||||||||||||
|
Definition at line 76 of file TComplex.h.
|
|
|
Definition at line 77 of file TComplex.h.
|
|
|
Definition at line 258 of file TComplex.h.
|
|
|
Definition at line 84 of file TComplex.h. References fIm.
|
|
|
Referenced by IsA(). |
|
|
|
|
|
Definition at line 385 of file TComplex.h.
00385 { return 0; }
|
|
|
Definition at line 269 of file TComplex.h.
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 }
|
|
|
Definition at line 392 of file TComplex.h.
00392 { return __LINE__; }
|
|
|
Definition at line 391 of file TComplex.h.
00391 { return __FILE__; }
|
|
|
|
|
|
|
|
|
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 }
|
|
|
Definition at line 79 of file TComplex.h. References fIm.
00079 { return fIm; }
|
|
|
|
|
|
|
|
|
Definition at line 387 of file TComplex.h. References Class().
00387 { return TComplex::Class(); }
|
|
|
Definition at line 247 of file TComplex.h.
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 }
|
|
|
Definition at line 98 of file TComplex.h.
00098 {
00099 return Bool_t()&&Bool_t(z);
00100 }
|
|
|
Definition at line 326 of file TComplex.h.
|
|
|
Definition at line 320 of file TComplex.h.
|
|
|
Definition at line 226 of file TComplex.h.
|
|
|
Definition at line 219 of file TComplex.h.
|
|
|
Definition at line 90 of file TComplex.h.
|
|
|
Definition at line 91 of file TComplex.h. References fRe.
00091 { return fRe;};
|
|
|
Definition at line 92 of file TComplex.h. References fRe.
00092 { return Int_t(fRe);};
|
|
|
Definition at line 97 of file TComplex.h.
|
|
|
Definition at line 116 of file TComplex.h.
|
|
|
Definition at line 110 of file TComplex.h.
|
|
|
Definition at line 102 of file TComplex.h.
|
|
|
Definition at line 181 of file TComplex.h.
|
|
|
Definition at line 177 of file TComplex.h. References fRe.
00177 {
00178 fRe += x;
00179 return *this;
00180 }
|
|
|
Definition at line 146 of file TComplex.h.
|
|
|
Definition at line 139 of file TComplex.h.
|
|
|
Definition at line 131 of file TComplex.h.
|
|
|
Definition at line 124 of file TComplex.h.
|
|
|
Definition at line 192 of file TComplex.h.
|
|
|
Definition at line 188 of file TComplex.h. References fRe.
00188 {
00189 fRe -= x;
00190 return *this;
00191 }
|
|
|
Definition at line 350 of file TComplex.h.
|
|
|
Definition at line 343 of file TComplex.h.
|
|
|
Definition at line 334 of file TComplex.h.
|
|
|
Definition at line 207 of file TComplex.h.
|
|
|
Definition at line 201 of file TComplex.h.
|
|
|
Definition at line 168 of file TComplex.h.
|
|
|
Definition at line 160 of file TComplex.h.
|
|
|
Definition at line 80 of file TComplex.h.
00080 { return TMath::ATan2(fIm,fRe);};
|
|
|
|
|
|
Definition at line 86 of file TComplex.h. References fRe.
00086 { fRe = 0.0; }
|
|
|
Definition at line 85 of file TComplex.h. References fIm.
00085 { fIm = 0.0; }
|
|
|
Definition at line 78 of file TComplex.h. References fRe.
00078 { return fRe; }
|
|
||||||||||||
|
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 }
|
|
||||||||||||
|
Definition at line 81 of file TComplex.h.
|
|
|
Definition at line 83 of file TComplex.h. References fIm.
00083 { fIm = y; }
|
|
|
Definition at line 87 of file TComplex.h.
|
|
|
Definition at line 82 of file TComplex.h. References fRe.
00082 { fRe = x; }
|
|
||||||||||||
|
|
|
|
Referenced by StreamerNVirtual(). |
|
|
Definition at line 390 of file TComplex.h. References Streamer().
00390 { TComplex::Streamer(b); }
|
|
||||||||||||
|
|
|
|
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 }
|
|
|
Definition at line 470 of file TComplex.h.
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
||||||||||||
|
Definition at line 434 of file TComplex.h.
|
|
||||||||||||
|
Definition at line 430 of file TComplex.h.
|
|
||||||||||||
|
Definition at line 426 of file TComplex.h.
|
|
||||||||||||
|
Definition at line 422 of file TComplex.h.
|
|
||||||||||||
|
Definition at line 463 of file TComplex.h.
|
|
||||||||||||
|
Definition at line 456 of file TComplex.h.
|
|
||||||||||||
|
Definition at line 438 of file TComplex.h.
|
|
||||||||||||
|
Definition at line 413 of file TComplex.h.
|
|
||||||||||||
|
Definition at line 418 of file TComplex.h.
|
|
||||||||||||
|
Definition at line 442 of file TComplex.h.
|
|
||||||||||||
|
|
|
||||||||||||
|
Definition at line 459 of file TComplex.h.
|
|
||||||||||||
|
Definition at line 452 of file TComplex.h.
|
|
||||||||||||
|
|
|
|
Definition at line 67 of file TComplex.h. Referenced by TDSPVector::Phase().
|
|
||||||||||||
|
Definition at line 66 of file TComplex.h.
|
|
||||||||||||
|
Definition at line 65 of file TComplex.h.
|
|
||||||||||||||||
|
|
|
|
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 }
|
|
|
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 }
|
|
||||||||||||
|
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 }
|
|
|
1.3.2