Annotation of rpl/lapack/lapack/dpoequb.f, revision 1.13

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

CVSweb interface <joel.bertrand@systella.fr>