      SUBROUTINE BALINV (MAX,N,LOW,IGH,SCALE,EA)
C
C ****
C
C  FUNCTION              - PERFORMS THE INVERSE TRANSFORMATION OF THAT
C                            DONE IN SUBROUTINE BALANC
C
C  PARAMETERS  MAX       - MAXIMUM ROW DIMENSION OF EA
C              N         - ORDER OF EA
C              LOW       - INTEGER DETERMINED BY BALANC
C              IGH       - INTEGER DETERMINED BY BALANC
C              SCALE(N)  - CONTAINS INFORMATION DETERMINING THE
C                            PERMUTATIONS AND SCALING FACTORS USED
C                            BY BALANC
C              EA(MAX,N) - CONTAINS THE MATRIX TO BE TRANSFORMED
C
C  REQUIRED SUBPROGRAMS  - NONE
C
C  REQUIRED FUNCTIONS    - NONE
C
C  AUTHOR/IMPLEMENTER    - R.C.WARD / R.C.WARD
C
C  LANGUAGE              - FORTRAN (IBM DOUBLE PRECISION)
C
C  DATE RELEASED         - NOV. 14, 1975
C
C  LATEST VERSION        - NOV. 14, 1975
C                         extremely minor modification:bb:9-86
C
C ****
      DOUBLE PRECISION EA(MAX,N),SCALE(N)
      DOUBLE PRECISION S
      IF (IGH .EQ. LOW) GO TO 120
C ****
C     REMOVE SCALING FROM ROWS AND COLUMNS
C ****
      DO 100 I=LOW,IGH
         S = SCALE(I)
         DO 100 J=1,N
            EA(I,J) = S*EA(I,J)
 100  CONTINUE
      DO 110 J=LOW,IGH
         S = 1.D0 / SCALE(J)
         DO 110 I=1,N
            EA(I,J) = EA(I,J)*S
 110  CONTINUE
C ****
C     RE-PERMUTE ROWS AND COLUMNS
C ****
 120  DO 150 II=1,N
         I = II
         IF (I .GE. LOW .AND. I .LE. IGH) GO TO 150
         IF (I .LT. LOW) I = LOW - II
         K = SCALE(I)
         IF (K .EQ. I) GO TO 150
         DO 130 J=1,N
            S = EA(I,J)
            EA(I,J) = EA(K,J)
            EA(K,J) = S
 130     CONTINUE
         DO 140 J=1,N
            S = EA(J,I)
            EA(J,I) = EA(J,K)
            EA(J,K) = S
 140     CONTINUE
 150  CONTINUE
      RETURN
      END
