1 SUBROUTINE pdlarfg( N, ALPHA, IAX, JAX, X, IX, JX, DESCX, INCX,
10 INTEGER IAX, INCX, IX, JAX, JX, N
11 DOUBLE PRECISION ALPHA
15 DOUBLE PRECISION 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 )
150 DOUBLE PRECISION ONE, ZERO
151 parameter( one = 1.0d+0, zero = 0.0d+0 )
154 INTEGER ICTXT, IIAX, INDXTAU, IXCOL, IXROW, J, JJAX,
155 $ knt, mycol, myrow, npcol, nprow
156 DOUBLE PRECISION BETA, RSAFMN, SAFMIN, XNORM
159 EXTERNAL blacs_gridinfo, dgebr2d, dgebs2d, pdscal,
163 DOUBLE PRECISION DLAMCH, DLAPY2
164 EXTERNAL dlamch, dlapy2
173 ictxt = descx( ctxt_ )
174 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
176 IF( incx.EQ.descx( m_ ) )
THEN
180 CALL infog2l( ix, jax, descx, nprow, npcol, myrow, mycol,
181 $ iiax, jjax, ixrow, ixcol )
188 IF( mycol.EQ.ixcol )
THEN
189 j = iiax+(jjax-1)*descx( lld_ )
190 CALL dgebs2d( ictxt,
'Rowwise',
' ', 1, 1, x( j ), 1 )
193 CALL dgebr2d( ictxt,
'Rowwise',
' ', 1, 1, alpha, 1,
203 CALL infog2l( iax, jx, descx, nprow, npcol, myrow, mycol,
204 $ iiax, jjax, ixrow, ixcol )
211 IF( myrow.EQ.ixrow )
THEN
212 j = iiax+(jjax-1)*descx( lld_ )
213 CALL dgebs2d( ictxt,
'Columnwise',
' ', 1, 1, x( j ), 1 )
216 CALL dgebr2d( ictxt,
'Columnwise',
' ', 1, 1, alpha, 1,
225 tau( indxtau ) = zero
229 CALL pdnrm2( n-1, xnorm, x, ix, jx, descx, incx )
231 IF( xnorm.EQ.zero )
THEN
235 tau( indxtau ) = zero
241 beta = -sign( dlapy2( alpha, xnorm ), alpha )
242 safmin = dlamch(
'S' )
243 rsafmn = one / safmin
244 IF( abs( beta ).LT.safmin )
THEN
251 CALL pdscal( n-1, rsafmn, x, ix, jx, descx, incx )
254 IF( abs( beta ).LT.safmin )
259 CALL pdnrm2( n-1, xnorm, x, ix, jx, descx, incx )
260 beta = -sign( dlapy2( alpha, xnorm ), alpha )
261 tau( indxtau ) = ( beta-alpha ) / beta
262 CALL pdscal( n-1, one/(alpha-beta), x, ix, jx, descx, incx )
271 tau( indxtau ) = ( beta-alpha ) / beta
272 CALL pdscal( n-1, one/(alpha-beta), x, ix, jx, descx, incx )