2 SUBROUTINE JGROUP
(N
,IA
,JA
,MAXG
,NGRP
,IGP
,JGP
,INCL
,JDONE
,IER
)
3 INTEGER N
, IA
, JA
, MAXG
, NGRP
, IGP
, JGP
, INCL
, JDONE
, IER
4 DIMENSION IA
(*), JA
(*), IGP
(*), JGP
(*), INCL
(*), JDONE
(*)
5 C-----------------------------------------------------------------------
6 C This subroutine constructs groupings of the column indices of
7 C the Jacobian matrix, used in the numerical evaluation of the
8 C Jacobian by finite differences.
11 C N = the order of the matrix.
12 C IA,JA = sparse structure descriptors of the matrix by rows.
13 C MAXG = length of available storage in the IGP array.
16 C NGRP = number of groups.
17 C JGP = array of length N containing the column indices by groups.
18 C IGP = pointer array of length NGRP + 1 to the locations in JGP
19 C of the beginning of each group.
20 C IER = error indicator. IER = 0 if no error occurred, or 1 if
21 C MAXG was insufficient.
23 C INCL and JDONE are working arrays of length N.
24 C-----------------------------------------------------------------------
25 INTEGER I
, J
, K
, KMIN
, KMAX
, NCOL
, NG
36 C Reject column J if it is already in a group.--------------------------
37 IF (JDONE
(J
) .EQ
. 1) GO TO 50
41 C Reject column J if it overlaps any column already in this group.------
43 IF (INCL
(I
) .EQ
. 1) GO TO 50
45 C Accept column J into group NG.----------------------------------------
53 C Stop if this group is empty (grouping is complete).-------------------
54 IF (NCOL
.EQ
. IGP
(NG
)) GO TO 70
56 C Error return if not all columns were chosen (MAXG too small).---------
57 IF (NCOL
.LE
. N
) GO TO 80
63 C----------------------- End of Subroutine JGROUP ----------------------