105 SUBROUTINE zlarfg( N, ALPHA, X, INCX, TAU )
113 COMPLEX*16 ALPHA, TAU
122 DOUBLE PRECISION ONE, ZERO
123 parameter( one = 1.0d+0, zero = 0.0d+0 )
127 DOUBLE PRECISION ALPHI, ALPHR, BETA, RSAFMN, SAFMIN, XNORM
130 DOUBLE PRECISION DLAMCH, DLAPY3, DZNRM2
132 EXTERNAL dlamch, dlapy3, dznrm2, zladiv
135 INTRINSIC abs, dble, dcmplx, dimag, sign
147 xnorm = dznrm2( n-1, x, incx )
148 alphr = dble( alpha )
149 alphi = dimag( alpha )
151 IF( xnorm.EQ.zero .AND. alphi.EQ.zero )
THEN
160 beta = -sign( dlapy3( alphr, alphi, xnorm ), alphr )
161 safmin = dlamch(
'S' ) / dlamch(
'E' )
162 rsafmn = one / safmin
165 IF( abs( beta ).LT.safmin )
THEN
171 CALL zdscal( n-1, rsafmn, x, incx )
175 IF( (abs( beta ).LT.safmin) .AND. (knt .LT. 20) )
180 xnorm = dznrm2( n-1, x, incx )
181 alpha = dcmplx( alphr, alphi )
182 beta = -sign( dlapy3( alphr, alphi, xnorm ), alphr )
184 tau = dcmplx( ( beta-alphr ) / beta, -alphi / beta )
185 alpha = zladiv( dcmplx( one ), alpha-beta )
186 CALL zscal( n-1, alpha, x, incx )
subroutine zlarfg(n, alpha, x, incx, tau)
ZLARFG generates an elementary reflector (Householder matrix).
subroutine zdscal(n, da, zx, incx)
ZDSCAL
subroutine zscal(n, za, zx, incx)
ZSCAL