Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//--------------------------------------------------------------------------
//
// Environment:
// This software is part of the EvtGen package developed jointly
// for the BaBar and CLEO collaborations. If you use all or part
// of it, please give an appropriate acknowledgement.
//
// Copyright Information: See EvtGen/COPYRIGHT
// Copyright (C) 1998 Caltech, UCSB
//
// Module: EvtComplex.cc
//
// Description: EvtComlex.cc
//
// Modification history:
//
// RYD December 5, 1998 Created
//
//------------------------------------------------------------------------
//
#include <iostream>
#include <math.h>
#include "PspGen/EvtComplex.hh"
using std::ostream;
ostream& operator<<(ostream& s, const EvtComplex& c){
s<<"("<<c._rpart<<","<<c._ipart<<")";
return s;
}
EvtComplex& EvtComplex::operator*=(EvtComplex c){
double r=_rpart*c._rpart-_ipart*c._ipart;
double i=_rpart*c._ipart+_ipart*c._rpart;
_rpart=r;
_ipart=i;
return *this;
}
EvtComplex& EvtComplex::operator/=(EvtComplex c){
double inv=1.0/(c._rpart*c._rpart+c._ipart*c._ipart);
double r=inv*(_rpart*c._rpart+_ipart*c._ipart);
double i=inv*(_rpart*c._ipart-_ipart*c._rpart);
_rpart=r;
_ipart=i;
return *this;
}