107 SUBROUTINE dlarfg( N, ALPHA, X, INCX, TAU )
116 DOUBLE PRECISION ALPHA, TAU
119 DOUBLE PRECISION X( * )
125 DOUBLE PRECISION ONE, ZERO
126 parameter ( one = 1.0d+0, zero = 0.0d+0 )
130 DOUBLE PRECISION BETA, RSAFMN, SAFMIN, XNORM
133 DOUBLE PRECISION DLAMCH, DLAPY2, DNRM2
134 EXTERNAL dlamch, dlapy2, dnrm2
149 xnorm = dnrm2( n-1, x, incx )
151 IF( xnorm.EQ.zero )
THEN
160 beta = -sign( dlapy2( alpha, xnorm ), alpha )
161 safmin = dlamch(
'S' ) / dlamch(
'E' )
163 IF( abs( beta ).LT.safmin )
THEN
167 rsafmn = one / safmin
170 CALL dscal( n-1, rsafmn, x, incx )
173 IF( abs( beta ).LT.safmin )
178 xnorm = dnrm2( n-1, x, incx )
179 beta = -sign( dlapy2( alpha, xnorm ), alpha )
181 tau = ( beta-alpha ) / beta
182 CALL dscal( n-1, one / ( alpha-beta ), x, incx )
subroutine dscal(N, DA, DX, INCX)
DSCAL
subroutine dlarfg(N, ALPHA, X, INCX, TAU)
DLARFG generates an elementary reflector (Householder matrix).