1 SUBROUTINE dlarfg( N, ALPHA, X, INCX, TAU )
10 DOUBLE PRECISION ALPHA, TAU
13 DOUBLE PRECISION X( * )
63 DOUBLE PRECISION ONE, ZERO
64 parameter( one = 1.0d+0, zero = 0.0d+0 )
68 DOUBLE PRECISION BETA, RSAFMN, SAFMIN, XNORM
71 DOUBLE PRECISION DLAMCH, DLAPY2, DNRM2
72 EXTERNAL dlamch, dlapy2, dnrm2
87 xnorm = dnrm2( n-1, x, incx )
89 IF( xnorm.EQ.zero )
THEN
98 beta = -sign( dlapy2( alpha, xnorm ), alpha )
99 safmin = dlamch(
'S' ) / dlamch(
'E' )
100 IF( abs( beta ).LT.safmin )
THEN
104 rsafmn = one / safmin
108 CALL dscal( n-1, rsafmn, x, incx )
111 IF( abs( beta ).LT.safmin )
116 xnorm = dnrm2( n-1, x, incx )
117 beta = -sign( dlapy2( alpha, xnorm ), alpha )
118 tau = ( beta-alpha ) / beta
119 CALL dscal( n-1, one / ( alpha-beta ), x, incx )
128 tau = ( beta-alpha ) / beta
129 CALL dscal( n-1, one / ( alpha-beta ), x, incx )
subroutine dlarfg(N, ALPHA, X, INCX, TAU)
subroutine dscal(n, da, dx, incx)