00001 //-------------------------------------------------------------------------- 00002 // 00003 // Environment: 00004 // This software is part of the EvtGen package developed jointly 00005 // for the BaBar and CLEO collaborations. If you use all or part 00006 // of it, please give an appropriate acknowledgement. 00007 // 00008 // Copyright Information: See EvtGen/COPYRIGHT 00009 // Copyright (C) 1998 Caltech, UCSB 00010 // 00011 // Module: EvtComplex.cc 00012 // 00013 // Description: EvtComlex.cc 00014 // 00015 // Modification history: 00016 // 00017 // RYD December 5, 1998 Created 00018 // 00019 //------------------------------------------------------------------------ 00020 // 00021 #include "EvtGenBase/EvtPatches.hh" 00022 #include <iostream> 00023 #include <math.h> 00024 #include "EvtGenBase/EvtComplex.hh" 00025 using std::ostream; 00026 00027 00028 ostream& operator<<(ostream& s, const EvtComplex& c){ 00029 00030 s<<"("<<c._rpart<<","<<c._ipart<<")"; 00031 return s; 00032 00033 } 00034 00035 EvtComplex& EvtComplex::operator*=(EvtComplex c){ 00036 00037 double r=_rpart*c._rpart-_ipart*c._ipart; 00038 double i=_rpart*c._ipart+_ipart*c._rpart; 00039 00040 _rpart=r; 00041 _ipart=i; 00042 00043 return *this; 00044 00045 } 00046 00047 EvtComplex& EvtComplex::operator/=(EvtComplex c){ 00048 00049 double inv=1.0/(c._rpart*c._rpart+c._ipart*c._ipart); 00050 00051 double r=inv*(_rpart*c._rpart+_ipart*c._ipart); 00052 double i=inv*(_ipart*c._rpart-_rpart*c._ipart); 00053 00054 _rpart=r; 00055 _ipart=i; 00056 00057 return *this; 00058 00059 } 00060 00061 00062 00063