BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtComplex Class Reference

#include <EvtComplex.hh>

Public Member Functions

 EvtComplex ()
 
 EvtComplex (double rpart, double ipart=0.0)
 
 EvtComplex (const EvtComplex &c)
 
EvtComplexoperator*= (double d)
 
EvtComplexoperator/= (double d)
 
EvtComplexoperator*= (EvtComplex c)
 
EvtComplexoperator/= (EvtComplex c)
 
EvtComplexoperator= (const EvtComplex &c)
 
EvtComplexoperator+= (const EvtComplex &c)
 
EvtComplexoperator-= (const EvtComplex &c)
 
EvtComplexoperator+= (double d)
 
EvtComplexoperator-= (double d)
 
int operator== (const EvtComplex c)
 
int operator!= (const EvtComplex c)
 
 EvtComplex ()
 
 EvtComplex (double rpart, double ipart=0.0)
 
 EvtComplex (const EvtComplex &c)
 
EvtComplexoperator*= (double d)
 
EvtComplexoperator/= (double d)
 
EvtComplexoperator*= (EvtComplex c)
 
EvtComplexoperator/= (EvtComplex c)
 
EvtComplexoperator= (const EvtComplex &c)
 
EvtComplexoperator+= (const EvtComplex &c)
 
EvtComplexoperator-= (const EvtComplex &c)
 
EvtComplexoperator+= (double d)
 
EvtComplexoperator-= (double d)
 
int operator== (const EvtComplex c)
 
int operator!= (const EvtComplex c)
 

Friends

EvtComplex operator* (double d, const EvtComplex &c)
 
EvtComplex operator* (const EvtComplex &c, double d)
 
EvtComplex operator/ (const EvtComplex &c, double d)
 
EvtComplex operator/ (double d, const EvtComplex &c)
 
EvtComplex operator* (const EvtComplex &c1, const EvtComplex &c2)
 
EvtComplex operator/ (const EvtComplex &c1, const EvtComplex &c2)
 
EvtComplex operator+ (const EvtComplex &c1, const EvtComplex &c2)
 
EvtComplex operator- (const EvtComplex &c1, const EvtComplex &c2)
 
EvtComplex operator- (const EvtComplex &c)
 
EvtComplex conj (const EvtComplex &c)
 
double abs (const EvtComplex &c)
 
double abs2 (const EvtComplex &c)
 
double arg (const EvtComplex &c)
 
double real (const EvtComplex &c)
 
double imag (const EvtComplex &c)
 
EvtComplex exp (const EvtComplex &c)
 
std::ostream & operator<< (std::ostream &s, const EvtComplex &c)
 
EvtComplex operator* (double d, const EvtComplex &c)
 
EvtComplex operator* (const EvtComplex &c, double d)
 
EvtComplex operator/ (const EvtComplex &c, double d)
 
EvtComplex operator/ (double d, const EvtComplex &c)
 
EvtComplex operator* (const EvtComplex &c1, const EvtComplex &c2)
 
EvtComplex operator/ (const EvtComplex &c1, const EvtComplex &c2)
 
EvtComplex operator+ (const EvtComplex &c1, const EvtComplex &c2)
 
EvtComplex operator- (const EvtComplex &c1, const EvtComplex &c2)
 
EvtComplex operator- (const EvtComplex &c)
 
EvtComplex conj (const EvtComplex &c)
 
double abs (const EvtComplex &c)
 
double abs2 (const EvtComplex &c)
 
double arg (const EvtComplex &c)
 
double real (const EvtComplex &c)
 
double imag (const EvtComplex &c)
 
EvtComplex exp (const EvtComplex &c)
 
std::ostream & operator<< (std::ostream &s, const EvtComplex &c)
 

Detailed Description

Constructor & Destructor Documentation

◆ EvtComplex() [1/6]

EvtComplex::EvtComplex ( )
inline

Definition at line 49 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

49:_rpart(0.0),_ipart(0.0){}

◆ EvtComplex() [2/6]

EvtComplex::EvtComplex ( double  rpart,
double  ipart = 0.0 
)
inline

Definition at line 50 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

50:_rpart(rpart),_ipart(ipart){}

◆ EvtComplex() [3/6]

EvtComplex::EvtComplex ( const EvtComplex c)
inline

Definition at line 51 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

51:_rpart(c._rpart),_ipart(c._ipart){}

◆ EvtComplex() [4/6]

EvtComplex::EvtComplex ( )
inline

Definition at line 49 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

49:_rpart(0.0),_ipart(0.0){}

◆ EvtComplex() [5/6]

EvtComplex::EvtComplex ( double  rpart,
double  ipart = 0.0 
)
inline

Definition at line 50 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

50:_rpart(rpart),_ipart(ipart){}

◆ EvtComplex() [6/6]

EvtComplex::EvtComplex ( const EvtComplex c)
inline

Definition at line 51 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

51:_rpart(c._rpart),_ipart(c._ipart){}

Member Function Documentation

◆ operator!=() [1/2]

int EvtComplex::operator!= ( const EvtComplex  c)
inline

Definition at line 193 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

193 {
194
195 return _rpart!=c._rpart||_ipart!=c._ipart;
196
197}

◆ operator!=() [2/2]

int EvtComplex::operator!= ( const EvtComplex  c)
inline

◆ operator*=() [1/4]

EvtComplex & EvtComplex::operator*= ( double  d)
inline

Definition at line 131 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

131 {
132
133 _rpart*=d;
134 _ipart*=d;
135
136 return *this;
137
138}

◆ operator*=() [2/4]

EvtComplex & EvtComplex::operator*= ( double  d)
inline

◆ operator*=() [3/4]

EvtComplex & EvtComplex::operator*= ( EvtComplex  c)

Definition at line 35 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.cc.

35 {
36
37 double r=_rpart*c._rpart-_ipart*c._ipart;
38 double i=_rpart*c._ipart+_ipart*c._rpart;
39
40 _rpart=r;
41 _ipart=i;
42
43 return *this;
44
45}

◆ operator*=() [4/4]

EvtComplex & EvtComplex::operator*= ( EvtComplex  c)

◆ operator+=() [1/4]

EvtComplex & EvtComplex::operator+= ( const EvtComplex c)
inline

Definition at line 81 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

81 {
82
83 _rpart+=c._rpart;
84 _ipart+=c._ipart;
85
86 return *this;
87}

◆ operator+=() [2/4]

EvtComplex & EvtComplex::operator+= ( const EvtComplex c)
inline

◆ operator+=() [3/4]

EvtComplex & EvtComplex::operator+= ( double  d)
inline

Definition at line 97 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

97 {
98
99 _rpart+=d;
100
101 return *this;
102}

◆ operator+=() [4/4]

EvtComplex & EvtComplex::operator+= ( double  d)
inline

◆ operator-=() [1/4]

EvtComplex & EvtComplex::operator-= ( const EvtComplex c)
inline

Definition at line 89 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

89 {
90
91 _rpart-=c._rpart;
92 _ipart-=c._ipart;
93
94 return *this;
95}

◆ operator-=() [2/4]

EvtComplex & EvtComplex::operator-= ( const EvtComplex c)
inline

◆ operator-=() [3/4]

EvtComplex & EvtComplex::operator-= ( double  d)
inline

Definition at line 104 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

104 {
105
106 _rpart-=d;
107
108 return *this;
109}

◆ operator-=() [4/4]

EvtComplex & EvtComplex::operator-= ( double  d)
inline

◆ operator/=() [1/4]

EvtComplex & EvtComplex::operator/= ( double  d)
inline

Definition at line 141 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

141 {
142
143 _rpart/=d;
144 _ipart/=d;
145
146 return *this;
147}

◆ operator/=() [2/4]

EvtComplex & EvtComplex::operator/= ( double  d)
inline

◆ operator/=() [3/4]

EvtComplex & EvtComplex::operator/= ( EvtComplex  c)

Definition at line 47 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.cc.

47 {
48
49 double inv=1.0/(c._rpart*c._rpart+c._ipart*c._ipart);
50
51 double r=inv*(_rpart*c._rpart+_ipart*c._ipart);
52 double i=inv*(_ipart*c._rpart-_rpart*c._ipart);
53
54 _rpart=r;
55 _ipart=i;
56
57 return *this;
58
59}

◆ operator/=() [4/4]

EvtComplex & EvtComplex::operator/= ( EvtComplex  c)

◆ operator=() [1/2]

EvtComplex & EvtComplex::operator= ( const EvtComplex c)
inline

Definition at line 73 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

73 {
74
75 _rpart=c._rpart;
76 _ipart=c._ipart;
77
78 return *this;
79}

◆ operator=() [2/2]

EvtComplex & EvtComplex::operator= ( const EvtComplex c)
inline

◆ operator==() [1/2]

int EvtComplex::operator== ( const EvtComplex  c)
inline

Definition at line 187 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

187 {
188
189 return _rpart==c._rpart&&_ipart==c._ipart;
190
191}

◆ operator==() [2/2]

int EvtComplex::operator== ( const EvtComplex  c)
inline

Friends And Related Function Documentation

◆ abs [1/2]

double abs ( const EvtComplex c)
friend

Definition at line 212 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

212 {
213
214 double c2=c._rpart*c._rpart+c._ipart*c._ipart;
215 if (c2<=0.0) return 0.0;
216 return sqrt(c2);
217
218}

◆ abs [2/2]

double abs ( const EvtComplex c)
friend

Definition at line 212 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

212 {
213
214 double c2=c._rpart*c._rpart+c._ipart*c._ipart;
215 if (c2<=0.0) return 0.0;
216 return sqrt(c2);
217
218}

◆ abs2 [1/2]

double abs2 ( const EvtComplex c)
friend

Definition at line 221 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

221 {
222
223 return c._rpart*c._rpart+c._ipart*c._ipart;
224}

◆ abs2 [2/2]

double abs2 ( const EvtComplex c)
friend

Definition at line 221 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

221 {
222
223 return c._rpart*c._rpart+c._ipart*c._ipart;
224}

◆ arg [1/2]

double arg ( const EvtComplex c)
friend

Definition at line 227 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

227 { //added by FS
228 if ((c._rpart==0)&&(c._ipart==0)) {return 0.0;}
229 if (c._rpart==0){
230 if (c._ipart>0){
231 return EvtConst::pi/2;
232 } else {
233 return -EvtConst::pi/2;
234 }
235 } else {
236 return atan2(c._ipart,c._rpart);
237 }
238}

◆ arg [2/2]

double arg ( const EvtComplex c)
friend

Definition at line 227 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

227 { //added by FS
228 if ((c._rpart==0)&&(c._ipart==0)) {return 0.0;}
229 if (c._rpart==0){
230 if (c._ipart>0){
231 return EvtConst::pi/2;
232 } else {
233 return -EvtConst::pi/2;
234 }
235 } else {
236 return atan2(c._ipart,c._rpart);
237 }
238}

◆ conj [1/2]

EvtComplex conj ( const EvtComplex c)
friend

Definition at line 206 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

206 {
207
208 return EvtComplex(c._rpart,-c._ipart);
209
210}

◆ conj [2/2]

EvtComplex conj ( const EvtComplex c)
friend

Definition at line 206 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

206 {
207
208 return EvtComplex(c._rpart,-c._ipart);
209
210}

◆ exp [1/2]

EvtComplex exp ( const EvtComplex c)
friend

Definition at line 252 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

252 {
253
254 return exp(c._rpart)*EvtComplex(cos(c._ipart),sin(c._ipart));
255
256}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
friend EvtComplex exp(const EvtComplex &c)

◆ exp [2/2]

EvtComplex exp ( const EvtComplex c)
friend

Definition at line 252 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

252 {
253
254 return exp(c._rpart)*EvtComplex(cos(c._ipart),sin(c._ipart));
255
256}

◆ imag [1/2]

double imag ( const EvtComplex c)
friend

Definition at line 246 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

246 {
247
248 return c._ipart;
249
250}

◆ imag [2/2]

double imag ( const EvtComplex c)
friend

Definition at line 246 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

246 {
247
248 return c._ipart;
249
250}

◆ operator* [1/6]

EvtComplex operator* ( const EvtComplex c,
double  d 
)
friend

Definition at line 117 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

117 {
118
119 return EvtComplex(c._rpart*d,c._ipart*d);
120
121}

◆ operator* [2/6]

EvtComplex operator* ( const EvtComplex c,
double  d 
)
friend

Definition at line 117 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

117 {
118
119 return EvtComplex(c._rpart*d,c._ipart*d);
120
121}

◆ operator* [3/6]

EvtComplex operator* ( const EvtComplex c1,
const EvtComplex c2 
)
friend

Definition at line 168 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

168 {
169
170 return EvtComplex(c1._rpart*c2._rpart-c1._ipart*c2._ipart,
171 c1._rpart*c2._ipart+c1._ipart*c2._rpart);
172
173}

◆ operator* [4/6]

EvtComplex operator* ( const EvtComplex c1,
const EvtComplex c2 
)
friend

Definition at line 168 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

168 {
169
170 return EvtComplex(c1._rpart*c2._rpart-c1._ipart*c2._ipart,
171 c1._rpart*c2._ipart+c1._ipart*c2._rpart);
172
173}

◆ operator* [5/6]

EvtComplex operator* ( double  d,
const EvtComplex c 
)
friend

Definition at line 111 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

111 {
112
113 return EvtComplex(c._rpart*d,c._ipart*d);
114
115}

◆ operator* [6/6]

EvtComplex operator* ( double  d,
const EvtComplex c 
)
friend

Definition at line 111 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

111 {
112
113 return EvtComplex(c._rpart*d,c._ipart*d);
114
115}

◆ operator+ [1/2]

EvtComplex operator+ ( const EvtComplex c1,
const EvtComplex c2 
)
friend

Definition at line 181 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

181 {
182
183 return EvtComplex(c1._rpart+c2._rpart,c1._ipart+c2._ipart);
184
185}

◆ operator+ [2/2]

EvtComplex operator+ ( const EvtComplex c1,
const EvtComplex c2 
)
friend

Definition at line 181 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

181 {
182
183 return EvtComplex(c1._rpart+c2._rpart,c1._ipart+c2._ipart);
184
185}

◆ operator- [1/4]

EvtComplex operator- ( const EvtComplex c)
friend

Definition at line 200 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

200 {
201
202 return EvtComplex(-c._rpart,-c._ipart);
203
204}

◆ operator- [2/4]

EvtComplex operator- ( const EvtComplex c)
friend

Definition at line 200 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

200 {
201
202 return EvtComplex(-c._rpart,-c._ipart);
203
204}

◆ operator- [3/4]

EvtComplex operator- ( const EvtComplex c1,
const EvtComplex c2 
)
friend

Definition at line 175 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

175 {
176
177 return EvtComplex(c1._rpart-c2._rpart,c1._ipart-c2._ipart);
178
179}

◆ operator- [4/4]

EvtComplex operator- ( const EvtComplex c1,
const EvtComplex c2 
)
friend

Definition at line 175 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

175 {
176
177 return EvtComplex(c1._rpart-c2._rpart,c1._ipart-c2._ipart);
178
179}

◆ operator/ [1/6]

EvtComplex operator/ ( const EvtComplex c,
double  d 
)
friend

Definition at line 125 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

125 {
126
127 return EvtComplex(c._rpart/d,c._ipart/d);
128
129}

◆ operator/ [2/6]

EvtComplex operator/ ( const EvtComplex c,
double  d 
)
friend

Definition at line 125 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

125 {
126
127 return EvtComplex(c._rpart/d,c._ipart/d);
128
129}

◆ operator/ [3/6]

EvtComplex operator/ ( const EvtComplex c1,
const EvtComplex c2 
)
friend

Definition at line 159 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

159 {
160
161 double inv=1.0/(c2._rpart*c2._rpart+c2._ipart*c2._ipart);
162
163 return EvtComplex(inv*(c1._rpart*c2._rpart+c1._ipart*c2._ipart),
164 inv*(c1._ipart*c2._rpart-c1._rpart*c2._ipart));
165
166}

◆ operator/ [4/6]

EvtComplex operator/ ( const EvtComplex c1,
const EvtComplex c2 
)
friend

Definition at line 159 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

159 {
160
161 double inv=1.0/(c2._rpart*c2._rpart+c2._ipart*c2._ipart);
162
163 return EvtComplex(inv*(c1._rpart*c2._rpart+c1._ipart*c2._ipart),
164 inv*(c1._ipart*c2._rpart-c1._rpart*c2._ipart));
165
166}

◆ operator/ [5/6]

EvtComplex operator/ ( double  d,
const EvtComplex c 
)
friend

Definition at line 149 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

149 {
150
151double Num=d/(c._rpart*c._rpart+c._ipart*c._ipart);
152
153return EvtComplex( Num*c._rpart, -Num*c._ipart );
154
155}

◆ operator/ [6/6]

EvtComplex operator/ ( double  d,
const EvtComplex c 
)
friend

Definition at line 149 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

149 {
150
151double Num=d/(c._rpart*c._rpart+c._ipart*c._ipart);
152
153return EvtComplex( Num*c._rpart, -Num*c._ipart );
154
155}

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream &  s,
const EvtComplex c 
)
friend

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream &  s,
const EvtComplex c 
)
friend

◆ real [1/2]

double real ( const EvtComplex c)
friend

Definition at line 240 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

240 {
241
242 return c._rpart;
243
244}

◆ real [2/2]

double real ( const EvtComplex c)
friend

Definition at line 240 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtComplex.hh.

240 {
241
242 return c._rpart;
243
244}

The documentation for this class was generated from the following files: