1 SUBROUTINE pzlarfg( N, ALPHA, IAX, JAX, X, IX, JX, DESCX, INCX,
10 INTEGER IAX, INCX, IX, JAX, JX, N
15 COMPLEX*16 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 ALPHI, ALPHR, BETA, RSAFMN, SAFMIN, XNORM
159 EXTERNAL blacs_gridinfo,
infog2l, pdznrm2,
160 $ zgebr2d, zgebs2d, pzscal,
164 DOUBLE PRECISION DLAMCH, DLAPY3
166 EXTERNAL dlamch, dlapy3, zladiv
169 INTRINSIC abs, dble, dcmplx, dimag, sign
175 ictxt = descx( ctxt_ )
176 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
178 IF( incx.EQ.descx( m_ ) )
THEN
182 CALL infog2l( ix, jax, descx, nprow, npcol, myrow, mycol,
183 $ iiax, jjax, ixrow, ixcol )
190 IF( mycol.EQ.ixcol )
THEN
191 j = iiax+(jjax-1)*descx( lld_ )
192 CALL zgebs2d( ictxt,
'Rowwise',
' ', 1, 1, x( j ), 1 )
195 CALL zgebr2d( ictxt,
'Rowwise',
' ', 1, 1, alpha, 1,
205 CALL infog2l( iax, jx, descx, nprow, npcol, myrow, mycol,
206 $ iiax, jjax, ixrow, ixcol )
213 IF( myrow.EQ.ixrow )
THEN
214 j = iiax+(jjax-1)*descx( lld_ )
215 CALL zgebs2d( ictxt,
'Columnwise',
' ', 1, 1, x( j ), 1 )
218 CALL zgebr2d( ictxt,
'Columnwise',
' ', 1, 1, alpha, 1,
227 tau( indxtau ) = zero
231 CALL pdznrm2( n-1, xnorm, x, ix, jx, descx, incx )
232 alphr = dble( alpha )
233 alphi = dimag( alpha )
235 IF( xnorm.EQ.zero .AND. alphi.EQ.zero )
THEN
239 tau( indxtau ) = zero
245 beta = -sign( dlapy3( alphr, alphi, xnorm ), alphr )
246 safmin = dlamch(
'S' )
247 rsafmn = one / safmin
248 IF( abs( beta ).LT.safmin )
THEN
255 CALL pzdscal( n-1, rsafmn, x, ix, jx, descx, incx )
259 IF( abs( beta ).LT.safmin )
264 CALL pdznrm2( n-1, xnorm, x, ix, jx, descx, incx )
265 alpha = dcmplx( alphr, alphi )
266 beta = -sign( dlapy3( alphr, alphi, xnorm ), alphr )
267 tau( indxtau ) = dcmplx( ( beta-alphr ) / beta,
269 alpha = zladiv( dcmplx( one ), alpha-beta )
270 CALL pzscal( n-1, alpha, x, ix, jx, descx, incx )
279 tau( indxtau ) = dcmplx( ( beta-alphr ) / beta,
281 alpha = zladiv( dcmplx( one ), alpha-beta )
282 CALL pzscal( n-1, alpha, x, ix, jx, descx, incx )