File:  [local] / rpl / lapack / lapack / zlaqhp.f
Revision 1.7: download - view: text, annotated - select for diffs - revision graph
Tue Dec 21 13:53:50 2010 UTC (13 years, 4 months ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_3, rpl-4_1_2, rpl-4_1_1, rpl-4_1_0, rpl-4_0_24, rpl-4_0_22, rpl-4_0_21, rpl-4_0_20, rpl-4_0, HEAD
Mise à jour de lapack vers la version 3.3.0.

    1:       SUBROUTINE ZLAQHP( UPLO, N, AP, 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            N
   11:       DOUBLE PRECISION   AMAX, SCOND
   12: *     ..
   13: *     .. Array Arguments ..
   14:       DOUBLE PRECISION   S( * )
   15:       COMPLEX*16         AP( * )
   16: *     ..
   17: *
   18: *  Purpose
   19: *  =======
   20: *
   21: *  ZLAQHP 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: *  AP      (input/output) COMPLEX*16 array, dimension (N*(N+1)/2)
   37: *          On entry, the upper or lower triangle of the Hermitian matrix
   38: *          A, packed columnwise in a linear array.  The j-th column of A
   39: *          is stored in the array AP as follows:
   40: *          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
   41: *          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
   42: *
   43: *          On exit, the equilibrated matrix:  diag(S) * A * diag(S), in
   44: *          the same storage format as A.
   45: *
   46: *  S       (input) DOUBLE PRECISION array, dimension (N)
   47: *          The scale factors for A.
   48: *
   49: *  SCOND   (input) DOUBLE PRECISION
   50: *          Ratio of the smallest S(i) to the largest S(i).
   51: *
   52: *  AMAX    (input) DOUBLE PRECISION
   53: *          Absolute value of largest matrix entry.
   54: *
   55: *  EQUED   (output) CHARACTER*1
   56: *          Specifies whether or not equilibration was done.
   57: *          = 'N':  No equilibration.
   58: *          = 'Y':  Equilibration was done, i.e., A has been replaced by
   59: *                  diag(S) * A * diag(S).
   60: *
   61: *  Internal Parameters
   62: *  ===================
   63: *
   64: *  THRESH is a threshold value used to decide if scaling should be done
   65: *  based on the ratio of the scaling factors.  If SCOND < THRESH,
   66: *  scaling is done.
   67: *
   68: *  LARGE and SMALL are threshold values used to decide if scaling should
   69: *  be done based on the absolute size of the largest matrix element.
   70: *  If AMAX > LARGE or AMAX < SMALL, scaling is done.
   71: *
   72: *  =====================================================================
   73: *
   74: *     .. Parameters ..
   75:       DOUBLE PRECISION   ONE, THRESH
   76:       PARAMETER          ( ONE = 1.0D+0, THRESH = 0.1D+0 )
   77: *     ..
   78: *     .. Local Scalars ..
   79:       INTEGER            I, J, JC
   80:       DOUBLE PRECISION   CJ, LARGE, SMALL
   81: *     ..
   82: *     .. External Functions ..
   83:       LOGICAL            LSAME
   84:       DOUBLE PRECISION   DLAMCH
   85:       EXTERNAL           LSAME, DLAMCH
   86: *     ..
   87: *     .. Intrinsic Functions ..
   88:       INTRINSIC          DBLE
   89: *     ..
   90: *     .. Executable Statements ..
   91: *
   92: *     Quick return if possible
   93: *
   94:       IF( N.LE.0 ) THEN
   95:          EQUED = 'N'
   96:          RETURN
   97:       END IF
   98: *
   99: *     Initialize LARGE and SMALL.
  100: *
  101:       SMALL = DLAMCH( 'Safe minimum' ) / DLAMCH( 'Precision' )
  102:       LARGE = ONE / SMALL
  103: *
  104:       IF( SCOND.GE.THRESH .AND. AMAX.GE.SMALL .AND. AMAX.LE.LARGE ) THEN
  105: *
  106: *        No equilibration
  107: *
  108:          EQUED = 'N'
  109:       ELSE
  110: *
  111: *        Replace A by diag(S) * A * diag(S).
  112: *
  113:          IF( LSAME( UPLO, 'U' ) ) THEN
  114: *
  115: *           Upper triangle of A is stored.
  116: *
  117:             JC = 1
  118:             DO 20 J = 1, N
  119:                CJ = S( J )
  120:                DO 10 I = 1, J - 1
  121:                   AP( JC+I-1 ) = CJ*S( I )*AP( JC+I-1 )
  122:    10          CONTINUE
  123:                AP( JC+J-1 ) = CJ*CJ*DBLE( AP( JC+J-1 ) )
  124:                JC = JC + J
  125:    20       CONTINUE
  126:          ELSE
  127: *
  128: *           Lower triangle of A is stored.
  129: *
  130:             JC = 1
  131:             DO 40 J = 1, N
  132:                CJ = S( J )
  133:                AP( JC ) = CJ*CJ*DBLE( AP( JC ) )
  134:                DO 30 I = J + 1, N
  135:                   AP( JC+I-J ) = CJ*S( I )*AP( JC+I-J )
  136:    30          CONTINUE
  137:                JC = JC + N - J + 1
  138:    40       CONTINUE
  139:          END IF
  140:          EQUED = 'Y'
  141:       END IF
  142: *
  143:       RETURN
  144: *
  145: *     End of ZLAQHP
  146: *
  147:       END

CVSweb interface <joel.bertrand@systella.fr>