81 SUBROUTINE zrscl( N, A, X, INCX )
98 DOUBLE PRECISION ZERO, ONE
99 parameter( zero = 0.0d+0, one = 1.0d+0 )
102 DOUBLE PRECISION SAFMAX, SAFMIN, OV, AR, AI, ABSR, ABSI, UR, UI
105 DOUBLE PRECISION DLAMCH
107 EXTERNAL dlamch, zladiv
124 safmin = dlamch(
'S' )
125 safmax = one / safmin
135 IF( ai.EQ.zero )
THEN
137 CALL zdrscl( n, ar, x, incx )
139 ELSE IF( ar.EQ.zero )
THEN
142 IF( absi.GT.safmax )
THEN
143 CALL zdscal( n, safmin, x, incx )
144 CALL zscal( n, dcmplx( zero, -safmax / ai ), x, incx )
145 ELSE IF( absi.LT.safmin )
THEN
146 CALL zscal( n, dcmplx( zero, -safmin / ai ), x, incx )
147 CALL zdscal( n, safmax, x, incx )
149 CALL zscal( n, dcmplx( zero, -one / ai ), x, incx )
160 ur = ar + ai * ( ai / ar )
161 ui = ai + ar * ( ar / ai )
163 IF( (abs( ur ).LT.safmin).OR.(abs( ui ).LT.safmin) )
THEN
165 CALL zscal( n, dcmplx( safmin / ur, -safmin / ui ), x,
167 CALL zdscal( n, safmax, x, incx )
168 ELSE IF( (abs( ur ).GT.safmax).OR.(abs( ui ).GT.safmax) )
THEN
169 IF( (absr.GT.ov).OR.(absi.GT.ov) )
THEN
171 CALL zscal( n, dcmplx( one / ur, -one / ui ), x,
174 CALL zdscal( n, safmin, x, incx )
175 IF( (abs( ur ).GT.ov).OR.(abs( ui ).GT.ov) )
THEN
177 IF( absr.GE.absi )
THEN
179 ur = (safmin * ar) + safmin * (ai * ( ai / ar ))
180 ui = (safmin * ai) + ar * ( (safmin * ar) / ai )
183 ur = (safmin * ar) + ai * ( (safmin * ai) / ar )
184 ui = (safmin * ai) + safmin * (ar * ( ar / ai ))
186 CALL zscal( n, dcmplx( one / ur, -one / ui ), x,
189 CALL zscal( n, dcmplx( safmax / ur, -safmax / ui ),
194 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 zrscl(n, a, x, incx)
ZDRSCL multiplies a vector by the reciprocal of a real scalar.