1 SUBROUTINE pdnepfchk( N, A, IA, JA, DESCA, IASEED, Z, IZ, JZ,
2 $ DESCZ, ANORM, FRESID, WORK )
10 INTEGER IA, IASEED, IZ, JA, JZ, N
11 DOUBLE PRECISION ANORM, FRESID
14 INTEGER DESCA( * ), DESCZ( * )
15 DOUBLE PRECISION A( * ), WORK( * ), Z( * )
149 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
150 $ lld_, mb_, m_, nb_, n_, rsrc_
151 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
152 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
153 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
154 DOUBLE PRECISION ONE, ZERO
155 parameter( one = 1.0d+0, zero = 0.0d+0 )
158 INTEGER I, IACOL, IAROW, IB, ICTXT, IIA, IOFFA, IROFF,
159 $ iw, j, jb, jja, jn, lda, ldw, mycol, myrow, np,
164 INTEGER DESCW( DLEN_ )
171 INTEGER ICEIL, NUMROC
172 DOUBLE PRECISION PDLAMCH, PDLANGE
173 EXTERNAL iceil, numroc, pdlamch, pdlange
180 ictxt = desca( ctxt_ )
181 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
182 eps = pdlamch( ictxt,
'eps' )
184 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
186 iroff = mod( ia-1, desca( mb_ ) )
187 np = numroc( n+iroff, desca( mb_ ), myrow, iarow, nprow )
194 CALL descset( descw, desca( mb_ ), n, desca( mb_ ), desca( nb_ ),
195 $ iarow, iacol, ictxt, desca( mb_ ) )
197 DO 10 i = ia, ia + n - 1, desca( mb_ )
198 ib =
min( ia+n-i, desca( mb_ ) )
200 CALL pdlacpy(
'All', ib, n, a, i, ja, desca, work, 1, 1,
202 CALL pdgemm(
'No transpose',
'Transpose', ib, n, n, one, work,
203 $ 1, 1, descw, z, iz, jz, descz, zero, a, i, ja,
206 descw( rsrc_ ) = mod( descw( rsrc_ )+1, nprow )
212 CALL descset( descw, n, desca( nb_ ), desca( mb_ ), desca( nb_ ),
213 $ iarow, iacol, ictxt, ldw )
215 DO 20 j = ja, ja + n - 1, desca( nb_ )
216 jb =
min( ja+n-j, desca( nb_ ) )
218 CALL pdlacpy(
'All', n, jb, a, ia, j, desca, work, 1, 1,
220 CALL pdgemm(
'No transpose',
'No transpose', n, jb, n, one, z,
221 $ iz, jz, descz, work, 1, 1, descw, zero, a, ia, j,
224 descw( csrc_ ) = mod( descw( csrc_ )+1, npcol )
230 jn =
min( iceil( ja, desca( nb_ ) )*desca( nb_ ), ja+n-1 )
232 ioffa = iia + ( jja-1 )*lda
235 descw( csrc_ ) = iacol
239 IF( mycol.EQ.descw( csrc_ ) )
THEN
240 CALL pdmatgen( ictxt,
'N',
'N', desca( m_ ), desca( n_ ),
241 $ desca( mb_ ), desca( nb_ ), work, ldw,
242 $ desca( rsrc_ ), desca( csrc_ ), iaseed, iia-1,
243 $ np, jja-1, jb, myrow, mycol, nprow, npcol )
244 CALL pdlaset(
'Lower',
max( 0, n-2 ), jb, zero, zero, work,
245 $
min( iw+2, n ), 1, descw )
246 CALL dmatadd( np, jb, -one, work, ldw, one, a( ioffa ), lda )
248 ioffa = ioffa + jb*lda
251 iw = iw + desca( mb_ )
252 descw( csrc_ ) = mod( descw( csrc_ )+1, npcol )
254 DO 30 j = jn + 1, ja + n - 1, desca( nb_ )
255 jb =
min( ja+n-j, desca( nb_ ) )
257 IF( mycol.EQ.descw( csrc_ ) )
THEN
258 CALL pdmatgen( ictxt,
'N',
'N', desca( m_ ), desca( n_ ),
259 $ desca( mb_ ), desca( nb_ ), work, ldw,
260 $ desca( rsrc_ ), desca( csrc_ ), iaseed,
261 $ iia-1, np, jja-1, jb, myrow, mycol, nprow,
263 CALL pdlaset(
'Lower',
max( 0, n-iw-1 ), jb, zero, zero,
264 $ work,
min( n, iw+2 ), 1, descw )
265 CALL dmatadd( np, jb, -one, work, ldw, one, a( ioffa ),
268 ioffa = ioffa + jb*lda
270 iw = iw + desca( mb_ )
271 descw( csrc_ ) = mod( descw( csrc_ )+1, npcol )
276 fresid = pdlange(
'I', n, n, a, ia, ja, desca, work ) /