1 SUBROUTINE pznepfchk( 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 COMPLEX*16 A( * ), WORK( * ), Z( * )
154 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
155 $ lld_, mb_, m_, nb_, n_, rsrc_
156 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
157 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
158 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
160 parameter( one = ( 1.0d+0, 0.0d+0 ),
161 $ zero = ( 0.0d+0, 0.0d+0 ) )
164 INTEGER I, IACOL, IAROW, IB, ICTXT, IIA, IOFFA, IROFF,
165 $ iw, j, jb, jja, jn, lda, ldw, mycol, myrow, np,
170 INTEGER DESCW( DLEN_ )
177 INTEGER ICEIL, NUMROC
178 DOUBLE PRECISION PDLAMCH, PZLANGE
179 EXTERNAL iceil, numroc, pdlamch, pzlange
186 ictxt = desca( ctxt_ )
187 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
188 eps = pdlamch( ictxt,
'eps' )
190 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
192 iroff = mod( ia-1, desca( mb_ ) )
193 np = numroc( n+iroff, desca( mb_ ), myrow, iarow, nprow )
200 CALL descset( descw, desca( mb_ ), n, desca( mb_ ), desca( nb_ ),
201 $ iarow, iacol, ictxt, desca( mb_ ) )
203 DO 10 i = ia, ia + n - 1, desca( mb_ )
204 ib =
min( ia+n-i, desca( mb_ ) )
206 CALL pzlacpy(
'All', ib, n, a, i, ja, desca, work, 1, 1,
208 CALL pzgemm(
'No transpose',
'Cong Tran', ib, n, n, one, work,
209 $ 1, 1, descw, z, iz, jz, descz, zero, a, i, ja,
212 descw( rsrc_ ) = mod( descw( rsrc_ )+1, nprow )
218 CALL descset( descw, n, desca( nb_ ), desca( mb_ ), desca( nb_ ),
219 $ iarow, iacol, ictxt, ldw )
221 DO 20 j = ja, ja + n - 1, desca( nb_ )
222 jb =
min( ja+n-j, desca( nb_ ) )
224 CALL pzlacpy(
'All', n, jb, a, ia, j, desca, work, 1, 1,
226 CALL pzgemm(
'No transpose',
'No transpose', n, jb, n, one, z,
227 $ iz, jz, descz, work, 1, 1, descw, zero, a, ia, j,
230 descw( csrc_ ) = mod( descw( csrc_ )+1, npcol )
236 jn =
min( iceil( ja, desca( nb_ ) )*desca( nb_ ), ja+n-1 )
238 ioffa = iia + ( jja-1 )*lda
241 descw( csrc_ ) = iacol
245 IF( mycol.EQ.descw( csrc_ ) )
THEN
246 CALL pzmatgen( ictxt,
'N',
'N', desca( m_ ), desca( n_ ),
247 $ desca( mb_ ), desca( nb_ ), work, ldw,
248 $ desca( rsrc_ ), desca( csrc_ ), iaseed, iia-1,
249 $ np, jja-1, jb, myrow, mycol, nprow, npcol )
250 CALL pzlaset(
'Lower',
max( 0, n-2 ), jb, zero, zero, work,
251 $
min( iw+2, n ), 1, descw )
252 CALL zmatadd( np, jb, -one, work, ldw, one, a( ioffa ), lda )
254 ioffa = ioffa + jb*lda
257 iw = iw + desca( mb_ )
258 descw( csrc_ ) = mod( descw( csrc_ )+1, npcol )
260 DO 30 j = jn + 1, ja + n - 1, desca( nb_ )
261 jb =
min( ja+n-j, desca( nb_ ) )
263 IF( mycol.EQ.descw( csrc_ ) )
THEN
264 CALL pzmatgen( ictxt,
'N',
'N', desca( m_ ), desca( n_ ),
265 $ desca( mb_ ), desca( nb_ ), work, ldw,
266 $ desca( rsrc_ ), desca( csrc_ ), iaseed,
267 $ iia-1, np, jja-1, jb, myrow, mycol, nprow,
269 CALL pzlaset(
'Lower',
max( 0, n-iw-1 ), jb, zero, zero,
270 $ work,
min( n, iw+2 ), 1, descw )
271 CALL zmatadd( np, jb, -one, work, ldw, one, a( ioffa ),
274 ioffa = ioffa + jb*lda
276 iw = iw + desca( mb_ )
277 descw( csrc_ ) = mod( descw( csrc_ )+1, npcol )
282 fresid = pzlange(
'I', n, n, a, ia, ja, desca, work ) /