IBM Books

Parallel Engineering and Scientific Subroutine Library for AIX Version 2 Release 3: Guide and Reference

PDSPINS--Inserts Local Data into a General Sparse Matrix

This sparse utility subroutine is used by each process to insert all blocks of data it owns into its local part of the general sparse matrix A.

Syntax

Fortran CALL PDSPINS (as, ia1, ia2, infoa, desc_a, ia, ja, blcks, ib1, ib2, infob)
C and C++ pdspins (as, ia1, ia2, infoa, desc_a, ia, ja, blcks, ib1, ib2, infob);

On Entry

as
is the local part of the global general sparse matrix A that is produced on a preceding call to PDSPINIT or previous call(s) to this subroutine.

Scope: local

Specified as: a one-dimensional array of (at least) length INFOA(1), containing long-precision real numbers.

ia1
is the local part of array IA1 that is produced on a preceding call to PDSPINIT or previous call(s) to this subroutine.

Scope: local

Specified as: a one-dimensional array of (at least) length INFOA(2), containing fullword integers.

ia2
is the local part of the array IA2 that is produced on a preceding call to PDSPINIT or previous call(s) to this subroutine.

Scope: local

Specified as: a one-dimensional array of (at least) length INFOA(3), containing fullword integers.

infoa
is the array INFOA that is produced on a preceding call to PDSPINIT or previous call(s) to this subroutine.

Specified as: an array of length 30, containing fullword integers.

desc_a
is the array descriptor for a global general sparse matrix A that is produced on a preceding call to PDSPINIT or previous call(s) to this subroutine.

Specified as: an array of length DLEN, containing fullword integers.

ia
is the first global row index of the general sparse matrix A that receives data from the submatrix BLCK.

Scope: local

Specified as: a fullword integer; 1 <= ia <= M.

ja
is the first global column index of the general sparse matrix A that receives data from the submatrix BLCK.

Scope: local

Specified as: a fullword integer, where: ja = 1.

blcks
is the local part of the sparse submatrix BLCK, referred to as BLCKS, to be inserted into the global general sparse matrix A. Each call to this subroutine inserts one contiguous block of rows into the local part of the sparse matrix corresponding to the global submatrix Aia:ia+INFOB(6)-1, ja:ja+INFOB(7)-1. This subroutine only can insert blocks of data it owns into its local part of the general sparse matrix A.

Scope: local

Specified as: a one-dimensional array of (at least) length INFOB(1), containing long-precision real numbers.

ib1
is an array, referred to as IB1, containing column numbers of each non-zero element in the submatrix BLCK.

Scope: local

Specified as: a one-dimensional array of (at least) length INFOB(2), containing fullword integers.

ib2
is the array, referred to as IB2, containing the starting positions of each row of the submatrix BLCK in array BLCKS and one position past the end of BLCKS.

Scope: local

Specified as: a one-dimensional array of (at least) length INFOB(3), containing fullword integers:

IB2(1) = 1
IB2(INFOB(6)+1) = 1+nz and nz is the actual number of non-zero elements in the submatrix BLCK.

infob
is an array, referred to as INFOB, providing information about the submatrix BLCK. You must specify INFOB(1) through INFOB(7), as follows:

Specified as: an array of length 30, containing fullword integers.

On Return

as
is the updated local part of the global general sparse matrix A, updated with data from the submatrix BLCK.

Scope: local

Returned as: a one-dimensional array of (at least) length INFOA(1), containing long-precision real numbers.

ia1
is the updated local part of array IA1.

Scope: local

Returned as: a one-dimensional array of (at least) length INFOA(2), containing fullword integers.

ia2
is the updated local part of the array IA2.

Scope: local

Returned as: a one-dimensional array of (at least) length INFOA(3), containing fullword integers.

infoa
is the updated local part of array INFOA.

Returned as: an array of length 30, containing fullword integers.

desc_a
is the updated array descriptor for the global general sparse matrix A.

Returned as: an array of length DLEN, containing fullword integers.

Notes and Coding Rules
  1. Before you call this subroutine, you must have called PADINIT and PDSPINIT.
  2. Arguments BLCK and A must not have common elements; otherwise, results are unpredictable.
  3. For more details about N_ROW, N_COL, and other elements of desc_a, see Table 28.
  4. For details about some of the elements stored in infoa or infob, see Table 27.
  5. The submatrix BLCK must be stored by rows; that is INFOB(4) = 1. For information about the storage-by-rows storage mode, see the ESSL Version 3 Guide and Reference.
  6. Each process has to call PDSPINS as many times as necessary to insert the local rows it owns. It is also possible to call PDSPINS multiple times to insert different or duplicate coefficients of the same local row it owns. For information on how duplicate coefficients are handled, see the dupflag argument description in PDSPASB. For an example of inserting coefficients of the same local row, see Example.

Error Conditions

Computational Errors

None.

Resource Errors

None.

Input-Argument and Miscellaneous Errors

Stage 1 

  1. The BLACS context is invalid.

Stage 2 

  1. This subroutine was called from outside the process grid.

Stage 3 

  1. The process grid is not np × 1.
  2. ja <> 1
  3. desc_a is not valid.
  4. The sparse matrix A is not valid.
  5. INFOB(4) <> 1
  6. INFOB(5) <> 1
  7. INFOB(6) < 1 or INFOB(6) > N_ROW
  8. INFOB(7) < 1 or INFOB(7) > n
  9. ia < 1 or ia > M
  10. One or more rows to be inserted into submatrix A does not belong to the process.
  11. DLEN is too small. For valid values, see Array Descriptor.
  12. INFOB(1) < nz; that is, the size of BLCKS < nz
  13. INFOB(2) < nz; that is, the size of IB1 < nz
  14. INFOB(3) < (INFOB(6)+1); that is, the size of IB2 < (INFOB(6)+1)
  15. INFOA(1) < max(2,nnze); that is, the size of AS < max(2,nnze)
  16. INFOA(2) < max(3,(nnze+N_ROW)); that is, the size of IA1 < max(3,(nnze+N_ROW))
  17. INFOA(3) < max(3,(nnze+N_COL)); that is, the size of IA2 < max(3,(nnze+N_COL))

Example

This piece of an example shows how to insert coefficients into the same GLOB_ROW row by calling PDSPINS multiple times. This example would be useful in finite element applications, where PDSPINS inserts one element at a time into the global matrix, but more than one element may contribute to the same matrix row. In this case, PDSPINS is called with the same value of ia by all the elements contributing to that row.

For a complete example, see Example--Using the Fortran 77 Sparse Subroutines.

            .
            .
            .
      DO GLOB_ROW = 1, N
 
         RINFOA(1) = 20
         RINFOA(2) = 20
         RINFOA(3) = 20
         RINFOA(4) = 1
         RINFOA(5) = 1
         RINFOA(6) = 1
         RINFOA(7) = N
         RIA2(1)   = 1
         RIA2(2)   = 2
         IA = GLOB_ROW
 
C       	  !       (x-1,y)
         RAS(1)  = COEFF(X-1,Y,X,Y)
         RIA1(1) = IDX(X-1,Y)
         CALL PDSPINS(AS,IA1,IA2,INFOA,DESC_A,
     +      IA,1,RAS,RIA1,RIA2,RINFOA)
C       	  !       (x,y-1)
         RAS(1)  = COEFF(X,Y-1,X,Y)
         RIA1(1) = IDX(X,Y-1)
         CALL PDSPINS(AS,IA1,IA2,INFOA,DESC_A,
     +      IA,1,RAS,RIA1,RIA2,RINFOA)
C       	  !       (x,y)
         RAS(1)  = COEFF(X,Y,X,Y)
         RIA1(1) = IDX(X,Y)
         CALL PDSPINS(AS,IA1,IA2,INFOA,DESC_A,
     +      IA,1,RAS,RIA1,RIA2,RINFOA)
 
C       	  !       (x,y+1)
         RAS(1)  = COEFF(X,Y+1,X,Y)
         RIA1(1) = IDX(X,Y+1)
         CALL PDSPINS(AS,IA1,IA2,INFOA,DESC_A,
     +      IA,1,RAS,RIA1,RIA2,RINFOA)
 
C       	  !       (x+1,y)
         RAS(1)  = COEFF(X+1,Y,X,Y)
         RIA1(1) = IDX(X+1,Y)
         CALL PDSPINS(AS,IA1,IA2,INFOA,DESC_A,
     +      IA,1,RAS,RIA1,RIA2,RINFOA)
 
      END DO
            .
            .
            .


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]