File:  [local] / rpl / lapack / lapack / zpoequb.f
Revision 1.10: download - view: text, annotated - select for diffs - revision graph
Mon Jan 27 09:28:41 2014 UTC (10 years, 4 months ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_24, rpl-4_1_23, rpl-4_1_22, rpl-4_1_21, rpl-4_1_20, rpl-4_1_19, rpl-4_1_18, rpl-4_1_17, HEAD
Cohérence.

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

CVSweb interface <joel.bertrand@systella.fr>