Date: 2016-07-24T16:58:42+00:00

Actual source code: setr.c
petsc-3.7.3 2016-07-24
Report Typos and Errors

      2: /* setr.f -- translated by f2c (version of 25 March 1992  12:58:56). */

      4: #include <../src/mat/color/impls/minpack/color.h>

      8: PetscErrorCode MINPACKsetr(PetscInt *m,PetscInt * n,PetscInt * indrow,PetscInt * jpntr,PetscInt * indcol, PetscInt *ipntr,PetscInt * iwa)
      9: {
     10:   /* System generated locals */
     11:   PetscInt i__1, i__2;

     13:   /* Local variables */
     14:   PetscInt jcol, jp, ir;

     16: /*     Given a column-oriented definition of the sparsity pattern */
     17: /*     of an m by n matrix A, this subroutine determines a */
     18: /*     row-oriented definition of the sparsity pattern of A. */
     19: /*     On input the column-oriented definition is specified by */
     20: /*     the arrays indrow and jpntr. On output the row-oriented */
     21: /*     definition is specified by the arrays indcol and ipntr. */
     22: /*     The subroutine statement is */
     23: /*       subroutine setr(m,n,indrow,jpntr,indcol,ipntr,iwa) */
     24: /*     where */
     25: /*       m is a positive integer input variable set to the number */
     26: /*         of rows of A. */
     27: /*       n is a positive integer input variable set to the number */
     28: /*         of columns of A. */
     29: /*       indrow is an integer input array which contains the row */
     30: /*         indices for the non-zeroes in the matrix A. */
     31: /*       jpntr is an integer input array of length n + 1 which */
     32: /*         specifies the locations of the row indices in indrow. */
     33: /*         The row indices for column j are */
     34: /*               indrow(k), k = jpntr(j),...,jpntr(j+1)-1. */
     35: /*         Note that jpntr(n+1)-1 is then the number of non-zero */
     36: /*         elements of the matrix A. */
     37: /*       indcol is an integer output array which contains the */
     38: /*         column indices for the non-zeroes in the matrix A. */
     39: /*       ipntr is an integer output array of length m + 1 which */
     40: /*         specifies the locations of the column indices in indcol. */
     41: /*         The column indices for row i are */
     42: /*               indcol(k), k = ipntr(i),...,ipntr(i+1)-1. */
     43: /*         Note that ipntr(1) is set to 1 and that ipntr(m+1)-1 is */
     44: /*         then the number of non-zero elements of the matrix A. */
     45: /*       iwa is an integer work array of length m. */
     46: /*     Argonne National Laboratory. MINPACK Project. July 1983. */
     47: /*     Thomas F. Coleman, Burton S. Garbow, Jorge J. More' */

     49:   /*     Store in array iwa the counts of non-zeroes in the rows. */

     52:   /* Parameter adjustments */
     53:   --iwa;
     54:   --ipntr;
     55:   --indcol;
     56:   --jpntr;
     57:   --indrow;

     59:   /* Function Body */
     60:   i__1 = *m;
     61:   for (ir = 1; ir <= i__1; ++ir) iwa[ir] = 0;

     63:   i__1 = jpntr[*n + 1] - 1;
     64:   for (jp = 1; jp <= i__1; ++jp) ++iwa[indrow[jp]];

     66:   /*     Set pointers to the start of the rows in indcol. */

     68:   ipntr[1] = 1;
     69:   i__1     = *m;

     71:   for (ir = 1; ir <= i__1; ++ir) {
     72:     ipntr[ir + 1] = ipntr[ir] + iwa[ir];
     73:     iwa[ir]       = ipntr[ir];
     74:   }

     76:   /*     Fill indcol. */

     78:   i__1 = *n;
     79:   for (jcol = 1; jcol <= i__1; ++jcol) {
     80:     i__2 = jpntr[jcol + 1] - 1;
     81:     for (jp = jpntr[jcol]; jp <= i__2; ++jp) {
     82:       ir              = indrow[jp];
     83:       indcol[iwa[ir]] = jcol;
     84:       ++iwa[ir];
     85:     }
     86:   }
     87:   return(0);
     88: }