1 SUBROUTINE pclarfg( N, ALPHA, IAX, JAX, X, IX, JX, DESCX, INCX,
10 INTEGER IAX, INCX, IX, JAX, JX, N
15 COMPLEX TAU( * ), X( * )
145 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
146 $ lld_, mb_, m_, nb_, n_, rsrc_
147 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
148 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
149 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
151 parameter( one = 1.0e+0, zero = 0.0e+0 )
154 INTEGER ICTXT, IIAX, INDXTAU, IXCOL, IXROW, J, JJAX,
155 $ knt, mycol, myrow, npcol, nprow
156 REAL ALPHI, ALPHR, BETA, RSAFMN, SAFMIN, XNORM
159 EXTERNAL blacs_gridinfo, cgebr2d, cgebs2d, pcscal,
165 EXTERNAL cladiv, slapy3, slamch
168 INTRINSIC abs, aimag,
cmplx, real, sign
174 ictxt = descx( ctxt_ )
175 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
177 IF( incx.EQ.descx( m_ ) )
THEN
181 CALL infog2l( ix, jax, descx, nprow, npcol, myrow, mycol,
182 $ iiax, jjax, ixrow, ixcol )
189 IF( mycol.EQ.ixcol )
THEN
190 j = iiax+(jjax-1)*descx( lld_ )
191 CALL cgebs2d( ictxt,
'Rowwise',
' ', 1, 1, x( j ), 1 )
194 CALL cgebr2d( ictxt,
'Rowwise',
' ', 1, 1, alpha, 1,
204 CALL infog2l( iax, jx, descx, nprow, npcol, myrow, mycol,
205 $ iiax, jjax, ixrow, ixcol )
212 IF( myrow.EQ.ixrow )
THEN
213 j = iiax+(jjax-1)*descx( lld_ )
214 CALL cgebs2d( ictxt,
'Columnwise',
' ', 1, 1, x( j ), 1 )
217 CALL cgebr2d( ictxt,
'Columnwise',
' ', 1, 1, alpha, 1,
226 tau( indxtau ) = zero
230 CALL pscnrm2( n-1, xnorm, x, ix, jx, descx, incx )
231 alphr = real( alpha )
232 alphi = aimag( alpha )
234 IF( xnorm.EQ.zero .AND. alphi.EQ.zero )
THEN
238 tau( indxtau ) = zero
244 beta = -sign( slapy3( alphr, alphi, xnorm ), alphr )
245 safmin = slamch(
'S' )
246 rsafmn = one / safmin
247 IF( abs( beta ).LT.safmin )
THEN
254 CALL pcsscal( n-1, rsafmn, x, ix, jx, descx, incx )
258 IF( abs( beta ).LT.safmin )
263 CALL pscnrm2( n-1, xnorm, x, ix, jx, descx, incx )
264 alpha =
cmplx( alphr, alphi )
265 beta = -sign( slapy3( alphr, alphi, xnorm ), alphr )
266 tau( indxtau ) =
cmplx( ( beta-alphr ) / beta,
268 alpha = cladiv(
cmplx( one ), alpha-beta )
269 CALL pcscal( n-1, alpha, x, ix, jx, descx, incx )
278 tau( indxtau ) =
cmplx( ( beta-alphr ) / beta,
280 alpha = cladiv(
cmplx( one ), alpha-beta )
281 CALL pcscal( n-1, alpha, x, ix, jx, descx, incx )