      SUBROUTINE GRADBK (N,MZ,Z,M,LOW,IGH,CPERM)
C
C     *****PARAMETERS:
      INTEGER IGH,LOW,M,MZ,N
      DOUBLE PRECISION CPERM(N),Z(MZ,N)
C
C     *****LOCAL VARIABLES:
      INTEGER I,IGHM1,II,J,K
      DOUBLE PRECISION TEMP
C
C     *****FORTRAN FUNCTIONS:
C     NONE
C
C     *****SUBROUTINES CALLED:
C     NONE
C
C     ---------------------------------------------------------------
C
C     *****PURPOSE:
C     THIS SUBROUTINE BACK TRANSFORMS THE EIGENVECTORS OF A
C     GENERALIZED EIGENVALUE PROBLEM A*X = (LAMBDA)*B*X GRADED BY
C     THE SUBROUTINE GRADEQ TO THOSE OF THE EIGENPROBLEM BEFORE
C     GRADEQ WAS APPLIED.
C
C     REF.:  WARD, R. C., BALANCING THE GENERALIZED EIGENVALUE
C     PROBLEM, SIAM J. SCI. STAT. COMPUT., VOL. 2, NO. 2, JUNE 1981,
C     141-152.
C
C     *****PARAMETER DESCRIPTION:
C
C     ON INPUT:
C
C       MZ      INTEGER
C               ROW DIMENSION OF THE ARRAY Z AS SPECIFIED IN THE MAIN
C               CALLING PROGRAM DIMENSION STATEMENT;
C
C       N       INTEGER
C               ORDER OF THE MATRICES A AND B IN THE EIGENPROBLEM;
C
C       M       INTEGER
C               SPECIFIES THE NUMBER OF EIGENVECTORS TO BE TRANS-
C               FORMED;
C
C       Z       REAL(MZ,N)
C               CONTAINS THE EIGENVECTORS TO BE TRANSFORMED;
C
C       LOW     INTEGER
C               SPECIFIES THE BEGINNING INDEX OF THE SUBMATRICES OF
C               A AND B WHICH WERE GRADED;
C
C       IGH     INTEGER
C               SPECIFIES THE ENDING INDEX OF THE SUBMATRICES OF
C               A AND B WHICH WERE GRADED;
C
C       CPERM   REAL(N)
C               CONTAINS IN ITS LOW THROUGH IGH LOCATIONS THE COLUMN
C               PERMUTATIONS APPLIED IN GRADING THE A AND B
C               SUBMATRICES.
C
C     ON OUTPUT:
C
C       Z       CONTAINS THE TRANSFORMED EIGENVECTORS.
C
C     *****ALGORITHM NOTES:
C     NONE.
C
C     *****HISTORY:
C     WRITTEN BY R. C. WARD.......
C
C     ---------------------------------------------------------------
C
      IF (LOW .EQ. IGH) GO TO 530
      IGHM1 = IGH-1
      DO 520 II = LOW,IGHM1
         I = IGHM1 + LOW - II
         K = CPERM(I)
         IF (K .EQ. I) GO TO 520
         DO 510 J = 1,M
            TEMP = Z(I,J)
            Z(I,J) = Z(K,J)
            Z(K,J) = TEMP
  510    CONTINUE
  520 CONTINUE
  530 CONTINUE
      RETURN
C
C     LAST LINE OF GRADBK
C
      END
