103 SUBROUTINE zlarfg( N, ALPHA, X, INCX, TAU )
111 COMPLEX*16 ALPHA, TAU
120 DOUBLE PRECISION ONE, ZERO
121 parameter( one = 1.0d+0, zero = 0.0d+0 )
125 DOUBLE PRECISION ALPHI, ALPHR, BETA, RSAFMN, SAFMIN, XNORM
128 DOUBLE PRECISION DLAMCH, DLAPY3, DZNRM2
130 EXTERNAL dlamch, dlapy3, dznrm2, zladiv
133 INTRINSIC abs, dble, dcmplx, dimag, sign
145 xnorm = dznrm2( n-1, x, incx )
146 alphr = dble( alpha )
147 alphi = dimag( alpha )
149 IF( xnorm.EQ.zero .AND. alphi.EQ.zero )
THEN
158 beta = -sign( dlapy3( alphr, alphi, xnorm ), alphr )
159 safmin = dlamch(
'S' ) / dlamch(
'E' )
160 rsafmn = one / safmin
163 IF( abs( beta ).LT.safmin )
THEN
169 CALL zdscal( n-1, rsafmn, x, incx )
173 IF( (abs( beta ).LT.safmin) .AND. (knt .LT. 20) )
178 xnorm = dznrm2( n-1, x, incx )
179 alpha = dcmplx( alphr, alphi )
180 beta = -sign( dlapy3( alphr, alphi, xnorm ), alphr )
182 tau = dcmplx( ( beta-alphr ) / beta, -alphi / beta )
183 alpha = zladiv( dcmplx( one ), alpha-beta )
184 CALL zscal( n-1, alpha, x, incx )
subroutine zlarfg(n, alpha, x, incx, tau)
ZLARFG generates an elementary reflector (Householder matrix).