Annotation of rpl/lapack/lapack/dpbequ.f, revision 1.18

1.9       bertrand    1: *> \brief \b DPBEQU
                      2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
1.15      bertrand    5: * Online html documentation available at
                      6: *            http://www.netlib.org/lapack/explore-html/
1.9       bertrand    7: *
                      8: *> \htmlonly
1.15      bertrand    9: *> Download DPBEQU + dependencies
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dpbequ.f">
                     11: *> [TGZ]</a>
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dpbequ.f">
                     13: *> [ZIP]</a>
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dpbequ.f">
1.9       bertrand   15: *> [TXT]</a>
1.15      bertrand   16: *> \endhtmlonly
1.9       bertrand   17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       SUBROUTINE DPBEQU( UPLO, N, KD, AB, LDAB, S, SCOND, AMAX, INFO )
1.15      bertrand   22: *
1.9       bertrand   23: *       .. Scalar Arguments ..
                     24: *       CHARACTER          UPLO
                     25: *       INTEGER            INFO, KD, LDAB, N
                     26: *       DOUBLE PRECISION   AMAX, SCOND
                     27: *       ..
                     28: *       .. Array Arguments ..
                     29: *       DOUBLE PRECISION   AB( LDAB, * ), S( * )
                     30: *       ..
1.15      bertrand   31: *
1.9       bertrand   32: *
                     33: *> \par Purpose:
                     34: *  =============
                     35: *>
                     36: *> \verbatim
                     37: *>
                     38: *> DPBEQU computes row and column scalings intended to equilibrate a
                     39: *> symmetric positive definite band matrix A and reduce its condition
                     40: *> number (with respect to the two-norm).  S contains the scale factors,
                     41: *> S(i) = 1/sqrt(A(i,i)), chosen so that the scaled matrix B with
                     42: *> elements B(i,j) = S(i)*A(i,j)*S(j) has ones on the diagonal.  This
                     43: *> choice of S puts the condition number of B within a factor N of the
                     44: *> smallest possible condition number over all possible diagonal
                     45: *> scalings.
                     46: *> \endverbatim
                     47: *
                     48: *  Arguments:
                     49: *  ==========
                     50: *
                     51: *> \param[in] UPLO
                     52: *> \verbatim
                     53: *>          UPLO is CHARACTER*1
                     54: *>          = 'U':  Upper triangular of A is stored;
                     55: *>          = 'L':  Lower triangular of A is stored.
                     56: *> \endverbatim
                     57: *>
                     58: *> \param[in] N
                     59: *> \verbatim
                     60: *>          N is INTEGER
                     61: *>          The order of the matrix A.  N >= 0.
                     62: *> \endverbatim
                     63: *>
                     64: *> \param[in] KD
                     65: *> \verbatim
                     66: *>          KD is INTEGER
                     67: *>          The number of superdiagonals of the matrix A if UPLO = 'U',
                     68: *>          or the number of subdiagonals if UPLO = 'L'.  KD >= 0.
                     69: *> \endverbatim
                     70: *>
                     71: *> \param[in] AB
                     72: *> \verbatim
                     73: *>          AB is DOUBLE PRECISION array, dimension (LDAB,N)
                     74: *>          The upper or lower triangle of the symmetric band matrix A,
                     75: *>          stored in the first KD+1 rows of the array.  The j-th column
                     76: *>          of A is stored in the j-th column of the array AB as follows:
                     77: *>          if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
                     78: *>          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+kd).
                     79: *> \endverbatim
                     80: *>
                     81: *> \param[in] LDAB
                     82: *> \verbatim
                     83: *>          LDAB is INTEGER
                     84: *>          The leading dimension of the array A.  LDAB >= KD+1.
                     85: *> \endverbatim
                     86: *>
                     87: *> \param[out] S
                     88: *> \verbatim
                     89: *>          S is DOUBLE PRECISION array, dimension (N)
                     90: *>          If INFO = 0, S contains the scale factors for A.
                     91: *> \endverbatim
                     92: *>
                     93: *> \param[out] SCOND
                     94: *> \verbatim
                     95: *>          SCOND is DOUBLE PRECISION
                     96: *>          If INFO = 0, S contains the ratio of the smallest S(i) to
                     97: *>          the largest S(i).  If SCOND >= 0.1 and AMAX is neither too
                     98: *>          large nor too small, it is not worth scaling by S.
                     99: *> \endverbatim
                    100: *>
                    101: *> \param[out] AMAX
                    102: *> \verbatim
                    103: *>          AMAX is DOUBLE PRECISION
                    104: *>          Absolute value of largest matrix element.  If AMAX is very
                    105: *>          close to overflow or very close to underflow, the matrix
                    106: *>          should be scaled.
                    107: *> \endverbatim
                    108: *>
                    109: *> \param[out] INFO
                    110: *> \verbatim
                    111: *>          INFO is INTEGER
                    112: *>          = 0:  successful exit
                    113: *>          < 0:  if INFO = -i, the i-th argument had an illegal value.
                    114: *>          > 0:  if INFO = i, the i-th diagonal element is nonpositive.
                    115: *> \endverbatim
                    116: *
                    117: *  Authors:
                    118: *  ========
                    119: *
1.15      bertrand  120: *> \author Univ. of Tennessee
                    121: *> \author Univ. of California Berkeley
                    122: *> \author Univ. of Colorado Denver
                    123: *> \author NAG Ltd.
1.9       bertrand  124: *
                    125: *> \ingroup doubleOTHERcomputational
                    126: *
                    127: *  =====================================================================
1.1       bertrand  128:       SUBROUTINE DPBEQU( UPLO, N, KD, AB, LDAB, S, SCOND, AMAX, INFO )
                    129: *
1.18    ! bertrand  130: *  -- LAPACK computational routine --
1.1       bertrand  131: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    132: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
                    133: *
                    134: *     .. Scalar Arguments ..
                    135:       CHARACTER          UPLO
                    136:       INTEGER            INFO, KD, LDAB, N
                    137:       DOUBLE PRECISION   AMAX, SCOND
                    138: *     ..
                    139: *     .. Array Arguments ..
                    140:       DOUBLE PRECISION   AB( LDAB, * ), S( * )
                    141: *     ..
                    142: *
                    143: *  =====================================================================
                    144: *
                    145: *     .. Parameters ..
                    146:       DOUBLE PRECISION   ZERO, ONE
                    147:       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
                    148: *     ..
                    149: *     .. Local Scalars ..
                    150:       LOGICAL            UPPER
                    151:       INTEGER            I, J
                    152:       DOUBLE PRECISION   SMIN
                    153: *     ..
                    154: *     .. External Functions ..
                    155:       LOGICAL            LSAME
                    156:       EXTERNAL           LSAME
                    157: *     ..
                    158: *     .. External Subroutines ..
                    159:       EXTERNAL           XERBLA
                    160: *     ..
                    161: *     .. Intrinsic Functions ..
                    162:       INTRINSIC          MAX, MIN, SQRT
                    163: *     ..
                    164: *     .. Executable Statements ..
                    165: *
                    166: *     Test the input parameters.
                    167: *
                    168:       INFO = 0
                    169:       UPPER = LSAME( UPLO, 'U' )
                    170:       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
                    171:          INFO = -1
                    172:       ELSE IF( N.LT.0 ) THEN
                    173:          INFO = -2
                    174:       ELSE IF( KD.LT.0 ) THEN
                    175:          INFO = -3
                    176:       ELSE IF( LDAB.LT.KD+1 ) THEN
                    177:          INFO = -5
                    178:       END IF
                    179:       IF( INFO.NE.0 ) THEN
                    180:          CALL XERBLA( 'DPBEQU', -INFO )
                    181:          RETURN
                    182:       END IF
                    183: *
                    184: *     Quick return if possible
                    185: *
                    186:       IF( N.EQ.0 ) THEN
                    187:          SCOND = ONE
                    188:          AMAX = ZERO
                    189:          RETURN
                    190:       END IF
                    191: *
                    192:       IF( UPPER ) THEN
                    193:          J = KD + 1
                    194:       ELSE
                    195:          J = 1
                    196:       END IF
                    197: *
                    198: *     Initialize SMIN and AMAX.
                    199: *
                    200:       S( 1 ) = AB( J, 1 )
                    201:       SMIN = S( 1 )
                    202:       AMAX = S( 1 )
                    203: *
                    204: *     Find the minimum and maximum diagonal elements.
                    205: *
                    206:       DO 10 I = 2, N
                    207:          S( I ) = AB( J, I )
                    208:          SMIN = MIN( SMIN, S( I ) )
                    209:          AMAX = MAX( AMAX, S( I ) )
                    210:    10 CONTINUE
                    211: *
                    212:       IF( SMIN.LE.ZERO ) THEN
                    213: *
                    214: *        Find the first non-positive diagonal element and return.
                    215: *
                    216:          DO 20 I = 1, N
                    217:             IF( S( I ).LE.ZERO ) THEN
                    218:                INFO = I
                    219:                RETURN
                    220:             END IF
                    221:    20    CONTINUE
                    222:       ELSE
                    223: *
                    224: *        Set the scale factors to the reciprocals
                    225: *        of the diagonal elements.
                    226: *
                    227:          DO 30 I = 1, N
                    228:             S( I ) = ONE / SQRT( S( I ) )
                    229:    30    CONTINUE
                    230: *
                    231: *        Compute SCOND = min(S(I)) / max(S(I))
                    232: *
                    233:          SCOND = SQRT( SMIN ) / SQRT( AMAX )
                    234:       END IF
                    235:       RETURN
                    236: *
                    237: *     End of DPBEQU
                    238: *
                    239:       END

CVSweb interface <joel.bertrand@systella.fr>