BOSS 8.0.0
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() [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 177 of file EvtComplex.hh.

177 {
178
179 return _rpart != c._rpart || _ipart != c._ipart;
180}

◆ operator*=() [1/2]

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

Definition at line 125 of file EvtComplex.hh.

125 {
126
127 _rpart *= d;
128 _ipart *= d;
129
130 return *this;
131}

◆ operator*=() [2/2]

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

Definition at line 33 of file EvtComplex.cc.

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

◆ operator+=() [1/2]

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

Definition at line 80 of file EvtComplex.hh.

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

◆ operator+=() [2/2]

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

Definition at line 96 of file EvtComplex.hh.

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

◆ operator-=() [1/2]

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

Definition at line 88 of file EvtComplex.hh.

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

◆ operator-=() [2/2]

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

Definition at line 103 of file EvtComplex.hh.

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

◆ operator/=() [1/2]

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

Definition at line 133 of file EvtComplex.hh.

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

◆ operator/=() [2/2]

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

Definition at line 44 of file EvtComplex.cc.

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

◆ operator=()

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

Definition at line 72 of file EvtComplex.hh.

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

◆ operator==()

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

Definition at line 172 of file EvtComplex.hh.

172 {
173
174 return _rpart == c._rpart && _ipart == c._ipart;
175}

◆ abs

double abs ( const EvtComplex & c)
friend

Definition at line 186 of file EvtComplex.hh.

186 {
187
188 double c2 = c._rpart * c._rpart + c._ipart * c._ipart;
189 if ( c2 <= 0.0 ) return 0.0;
190 return sqrt( c2 );
191}

◆ abs2

double abs2 ( const EvtComplex & c)
friend

Definition at line 193 of file EvtComplex.hh.

193{ return c._rpart * c._rpart + c._ipart * c._ipart; }

◆ arg

double arg ( const EvtComplex & c)
friend

Definition at line 195 of file EvtComplex.hh.

195 { // added by FS
196 if ( ( c._rpart == 0 ) && ( c._ipart == 0 ) ) { return 0.0; }
197 if ( c._rpart == 0 )
198 {
199 if ( c._ipart > 0 ) { return EvtConst::pi / 2; }
200 else { return -EvtConst::pi / 2; }
201 }
202 else { return atan2( c._ipart, c._rpart ); }
203}
static const double pi
Definition EvtConst.hh:27

◆ conj

EvtComplex conj ( const EvtComplex & c)
friend

Definition at line 184 of file EvtComplex.hh.

184{ return EvtComplex( c._rpart, -c._ipart ); }

◆ exp

EvtComplex exp ( const EvtComplex & c)
friend

Definition at line 209 of file EvtComplex.hh.

209 {
210
211 return exp( c._rpart ) * EvtComplex( cos( c._ipart ), sin( c._ipart ) );
212}
friend EvtComplex exp(const EvtComplex &c)

◆ imag

double imag ( const EvtComplex & c)
friend

Definition at line 207 of file EvtComplex.hh.

207{ return c._ipart; }

◆ operator* [1/3]

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

Definition at line 115 of file EvtComplex.hh.

115 {
116
117 return EvtComplex( c._rpart * d, c._ipart * d );
118}

◆ operator* [2/3]

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

Definition at line 156 of file EvtComplex.hh.

156 {
157
158 return EvtComplex( c1._rpart * c2._rpart - c1._ipart * c2._ipart,
159 c1._rpart * c2._ipart + c1._ipart * c2._rpart );
160}

◆ operator* [3/3]

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

Definition at line 110 of file EvtComplex.hh.

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

◆ operator+

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

Definition at line 167 of file EvtComplex.hh.

167 {
168
169 return EvtComplex( c1._rpart + c2._rpart, c1._ipart + c2._ipart );
170}

◆ operator- [1/2]

EvtComplex operator- ( const EvtComplex & c)
friend

Definition at line 182 of file EvtComplex.hh.

182{ return EvtComplex( -c._rpart, -c._ipart ); }

◆ operator- [2/2]

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

Definition at line 162 of file EvtComplex.hh.

162 {
163
164 return EvtComplex( c1._rpart - c2._rpart, c1._ipart - c2._ipart );
165}

◆ operator/ [1/3]

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

Definition at line 120 of file EvtComplex.hh.

120 {
121
122 return EvtComplex( c._rpart / d, c._ipart / d );
123}

◆ operator/ [2/3]

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

Definition at line 148 of file EvtComplex.hh.

148 {
149
150 double inv = 1.0 / ( c2._rpart * c2._rpart + c2._ipart * c2._ipart );
151
152 return EvtComplex( inv * ( c1._rpart * c2._rpart + c1._ipart * c2._ipart ),
153 inv * ( c1._ipart * c2._rpart - c1._rpart * c2._ipart ) );
154}

◆ operator/ [3/3]

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

Definition at line 141 of file EvtComplex.hh.

141 {
142
143 double Num = d / ( c._rpart * c._rpart + c._ipart * c._ipart );
144
145 return EvtComplex( Num * c._rpart, -Num * c._ipart );
146}

◆ operator<<

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

◆ real

double real ( const EvtComplex & c)
friend

Definition at line 205 of file EvtComplex.hh.

205{ return c._rpart; }

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