107 SUBROUTINE slarfg( N, ALPHA, X, INCX, TAU )
126 parameter ( one = 1.0e+0, zero = 0.0e+0 )
130 REAL BETA, RSAFMN, SAFMIN, XNORM
133 REAL SLAMCH, SLAPY2, SNRM2
134 EXTERNAL slamch, slapy2, snrm2
149 xnorm = snrm2( n-1, x, incx )
151 IF( xnorm.EQ.zero )
THEN
160 beta = -sign( slapy2( alpha, xnorm ), alpha )
161 safmin = slamch(
'S' ) / slamch(
'E' )
163 IF( abs( beta ).LT.safmin )
THEN
167 rsafmn = one / safmin
170 CALL sscal( n-1, rsafmn, x, incx )
173 IF( abs( beta ).LT.safmin )
178 xnorm = snrm2( n-1, x, incx )
179 beta = -sign( slapy2( alpha, xnorm ), alpha )
181 tau = ( beta-alpha ) / beta
182 CALL sscal( n-1, one / ( alpha-beta ), x, incx )
subroutine slarfg(N, ALPHA, X, INCX, TAU)
SLARFG generates an elementary reflector (Householder matrix).
subroutine sscal(N, SA, SX, INCX)
SSCAL