PSGEBAL(3)    ScaLAPACK routine of NEC Numeric Library Collection   PSGEBAL(3)



NAME
       PSGEBAL - balances a general real matrix A

SYNOPSIS
       SUBROUTINE PSGEBAL( JOB, N, A, DESCA, ILO, IHI, SCALE, INFO )

           CHARACTER       JOB

           INTEGER         IHI, ILO, INFO, N

           INTEGER         DESCA( * )

           REAL            A( * ), SCALE( * )

PURPOSE
       PSGEBAL  balances  a general real matrix A.  This involves, first, per-
       muting A by a similarity transformation to isolate eigenvalues  in  the
       first 1 to ILO-1 and last IHI+1 to N elements on the diagonal; and sec-
       ond, applying a diagonal similarity transformation to rows and  columns
       ILO  to  IHI to make the rows and columns as close in norm as possible.
       Both steps are optional.

       Balancing may reduce the 1-norm of the matrix, and improve the accuracy
       of the computed eigenvalues and/or eigenvectors.


       Notes
       =====

       Each  global data object is described by an associated description vec-
       tor.  This vector stores the information required to establish the map-
       ping between an object element and its corresponding process and memory
       location.

       Let A be a generic term for any 2D block  cyclicly  distributed  array.
       Such a global array has an associated description vector DESCA.  In the
       following comments, the character _ should be read as  "of  the  global
       array".

       NOTATION        STORED IN      EXPLANATION
       --------------- -------------- --------------------------------------
       DTYPE_A(global) DESCA( DTYPE_ )The descriptor type.  In this case,
                                      DTYPE_A = 1.
       CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating
                                      the BLACS process grid A is distribu-
                                      ted over. The context itself is glo-
                                      bal, but the handle (the integer
                                      value) may vary.
       M_A    (global) DESCA( M_ )    The number of rows in the global
                                      array A.
       N_A    (global) DESCA( N_ )    The number of columns in the global
                                      array A.
       MB_A   (global) DESCA( MB_ )   The blocking factor used to distribute
                                      the rows of the array.
       NB_A   (global) DESCA( NB_ )   The blocking factor used to distribute
                                      the columns of the array.
       RSRC_A (global) DESCA( RSRC_ ) The process row over which the first
                                      row of the array A is distributed.
       CSRC_A (global) DESCA( CSRC_ ) The process column over which the
                                      first column of the array A is
                                      distributed.
       LLD_A  (local)  DESCA( LLD_ )  The leading dimension of the local
                                      array.  LLD_A >= MAX(1,LOCr(M_A)).

       Let  K  be  the  number of rows or columns of a distributed matrix, and
       assume that its process grid has dimension p x q.
       LOCr( K ) denotes the number of elements of  K  that  a  process  would
       receive  if K were distributed over the p processes of its process col-
       umn.
       Similarly, LOCc( K ) denotes the number of elements of K that a process
       would receive if K were distributed over the q processes of its process
       row.
       The values of LOCr() and LOCc() may be determined via  a  call  to  the
       ScaLAPACK tool function, NUMROC:
               LOCr( M ) = NUMROC( M, MB_A, MYROW, RSRC_A, NPROW ),
               LOCc( N ) = NUMROC( N, NB_A, MYCOL, CSRC_A, NPCOL ).
       An upper bound for these quantities may be computed by:
               LOCr( M ) <= ceil( ceil(M/MB_A)/NPROW )*MB_A
               LOCc( N ) <= ceil( ceil(N/NB_A)/NPCOL )*NB_A


ARGUMENTS
       JOB     (global input) CHARACTER*1
               Specifies the operations to be performed on A:
               = 'N':  none:  simply set ILO = 1, IHI = N, SCALE(I) = 1.0
                         for i = 1,...,N;
               = 'P':  permute only;
               = 'S':  scale only;
               = 'B':  both permute and scale.

       N       (global input) INTEGER
               The order of the matrix A.  N >= 0.

       A       (local input/output) REAL array, dimension
               (DESCA(LLD_,LOCc(N))
               On entry, the input matrix A.
               On exit,  A is overwritten by the balanced matrix.
               If JOB = 'N', A is not referenced.
               See Further Details.

       DESCA   (global and local input) INTEGER array of dimension DLEN_.
               The array descriptor for the distributed matrix A.

       ILO     (global output) INTEGER

       IHI     (global output) INTEGER
               ILO and IHI are set to integers such that on exit
               A(i,j) = 0 if i > j and j = 1,...,ILO-1 or I = IHI+1,...,N.
               If JOB = 'N' or 'S', ILO = 1 and IHI = N.

       SCALE   (global output) REAL array, dimension (N)
               Details of the permutations and scaling factors applied to A.
               If  P(j)  is  the index of the row and column interchanged with
               row and column j and D(j) is the scaling factor applied to  row
               and column j, then
               SCALE(j) = P(j)    for j = 1,...,ILO-1
                        = D(j)    for j = ILO,...,IHI
                        = P(j)    for j = IHI+1,...,N.
               The  order  in  which  the interchanges are made is N to IHI+1,
               then 1 to ILO-1.

       INFO    (global output) INTEGER
               = 0:  successful exit.
               < 0:  if INFO = -i, the i-th argument had an illegal value.

FURTHER DETAILS
       The permutations consist of row and column interchanges which  put  the
       matrix in the form

                  ( T1   X   Y  )
          P A P = (  0   B   Z  )
                  (  0   0   T2 )

       where  T1  and  T2  are upper triangular matrices whose eigenvalues lie
       along the diagonal.  The column indices ILO and IHI mark  the  starting
       and ending columns of the submatrix B. Balancing consists of applying a
       diagonal similarity transformation inv(D) * B * D to make  the  1-norms
       of each row of B and its corresponding column nearly equal.  The output
       matrix is

          ( T1     X*D          Y    )
          (  0  inv(D)*B*D  inv(D)*Z ).
          (  0      0           T2   )

       Information about the permutations P  and  the  diagonal  matrix  D  is
       returned in the vector SCALE.

       This  subroutine  is based on the EISPACK routine BALANC. In principle,
       the parallelism is extracted by using PBLAS and BLACS routines for  the
       permutation and balancing.



ScaLAPACK routine               31 October 2017                     PSGEBAL(3)