105 SUBROUTINE zlarfgp( N, ALPHA, X, INCX, TAU )
114 COMPLEX*16 ALPHA, TAU
123 DOUBLE PRECISION TWO, ONE, ZERO
124 parameter ( two = 2.0d+0, one = 1.0d+0, zero = 0.0d+0 )
128 DOUBLE PRECISION ALPHI, ALPHR, BETA, BIGNUM, SMLNUM, XNORM
132 DOUBLE PRECISION DLAMCH, DLAPY3, DLAPY2, DZNRM2
134 EXTERNAL dlamch, dlapy3, dlapy2, dznrm2, zladiv
137 INTRINSIC abs, dble, dcmplx, dimag, sign
149 xnorm = dznrm2( n-1, x, incx )
150 alphr = dble( alpha )
151 alphi = dimag( alpha )
153 IF( xnorm.EQ.zero )
THEN
157 IF( alphi.EQ.zero )
THEN
158 IF( alphr.GE.zero )
THEN
168 x( 1 + (j-1)*incx ) = zero
174 xnorm = dlapy2( alphr, alphi )
175 tau = dcmplx( one - alphr / xnorm, -alphi / xnorm )
177 x( 1 + (j-1)*incx ) = zero
185 beta = sign( dlapy3( alphr, alphi, xnorm ), alphr )
186 smlnum = dlamch(
'S' ) / dlamch(
'E' )
187 bignum = one / smlnum
190 IF( abs( beta ).LT.smlnum )
THEN
196 CALL zdscal( n-1, bignum, x, incx )
200 IF( abs( beta ).LT.smlnum )
205 xnorm = dznrm2( n-1, x, incx )
206 alpha = dcmplx( alphr, alphi )
207 beta = sign( dlapy3( alphr, alphi, xnorm ), alphr )
211 IF( beta.LT.zero )
THEN
215 alphr = alphi * (alphi/dble( alpha ))
216 alphr = alphr + xnorm * (xnorm/dble( alpha ))
217 tau = dcmplx( alphr/beta, -alphi/beta )
218 alpha = dcmplx( -alphr, alphi )
220 alpha = zladiv( dcmplx( one ), alpha )
222 IF ( abs(tau).LE.smlnum )
THEN
231 alphr = dble( savealpha )
232 alphi = dimag( savealpha )
233 IF( alphi.EQ.zero )
THEN
234 IF( alphr.GE.zero )
THEN
239 x( 1 + (j-1)*incx ) = zero
244 xnorm = dlapy2( alphr, alphi )
245 tau = dcmplx( one - alphr / xnorm, -alphi / xnorm )
247 x( 1 + (j-1)*incx ) = zero
256 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