Previous: cbabk2 Up: ../eispad.html Next: cg


CBAL(NM,N,AR,AI,LOW,IGH,SCALE)

       SUBROUTINE CBAL(NM,N,AR,AI,LOW,IGH,SCALE)
 C
       INTEGER I,J,K,L,M,N,JJ,NM,IGH,LOW,IEXC
       DOUBLE PRECISION AR(NM,N),AI(NM,N),SCALE(N)
       DOUBLE PRECISION C,F,G,R,S,B2,RADIX
       LOGICAL NOCONV
 C
 C     THIS SUBROUTINE IS A TRANSLATION OF THE ALGOL PROCEDURE
 C     CBALANCE, WHICH IS A COMPLEX VERSION OF BALANCE,
 C     NUM. MATH. 13, 293-304(1969) BY PARLETT AND REINSCH.
 C     HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 315-326(1971).
 C
 C     THIS SUBROUTINE BALANCES A COMPLEX MATRIX AND ISOLATES
 C     EIGENVALUES WHENEVER POSSIBLE.
 C
 C     ON INPUT
 C
 C        NM MUST BE SET TO THE ROW DIMENSION OF TWO-DIMENSIONAL
 C          ARRAY PARAMETERS AS DECLARED IN THE CALLING PROGRAM
 C          DIMENSION STATEMENT.
 C
 C        N IS THE ORDER OF THE MATRIX.
 C
 C        AR AND AI CONTAIN THE REAL AND IMAGINARY PARTS,
 C          RESPECTIVELY, OF THE COMPLEX MATRIX TO BE BALANCED.
 C
 C     ON OUTPUT
 C
 C        AR AND AI CONTAIN THE REAL AND IMAGINARY PARTS,
 C          RESPECTIVELY, OF THE BALANCED MATRIX.
 C
 C        LOW AND IGH ARE TWO INTEGERS SUCH THAT AR(I,J) AND AI(I,J)
 C          ARE EQUAL TO ZERO IF
 C           (1) I IS GREATER THAN J AND
 C           (2) J=1,...,LOW-1 OR I=IGH+1,...,N.
 C
 C        SCALE CONTAINS INFORMATION DETERMINING THE
 C           PERMUTATIONS AND SCALING FACTORS USED.
 C
 C     SUPPOSE THAT THE PRINCIPAL SUBMATRIX IN ROWS LOW THROUGH IGH
 C     HAS BEEN BALANCED, THAT P(J) DENOTES THE INDEX INTERCHANGED
 C     WITH J DURING THE PERMUTATION STEP, AND THAT THE ELEMENTS
 C     OF THE DIAGONAL MATRIX USED ARE DENOTED BY D(I,J).  THEN
 C        SCALE(J) = P(J),    FOR J = 1,...,LOW-1
 C                 = D(J,J)       J = LOW,...,IGH
 C                 = P(J)         J = IGH+1,...,N.
 C     THE ORDER IN WHICH THE INTERCHANGES ARE MADE IS N TO IGH+1,
 C     THEN 1 TO LOW-1.
 C
 C     NOTE THAT 1 IS RETURNED FOR IGH IF IGH IS ZERO FORMALLY.
 C
 C     THE ALGOL PROCEDURE EXC CONTAINED IN CBALANCE APPEARS IN
 C     CBAL  IN LINE.  (NOTE THAT THE ALGOL ROLES OF IDENTIFIERS
 C     K,L HAVE BEEN REVERSED.)
 C
 C     ARITHMETIC IS REAL THROUGHOUT.
 C
 C     QUESTIONS AND COMMENTS SHOULD BE DIRECTED TO BURTON S. GARBOW,
 C     MATHEMATICS AND COMPUTER SCIENCE DIV, ARGONNE NATIONAL LABORATORY
 C
 C     THIS VERSION DATED AUGUST 1983.
 C
 C     ------------------------------------------------------------------
 C