107 SUBROUTINE clarfg( N, ALPHA, X, INCX, TAU )
126 parameter ( one = 1.0e+0, zero = 0.0e+0 )
130 REAL ALPHI, ALPHR, BETA, RSAFMN, SAFMIN, XNORM
133 REAL SCNRM2, SLAMCH, SLAPY3
135 EXTERNAL scnrm2, slamch, slapy3, cladiv
138 INTRINSIC abs, aimag, cmplx,
REAL, SIGN
150 xnorm = scnrm2( n-1, x, incx )
151 alphr =
REAL( alpha )
152 alphi = aimag( alpha )
154 IF( xnorm.EQ.zero .AND. alphi.EQ.zero )
THEN
163 beta = -sign( slapy3( alphr, alphi, xnorm ), alphr )
164 safmin = slamch(
'S' ) / slamch(
'E' )
165 rsafmn = one / safmin
168 IF( abs( beta ).LT.safmin )
THEN
174 CALL csscal( n-1, rsafmn, x, incx )
178 IF( abs( beta ).LT.safmin )
183 xnorm = scnrm2( n-1, x, incx )
184 alpha = cmplx( alphr, alphi )
185 beta = -sign( slapy3( alphr, alphi, xnorm ), alphr )
187 tau = cmplx( ( beta-alphr ) / beta, -alphi / beta )
188 alpha = cladiv( cmplx( one ), alpha-beta )
189 CALL cscal( n-1, alpha, x, incx )
subroutine cscal(N, CA, CX, INCX)
CSCAL
subroutine clarfg(N, ALPHA, X, INCX, TAU)
CLARFG generates an elementary reflector (Householder matrix).
subroutine csscal(N, SA, CX, INCX)
CSSCAL