SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ pchk2mat()

subroutine pchk2mat ( integer  ma,
integer  mapos0,
integer  na,
integer  napos0,
integer  ia,
integer  ja,
integer, dimension( * )  desca,
integer  descapos0,
integer  mb,
integer  mbpos0,
integer  nb,
integer  nbpos0,
integer  ib,
integer  jb,
integer, dimension( 8 )  descb,
integer  descbpos0,
integer  nextra,
integer, dimension( nextra )  ex,
integer, dimension( nextra )  expos,
integer  info 
)

Definition at line 172 of file pchkxmat.f.

175*
176* -- ScaLAPACK tools routine (version 1.7) --
177* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
178* and University of California, Berkeley.
179* May 1, 1997
180*
181* .. Scalar Arguments ..
182 INTEGER DESCAPOS0, DESCBPOS0, IA, IB, INFO, JA, JB, MA,
183 $ MAPOS0, MB, MBPOS0, NA, NAPOS0, NB, NBPOS0,
184 $ NEXTRA
185* ..
186* .. Array Arguments ..
187 INTEGER DESCA( * ), DESCB( 8 ), EX( NEXTRA ),
188 $ EXPOS( NEXTRA )
189* ..
190*
191* Purpose
192* =======
193*
194* PCHK2MAT checks that the values associated with two distributed
195* matrices are consistant across the entire process grid.
196*
197* Notes
198* =====
199*
200* This routine checks that all values are the same across the grid.
201* It does no local checking; it is therefore legal to abuse the
202* definitions of the non-descriptor arguments, i.e., if the routine
203* you are checking does not possess a MA value, you may pass some
204* other integer that must be global into this argument instead.
205*
206* Arguments
207* =========
208*
209* MA (global input) INTEGER
210* The global number of matrix rows of A being operated on.
211*
212* MAPOS0 (global input) INTEGER
213* Where in the calling routine's parameter list MA appears.
214*
215* NA (global input) INTEGER
216* The global number of matrix columns of A being operated on.
217*
218* NAPOS0 (global input) INTEGER
219* Where in the calling routine's parameter list NA appears.
220*
221* IA (global input) INTEGER
222* The row index in the global array A indicating the first
223* row of sub( A ).
224*
225* JA (global input) INTEGER
226* The column index in the global array A indicating the
227* first column of sub( A ).
228*
229* DESCA (global and local input) INTEGER array of dimension DLEN_.
230* The array descriptor for the distributed matrix A.
231*
232* DESCAPOS0 (global input) INTEGER
233* Where in the calling routine's parameter list DESCA
234* appears. Note that we assume IA and JA are respectively 2
235* and 1 entries behind DESCA.
236*
237* MB (global input) INTEGER
238* The global number of matrix rows of B being operated on.
239*
240* MBPOS0 (global input) INTEGER
241* Where in the calling routine's parameter list MB appears.
242*
243* NB (global input) INTEGER
244* The global number of matrix columns of B being operated on.
245*
246* NBPOS0 (global input) INTEGER
247* Where in the calling routine's parameter list NB appears.
248*
249* IB (global input) INTEGER
250* The row index in the global array B indicating the first
251* row of sub( B ).
252*
253* JB (global input) INTEGER
254* The column index in the global array B indicating the
255* first column of sub( B ).
256*
257* DESCB (global and local input) INTEGER array of dimension DLEN_.
258* The array descriptor for the distributed matrix B.
259*
260* DESCBPOS0 (global input) INTEGER
261* Where in the calling routine's parameter list DESCB
262* appears. Note that we assume IB and JB are respectively 2
263* and 1 entries behind DESCB.
264*
265* NEXTRA (global input) INTEGER
266* The number of extra parameters (i.e., besides the ones
267* above) to check. NEXTRA <= LDW - 22.
268*
269* EX (local input) INTEGER array of dimension (NEXTRA)
270* The values of these extra parameters
271*
272* EXPOS (local input) INTEGER array of dimension (NEXTRA)
273* The parameter list positions of these extra values.
274*
275* INFO (local input/global output) INTEGER
276* = 0: successful exit
277* < 0: If the i-th argument is an array and the j-entry had
278* an illegal value, then INFO = -(i*100+j), if the i-th
279* argument is a scalar and had an illegal value, then
280* INFO = -i.
281*
282* =====================================================================
283*
284* .. Parameters ..
285 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
286 $ LLD_, MB_, M_, NB_, N_, RSRC_
287 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
288 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
289 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
290 INTEGER DESCMULT, BIGNUM, LDW
291 parameter( descmult = 100, bignum = descmult * descmult,
292 $ ldw = 35 )
293* ..
294* .. Local Scalars ..
295 INTEGER K, DESCPOS
296* ..
297* .. Local Arrays ..
298 INTEGER IWORK( LDW, 2 ), IWORK2( LDW )
299* ..
300* .. External Subroutines ..
301 EXTERNAL globchk
302* ..
303* .. Intrinsic Functions ..
304 INTRINSIC mod
305* ..
306* .. Executable Statements ..
307*
308* Want to find errors with MIN( ), so if no error, set it to a big
309* number. If there already is an error, multiply by the the
310* descriptor multiplier.
311*
312 IF( info.GE.0 ) THEN
313 info = bignum
314 ELSE IF( info.LT.-descmult ) THEN
315 info = -info
316 ELSE
317 info = -info * descmult
318 END IF
319*
320* Pack values and their positions in the parameter list, factoring
321* in the descriptor multiplier
322*
323 iwork( 1, 1 ) = ma
324 iwork( 1, 2 ) = mapos0 * descmult
325 iwork( 2, 1 ) = na
326 iwork( 2, 2 ) = napos0 * descmult
327 iwork( 3, 1 ) = ia
328 iwork( 3, 2 ) = (descapos0-2) * descmult
329 iwork( 4, 1 ) = ja
330 iwork( 4, 2 ) = (descapos0-1) * descmult
331 descpos = descapos0 * descmult
332*
333 iwork( 5, 1 ) = desca( dtype_ )
334 iwork( 5, 2 ) = descpos + dtype_
335 iwork( 6, 1 ) = desca( m_ )
336 iwork( 6, 2 ) = descpos + m_
337 iwork( 7, 1 ) = desca( n_ )
338 iwork( 7, 2 ) = descpos + n_
339 iwork( 8, 1 ) = desca( mb_ )
340 iwork( 8, 2 ) = descpos + mb_
341 iwork( 9, 1 ) = desca( nb_ )
342 iwork( 9, 2 ) = descpos + nb_
343 iwork( 10, 1 ) = desca( rsrc_ )
344 iwork( 10, 2 ) = descpos + rsrc_
345 iwork( 11, 1 ) = desca( csrc_ )
346 iwork( 11, 2 ) = descpos + csrc_
347*
348 iwork( 12, 1 ) = mb
349 iwork( 12, 2 ) = mbpos0 * descmult
350 iwork( 13, 1 ) = nb
351 iwork( 13, 2 ) = nbpos0 * descmult
352 iwork( 14, 1 ) = ib
353 iwork( 14, 2 ) = (descbpos0-2) * descmult
354 iwork( 15, 1 ) = jb
355 iwork( 15, 2 ) = (descbpos0-1) * descmult
356 descpos = descbpos0 * descmult
357*
358 iwork( 16, 1 ) = descb( dtype_ )
359 iwork( 16, 2 ) = descpos + dtype_
360 iwork( 17, 1 ) = descb( m_ )
361 iwork( 17, 2 ) = descpos + m_
362 iwork( 18, 1 ) = descb( n_ )
363 iwork( 18, 2 ) = descpos + n_
364 iwork( 19, 1 ) = descb( mb_ )
365 iwork( 19, 2 ) = descpos + mb_
366 iwork( 20, 1 ) = descb( nb_ )
367 iwork( 20, 2 ) = descpos + nb_
368 iwork( 21, 1 ) = descb( rsrc_ )
369 iwork( 21, 2 ) = descpos + rsrc_
370 iwork( 22, 1 ) = descb( csrc_ )
371 iwork( 22, 2 ) = descpos + csrc_
372*
373 IF( nextra.GT.0 ) THEN
374 DO 10 k = 1, nextra
375 iwork( 22+k, 1 ) = ex( k )
376 iwork( 22+k, 2 ) = expos( k )
377 10 CONTINUE
378 END IF
379 k = 22 + nextra
380*
381* Get the smallest error detected anywhere (BIGNUM if no error)
382*
383 CALL globchk( desca( ctxt_ ), k, iwork, ldw, iwork2, info )
384*
385* Prepare output: set info = 0 if no error, and divide by DESCMULT
386* if error is not in a descriptor entry.
387*
388 IF( info.EQ.bignum ) THEN
389 info = 0
390 ELSE IF( mod( info, descmult ) .EQ. 0 ) THEN
391 info = -info / descmult
392 ELSE
393 info = -info
394 END IF
395*
396 RETURN
397*
398* End of PCHK2MAT
399*
subroutine globchk(ictxt, n, x, ldx, iwork, info)
Definition pchkxmat.f:403
Here is the call graph for this function: