balanc.f
SUBROUTINE BALANC (NM, N, A, LOW, IGH, SCALE)
C***BEGIN PROLOGUE BALANC
C***PURPOSE Balance a real general matrix and isolate eigenvalues
C whenever possible.
C***LIBRARY SLATEC (EISPACK)
C***CATEGORY D4C1A
C***TYPE SINGLE PRECISION (BALANC-S, CBAL-C)
C***KEYWORDS EIGENVECTORS, EISPACK
C***AUTHOR Smith, B. T., et al.
C***DESCRIPTION
C
C This subroutine is a translation of the ALGOL procedure 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 REAL matrix and isolates
C eigenvalues whenever possible.
C
C On INPUT
C
C NM must be set to the row dimension of the two-dimensional
C array parameter, A, as declared in the calling program
C dimension statement. NM is an INTEGER variable.
C
C N is the order of the matrix A. N is an INTEGER variable.
C N must be less than or equal to NM.
C
C A contains the input matrix to be balanced. A is a
C two-dimensional REAL array, dimensioned A(NM,N).
C
C On OUTPUT
C
C A contains the balanced matrix.
C
C LOW and IGH are two INTEGER variables such that A(I,J)
C is 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 permutations and
C scaling factors used. SCALE is a one-dimensional REAL array,
C dimensioned SCALE(N).
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 BALANCE appears in
C BALANC in line. (Note that the ALGOL roles of identifiers
C K,L have been reversed.)
C
C Questions and comments should be directed to B. S. Garbow,
C Applied Mathematics Division, ARGONNE NATIONAL LABORATORY
C ------------------------------------------------------------------
C
C***REFERENCES B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
C Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
C system Routines - EISPACK Guide, Springer-Verlag,
C 1976.
C***ROUTINES CALLED (NONE)
C***REVISION HISTORY (YYMMDD)
C 760101 DATE WRITTEN
C 890831 Modified array declarations. (WRB)
C 890831 REVISION DATE from Version 3.2
C 891214 Prologue converted to Version 4.0 format. (BAB)
C 920501 Reformatted the REFERENCES section. (WRB)
C***END PROLOGUE BALANC