121 parameter( two = 2.0e+0, one = 1.0e+0, zero = 0.0e+0 )
125 REAL ALPHI, ALPHR, BETA, BIGNUM, EPS, SMLNUM, XNORM
129 REAL SCNRM2, SLAMCH, SLAPY3, SLAPY2
131 EXTERNAL scnrm2, slamch, slapy3, slapy2, cladiv
134 INTRINSIC abs, aimag, cmplx, real, sign
146 eps = slamch(
'Precision' )
147 xnorm = scnrm2( n-1, x, incx )
148 alphr = real( alpha )
149 alphi = aimag( alpha )
151 IF( xnorm.LE.eps*abs(alpha) )
THEN
155 IF( alphi.EQ.zero )
THEN
156 IF( alphr.GE.zero )
THEN
166 x( 1 + (j-1)*incx ) = zero
172 xnorm = slapy2( alphr, alphi )
173 tau = cmplx( one - alphr / xnorm, -alphi / xnorm )
175 x( 1 + (j-1)*incx ) = zero
183 beta = sign( slapy3( alphr, alphi, xnorm ), alphr )
184 smlnum = slamch(
'S' ) / slamch(
'E' )
185 bignum = one / smlnum
188 IF( abs( beta ).LT.smlnum )
THEN
194 CALL csscal( n-1, bignum, x, incx )
198 IF( (abs( beta ).LT.smlnum) .AND. (knt .LT. 20) )
203 xnorm = scnrm2( n-1, x, incx )
204 alpha = cmplx( alphr, alphi )
205 beta = sign( slapy3( alphr, alphi, xnorm ), alphr )
209 IF( beta.LT.zero )
THEN
213 alphr = alphi * (alphi/real( alpha ))
214 alphr = alphr + xnorm * (xnorm/real( alpha ))
215 tau = cmplx( alphr/beta, -alphi/beta )
216 alpha = cmplx( -alphr, alphi )
218 alpha = cladiv( cmplx( one ), alpha )
220 IF ( abs(tau).LE.smlnum )
THEN
229 alphr = real( savealpha )
230 alphi = aimag( savealpha )
231 IF( alphi.EQ.zero )
THEN
232 IF( alphr.GE.zero )
THEN
237 x( 1 + (j-1)*incx ) = zero
239 beta = real( -savealpha )
242 xnorm = slapy2( alphr, alphi )
243 tau = cmplx( one - alphr / xnorm, -alphi / xnorm )
245 x( 1 + (j-1)*incx ) = zero
254 CALL cscal( n-1, alpha, x, incx )
subroutine clarfgp(n, alpha, x, incx, tau)
CLARFGP generates an elementary reflector (Householder matrix) with non-negative beta.
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine cscal(n, ca, cx, incx)
CSCAL