109 COMPLEX*16 ALPHA, TAU
118 DOUBLE PRECISION TWO, ONE, ZERO
119 parameter( two = 2.0d+0, one = 1.0d+0, zero = 0.0d+0 )
123 DOUBLE PRECISION ALPHI, ALPHR, BETA, BIGNUM, EPS, SMLNUM, XNORM
127 DOUBLE PRECISION DLAMCH, DLAPY3, DLAPY2, DZNRM2
129 EXTERNAL dlamch, dlapy3, dlapy2, dznrm2,
133 INTRINSIC abs, dble, dcmplx, dimag, sign
145 eps = dlamch(
'Precision' )
146 xnorm = dznrm2( n-1, x, incx )
147 alphr = dble( alpha )
148 alphi = dimag( alpha )
150 IF( xnorm.LE.eps*abs(alpha) .AND. alphi.EQ.zero )
THEN
154 IF( alphr.GE.zero )
THEN
164 x( 1 + (j-1)*incx ) = zero
172 beta = sign( dlapy3( alphr, alphi, xnorm ), alphr )
173 smlnum = dlamch(
'S' ) / dlamch(
'E' )
174 bignum = one / smlnum
177 IF( abs( beta ).LT.smlnum )
THEN
183 CALL zdscal( n-1, bignum, x, incx )
187 IF( (abs( beta ).LT.smlnum) .AND. (knt .LT. 20) )
192 xnorm = dznrm2( n-1, x, incx )
193 alpha = dcmplx( alphr, alphi )
194 beta = sign( dlapy3( alphr, alphi, xnorm ), alphr )
198 IF( beta.LT.zero )
THEN
202 alphr = alphi * (alphi/dble( alpha ))
203 alphr = alphr + xnorm * (xnorm/dble( alpha ))
204 tau = dcmplx( alphr/beta, -alphi/beta )
205 alpha = dcmplx( -alphr, alphi )
207 alpha = zladiv( dcmplx( one ), alpha )
209 IF ( abs(tau).LE.smlnum )
THEN
218 alphr = dble( savealpha )
219 alphi = dimag( savealpha )
220 IF( alphi.EQ.zero )
THEN
221 IF( alphr.GE.zero )
THEN
226 x( 1 + (j-1)*incx ) = zero
228 beta = dble( -savealpha )
231 xnorm = dlapy2( alphr, alphi )
232 tau = dcmplx( one - alphr / xnorm, -alphi / xnorm )
234 x( 1 + (j-1)*incx ) = zero
243 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.