111 COMPLEX*16 ALPHA, TAU
120 DOUBLE PRECISION TWO, ONE, ZERO
121 parameter( two = 2.0d+0, one = 1.0d+0, zero = 0.0d+0 )
125 DOUBLE PRECISION ALPHI, ALPHR, BETA, BIGNUM, EPS, SMLNUM, XNORM
129 DOUBLE PRECISION DLAMCH, DLAPY3, DLAPY2, DZNRM2
131 EXTERNAL dlamch, dlapy3, dlapy2, dznrm2, zladiv
134 INTRINSIC abs, dble, dcmplx, dimag, sign
146 eps = dlamch(
'Precision' )
147 xnorm = dznrm2( n-1, x, incx )
148 alphr = dble( alpha )
149 alphi = dimag( alpha )
151 IF( xnorm.LE.eps*abs(alpha) )
THEN
155 IF( alphi.EQ.zero )
THEN
156 IF( alphr.GE.zero )
THEN
166 x( 1 + (j-1)*incx ) = zero
172 xnorm = dlapy2( alphr, alphi )
173 tau = dcmplx( one - alphr / xnorm, -alphi / xnorm )
175 x( 1 + (j-1)*incx ) = zero
183 beta = sign( dlapy3( alphr, alphi, xnorm ), alphr )
184 smlnum = dlamch(
'S' ) / dlamch(
'E' )
185 bignum = one / smlnum
188 IF( abs( beta ).LT.smlnum )
THEN
194 CALL zdscal( n-1, bignum, x, incx )
198 IF( (abs( beta ).LT.smlnum) .AND. (knt .LT. 20) )
203 xnorm = dznrm2( n-1, x, incx )
204 alpha = dcmplx( alphr, alphi )
205 beta = sign( dlapy3( alphr, alphi, xnorm ), alphr )
209 IF( beta.LT.zero )
THEN
213 alphr = alphi * (alphi/dble( alpha ))
214 alphr = alphr + xnorm * (xnorm/dble( alpha ))
215 tau = dcmplx( alphr/beta, -alphi/beta )
216 alpha = dcmplx( -alphr, alphi )
218 alpha = zladiv( dcmplx( one ), alpha )
220 IF ( abs(tau).LE.smlnum )
THEN
229 alphr = dble( savealpha )
230 alphi = dimag( savealpha )
231 IF( alphi.EQ.zero )
THEN
232 IF( alphr.GE.zero )
THEN
237 x( 1 + (j-1)*incx ) = zero
239 beta = dble( -savealpha )
242 xnorm = dlapy2( alphr, alphi )
243 tau = dcmplx( one - alphr / xnorm, -alphi / xnorm )
245 x( 1 + (j-1)*incx ) = zero
254 CALL zscal( n-1, alpha, x, incx )
subroutine zlarfgp(n, alpha, x, incx, tau)
ZLARFGP generates an elementary reflector (Householder matrix) with non-negative beta.
subroutine zdscal(n, da, zx, incx)
ZDSCAL
subroutine zscal(n, za, zx, incx)
ZSCAL