File:  [local] / rpl / lapack / lapack / zlaqhe.f
Revision 1.4: download - view: text, annotated - select for diffs - revision graph
Fri Aug 6 15:32:44 2010 UTC (13 years, 9 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Cohérence

    1:       SUBROUTINE ZLAQHE( UPLO, N, A, LDA, S, SCOND, AMAX, EQUED )
    2: *
    3: *  -- LAPACK auxiliary routine (version 3.2) --
    4: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
    5: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
    6: *     November 2006
    7: *
    8: *     .. Scalar Arguments ..
    9:       CHARACTER          EQUED, UPLO
   10:       INTEGER            LDA, N
   11:       DOUBLE PRECISION   AMAX, SCOND
   12: *     ..
   13: *     .. Array Arguments ..
   14:       DOUBLE PRECISION   S( * )
   15:       COMPLEX*16         A( LDA, * )
   16: *     ..
   17: *
   18: *  Purpose
   19: *  =======
   20: *
   21: *  ZLAQHE equilibrates a Hermitian matrix A using the scaling factors
   22: *  in the vector S.
   23: *
   24: *  Arguments
   25: *  =========
   26: *
   27: *  UPLO    (input) CHARACTER*1
   28: *          Specifies whether the upper or lower triangular part of the
   29: *          Hermitian matrix A is stored.
   30: *          = 'U':  Upper triangular
   31: *          = 'L':  Lower triangular
   32: *
   33: *  N       (input) INTEGER
   34: *          The order of the matrix A.  N >= 0.
   35: *
   36: *  A       (input/output) COMPLEX*16 array, dimension (LDA,N)
   37: *          On entry, the Hermitian matrix A.  If UPLO = 'U', the leading
   38: *          n by n upper triangular part of A contains the upper
   39: *          triangular part of the matrix A, and the strictly lower
   40: *          triangular part of A is not referenced.  If UPLO = 'L', the
   41: *          leading n by n lower triangular part of A contains the lower
   42: *          triangular part of the matrix A, and the strictly upper
   43: *          triangular part of A is not referenced.
   44: *
   45: *          On exit, if EQUED = 'Y', the equilibrated matrix:
   46: *          diag(S) * A * diag(S).
   47: *
   48: *  LDA     (input) INTEGER
   49: *          The leading dimension of the array A.  LDA >= max(N,1).
   50: *
   51: *  S       (input) DOUBLE PRECISION array, dimension (N)
   52: *          The scale factors for A.
   53: *
   54: *  SCOND   (input) DOUBLE PRECISION
   55: *          Ratio of the smallest S(i) to the largest S(i).
   56: *
   57: *  AMAX    (input) DOUBLE PRECISION
   58: *          Absolute value of largest matrix entry.
   59: *
   60: *  EQUED   (output) CHARACTER*1
   61: *          Specifies whether or not equilibration was done.
   62: *          = 'N':  No equilibration.
   63: *          = 'Y':  Equilibration was done, i.e., A has been replaced by
   64: *                  diag(S) * A * diag(S).
   65: *
   66: *  Internal Parameters
   67: *  ===================
   68: *
   69: *  THRESH is a threshold value used to decide if scaling should be done
   70: *  based on the ratio of the scaling factors.  If SCOND < THRESH,
   71: *  scaling is done.
   72: *
   73: *  LARGE and SMALL are threshold values used to decide if scaling should
   74: *  be done based on the absolute size of the largest matrix element.
   75: *  If AMAX > LARGE or AMAX < SMALL, scaling is done.
   76: *
   77: *  =====================================================================
   78: *
   79: *     .. Parameters ..
   80:       DOUBLE PRECISION   ONE, THRESH
   81:       PARAMETER          ( ONE = 1.0D+0, THRESH = 0.1D+0 )
   82: *     ..
   83: *     .. Local Scalars ..
   84:       INTEGER            I, J
   85:       DOUBLE PRECISION   CJ, LARGE, SMALL
   86: *     ..
   87: *     .. External Functions ..
   88:       LOGICAL            LSAME
   89:       DOUBLE PRECISION   DLAMCH
   90:       EXTERNAL           LSAME, DLAMCH
   91: *     ..
   92: *     .. Intrinsic Functions ..
   93:       INTRINSIC          DBLE
   94: *     ..
   95: *     .. Executable Statements ..
   96: *
   97: *     Quick return if possible
   98: *
   99:       IF( N.LE.0 ) THEN
  100:          EQUED = 'N'
  101:          RETURN
  102:       END IF
  103: *
  104: *     Initialize LARGE and SMALL.
  105: *
  106:       SMALL = DLAMCH( 'Safe minimum' ) / DLAMCH( 'Precision' )
  107:       LARGE = ONE / SMALL
  108: *
  109:       IF( SCOND.GE.THRESH .AND. AMAX.GE.SMALL .AND. AMAX.LE.LARGE ) THEN
  110: *
  111: *        No equilibration
  112: *
  113:          EQUED = 'N'
  114:       ELSE
  115: *
  116: *        Replace A by diag(S) * A * diag(S).
  117: *
  118:          IF( LSAME( UPLO, 'U' ) ) THEN
  119: *
  120: *           Upper triangle of A is stored.
  121: *
  122:             DO 20 J = 1, N
  123:                CJ = S( J )
  124:                DO 10 I = 1, J - 1
  125:                   A( I, J ) = CJ*S( I )*A( I, J )
  126:    10          CONTINUE
  127:                A( J, J ) = CJ*CJ*DBLE( A( J, J ) )
  128:    20       CONTINUE
  129:          ELSE
  130: *
  131: *           Lower triangle of A is stored.
  132: *
  133:             DO 40 J = 1, N
  134:                CJ = S( J )
  135:                A( J, J ) = CJ*CJ*DBLE( A( J, J ) )
  136:                DO 30 I = J + 1, N
  137:                   A( I, J ) = CJ*S( I )*A( I, J )
  138:    30          CONTINUE
  139:    40       CONTINUE
  140:          END IF
  141:          EQUED = 'Y'
  142:       END IF
  143: *
  144:       RETURN
  145: *
  146: *     End of ZLAQHE
  147: *
  148:       END

CVSweb interface <joel.bertrand@systella.fr>