File:  [local] / rpl / lapack / lapack / dlaqsb.f
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Tue Jan 26 15:22:45 2010 UTC (14 years, 3 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Initial revision

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

CVSweb interface <joel.bertrand@systella.fr>