]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TEvtGen/EvtGenBase/EvtComplex.cpp
Updates EvtGen Code
[u/mrichter/AliRoot.git] / TEvtGen / EvtGenBase / EvtComplex.cpp
CommitLineData
da0e9ce3 1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of the EvtGen package developed jointly
5// for the BaBar and CLEO collaborations. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See EvtGen/COPYRIGHT
9// Copyright (C) 1998 Caltech, UCSB
10//
11// Module: EvtComplex.cc
12//
13// Description: EvtComlex.cc
14//
15// Modification history:
16//
17// RYD December 5, 1998 Created
18//
19//------------------------------------------------------------------------
20//
21#include "EvtGenBase/EvtPatches.hh"
22#include <iostream>
23#include <math.h>
24#include "EvtGenBase/EvtComplex.hh"
25using std::ostream;
26
27
28ostream& operator<<(ostream& s, const EvtComplex& c){
29
30 s<<"("<<c._rpart<<","<<c._ipart<<")";
31 return s;
32
33}
34
35EvtComplex& EvtComplex::operator*=(EvtComplex c){
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}
46
47EvtComplex& EvtComplex::operator/=(EvtComplex c){
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*(_rpart*c._ipart-_ipart*c._rpart);
53
54 _rpart=r;
55 _ipart=i;
56
57 return *this;
58
59}
60
61
62
63