107 SUBROUTINE zlarfg( N, ALPHA, X, INCX, TAU )
116 COMPLEX*16 ALPHA, TAU
125 DOUBLE PRECISION ONE, ZERO
126 parameter ( one = 1.0d+0, zero = 0.0d+0 )
130 DOUBLE PRECISION ALPHI, ALPHR, BETA, RSAFMN, SAFMIN, XNORM
133 DOUBLE PRECISION DLAMCH, DLAPY3, DZNRM2
135 EXTERNAL dlamch, dlapy3, dznrm2, zladiv
138 INTRINSIC abs, dble, dcmplx, dimag, sign
150 xnorm = dznrm2( n-1, x, incx )
151 alphr = dble( alpha )
152 alphi = dimag( alpha )
154 IF( xnorm.EQ.zero .AND. alphi.EQ.zero )
THEN
163 beta = -sign( dlapy3( alphr, alphi, xnorm ), alphr )
164 safmin = dlamch(
'S' ) / dlamch(
'E' )
165 rsafmn = one / safmin
168 IF( abs( beta ).LT.safmin )
THEN
174 CALL zdscal( n-1, rsafmn, x, incx )
178 IF( abs( beta ).LT.safmin )
183 xnorm = dznrm2( n-1, x, incx )
184 alpha = dcmplx( alphr, alphi )
185 beta = -sign( dlapy3( alphr, alphi, xnorm ), alphr )
187 tau = dcmplx( ( beta-alphr ) / beta, -alphi / beta )
188 alpha = zladiv( dcmplx( one ), alpha-beta )
189 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