BOSS 7.1.1
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)
 

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)
 

Detailed Description

Definition at line 28 of file EvtComplex.hh.

Constructor & Destructor Documentation

◆ EvtComplex() [1/3]

EvtComplex::EvtComplex ( )
inline

Definition at line 49 of file EvtComplex.hh.

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

◆ EvtComplex() [2/3]

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

Definition at line 50 of file EvtComplex.hh.

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

◆ EvtComplex() [3/3]

EvtComplex::EvtComplex ( const EvtComplex & c)
inline

Definition at line 51 of file EvtComplex.hh.

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

Member Function Documentation

◆ operator!=()

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

Definition at line 193 of file EvtComplex.hh.

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

◆ operator*=() [1/2]

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

Definition at line 131 of file EvtComplex.hh.

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

◆ operator*=() [2/2]

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

Definition at line 35 of file 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+=() [1/2]

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

Definition at line 81 of file EvtComplex.hh.

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

◆ operator+=() [2/2]

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

Definition at line 97 of file EvtComplex.hh.

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

◆ operator-=() [1/2]

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

Definition at line 89 of file EvtComplex.hh.

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

◆ operator-=() [2/2]

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

Definition at line 104 of file EvtComplex.hh.

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

◆ operator/=() [1/2]

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

Definition at line 141 of file EvtComplex.hh.

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

◆ operator/=() [2/2]

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

Definition at line 47 of file 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=()

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

Definition at line 73 of file EvtComplex.hh.

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

◆ operator==()

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

Definition at line 187 of file EvtComplex.hh.

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

Friends And Related Symbol Documentation

◆ abs

double abs ( const EvtComplex & c)
friend

Definition at line 212 of file 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

double abs2 ( const EvtComplex & c)
friend

Definition at line 221 of file EvtComplex.hh.

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

◆ arg

double arg ( const EvtComplex & c)
friend

Definition at line 227 of file 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}
static const double pi
Definition EvtConst.hh:28

◆ conj

EvtComplex conj ( const EvtComplex & c)
friend

Definition at line 206 of file EvtComplex.hh.

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

◆ exp

EvtComplex exp ( const EvtComplex & c)
friend

Definition at line 252 of file 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)

◆ imag

double imag ( const EvtComplex & c)
friend

Definition at line 246 of file EvtComplex.hh.

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

◆ operator* [1/3]

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

Definition at line 117 of file EvtComplex.hh.

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

◆ operator* [2/3]

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

Definition at line 168 of file 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* [3/3]

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

Definition at line 111 of file EvtComplex.hh.

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

◆ operator+

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

Definition at line 181 of file EvtComplex.hh.

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

◆ operator- [1/2]

EvtComplex operator- ( const EvtComplex & c)
friend

Definition at line 200 of file EvtComplex.hh.

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

◆ operator- [2/2]

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

Definition at line 175 of file EvtComplex.hh.

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

◆ operator/ [1/3]

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

Definition at line 125 of file EvtComplex.hh.

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

◆ operator/ [2/3]

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

Definition at line 159 of file 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/ [3/3]

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

Definition at line 149 of file 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<<

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

◆ real

double real ( const EvtComplex & c)
friend

Definition at line 240 of file EvtComplex.hh.

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

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