83 SUBROUTINE zrscl( N, A, X, INCX )
100 DOUBLE PRECISION ZERO, ONE
101 parameter( zero = 0.0d+0, one = 1.0d+0 )
104 DOUBLE PRECISION SAFMAX, SAFMIN, OV, AR, AI, ABSR, ABSI, UR, UI
107 DOUBLE PRECISION DLAMCH
109 EXTERNAL dlamch, zladiv
126 safmin = dlamch(
'S' )
127 safmax = one / safmin
137 IF( ai.EQ.zero )
THEN
139 CALL zdrscl( n, ar, x, incx )
141 ELSE IF( ar.EQ.zero )
THEN
144 IF( absi.GT.safmax )
THEN
145 CALL zdscal( n, safmin, x, incx )
146 CALL zscal( n, dcmplx( zero, -safmax / ai ), x, incx )
147 ELSE IF( absi.LT.safmin )
THEN
148 CALL zscal( n, dcmplx( zero, -safmin / ai ), x, incx )
149 CALL zdscal( n, safmax, x, incx )
151 CALL zscal( n, dcmplx( zero, -one / ai ), x, incx )
162 ur = ar + ai * ( ai / ar )
163 ui = ai + ar * ( ar / ai )
165 IF( (abs( ur ).LT.safmin).OR.(abs( ui ).LT.safmin) )
THEN
167 CALL zscal( n, dcmplx( safmin / ur, -safmin / ui ), x,
169 CALL zdscal( n, safmax, x, incx )
170 ELSE IF( (abs( ur ).GT.safmax).OR.(abs( ui ).GT.safmax) )
THEN
171 IF( (absr.GT.ov).OR.(absi.GT.ov) )
THEN
173 CALL zscal( n, dcmplx( one / ur, -one / ui ), x, incx )
175 CALL zdscal( n, safmin, x, incx )
176 IF( (abs( ur ).GT.ov).OR.(abs( ui ).GT.ov) )
THEN
178 IF( absr.GE.absi )
THEN
180 ur = (safmin * ar) + safmin * (ai * ( ai / ar ))
181 ui = (safmin * ai) + ar * ( (safmin * ar) / ai )
184 ur = (safmin * ar) + ai * ( (safmin * ai) / ar )
185 ui = (safmin * ai) + safmin * (ar * ( ar / ai ))
187 CALL zscal( n, dcmplx( one / ur, -one / ui ), x,
190 CALL zscal( n, dcmplx( safmax / ur, -safmax / ui ),
195 CALL zscal( n, dcmplx( one / ur, -one / ui ), x, incx )
subroutine zdrscl(n, sa, sx, incx)
ZDRSCL multiplies a vector by the reciprocal of a real scalar.
subroutine dscal(n, da, dx, incx)
DSCAL
subroutine zdscal(n, da, zx, incx)
ZDSCAL
subroutine zscal(n, za, zx, incx)
ZSCAL
subroutine zrscl(n, a, x, incx)
ZDRSCL multiplies a vector by the reciprocal of a real scalar.