Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pycsrt.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pycsrt.f
1 
2 C*********************************************************************
3 
4 C...PYCSRT
5 C...Auxiliary to PYCMQR
6 C
7 C (YR,YI) = COMPLEX DSQRT(XR,XI)
8 C BRANCH CHOSEN SO THAT YR .GE. 0.0 AND SIGN(YI) .EQ. SIGN(XI)
9 C
10 
11  SUBROUTINE pycsrt(XR,XI,YR,YI)
12 
13  DOUBLE PRECISION xr,xi,yr,yi
14  DOUBLE PRECISION s,tr,ti,pythag
15 
16  tr = xr
17  ti = xi
18  s = dsqrt(0.5d0*(pythag(tr,ti) + dabs(tr)))
19  IF (tr .GE. 0.0d0) yr = s
20  IF (ti .LT. 0.0d0) s = -s
21  IF (tr .LE. 0.0d0) yi = s
22  IF (tr .LT. 0.0d0) yr = 0.5d0*(ti/yi)
23  IF (tr .GT. 0.0d0) yi = 0.5d0*(ti/yr)
24  RETURN
25  END