109 DOUBLE PRECISION ALPHA, TAU
112 DOUBLE PRECISION X( * )
118 DOUBLE PRECISION TWO, ONE, ZERO
119 parameter( two = 2.0d+0, one = 1.0d+0, zero = 0.0d+0 )
123 DOUBLE PRECISION BETA, BIGNUM, EPS, SAVEALPHA, SMLNUM, XNORM
126 DOUBLE PRECISION DLAMCH, DLAPY2, DNRM2
127 EXTERNAL dlamch, dlapy2, dnrm2
142 eps = dlamch(
'Precision' )
143 xnorm = dnrm2( n-1, x, incx )
145 IF( xnorm.LE.eps*abs(alpha) )
THEN
149 IF( alpha.GE.zero )
THEN
159 x( 1 + (j-1)*incx ) = 0
167 beta = sign( dlapy2( alpha, xnorm ), alpha )
168 smlnum = dlamch(
'S' ) / dlamch(
'E' )
170 IF( abs( beta ).LT.smlnum )
THEN
174 bignum = one / smlnum
177 CALL dscal( n-1, bignum, x, incx )
180 IF( (abs( beta ).LT.smlnum) .AND. (knt .LT. 20) )
185 xnorm = dnrm2( n-1, x, incx )
186 beta = sign( dlapy2( alpha, xnorm ), alpha )
190 IF( beta.LT.zero )
THEN
194 alpha = xnorm * (xnorm/alpha)
199 IF ( abs(tau).LE.smlnum )
THEN
208 IF( savealpha.GE.zero )
THEN
213 x( 1 + (j-1)*incx ) = 0
222 CALL dscal( n-1, one / alpha, x, incx )
subroutine dlarfgp(n, alpha, x, incx, tau)
DLARFGP generates an elementary reflector (Householder matrix) with non-negative beta.