File:  [local] / rpl / lapack / lapack / zpoequb.f
Revision 1.14: download - view: text, annotated - select for diffs - revision graph
Tue May 29 07:18:32 2018 UTC (5 years, 11 months ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_33, rpl-4_1_32, rpl-4_1_31, rpl-4_1_30, rpl-4_1_29, rpl-4_1_28, HEAD
Mise à jour de Lapack.

    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: *> Hermitian 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: *>
   47: *> This routine differs from ZPOEQU by restricting the scaling factors
   48: *> to a power of the radix.  Barring over- and underflow, scaling by
   49: *> these factors introduces no additional rounding errors.  However, the
   50: *> scaled diagonal entries are no longer approximately 1 but lie
   51: *> between sqrt(radix) and 1/sqrt(radix).
   52: *> \endverbatim
   53: *
   54: *  Arguments:
   55: *  ==========
   56: *
   57: *> \param[in] N
   58: *> \verbatim
   59: *>          N is INTEGER
   60: *>          The order of the matrix A.  N >= 0.
   61: *> \endverbatim
   62: *>
   63: *> \param[in] A
   64: *> \verbatim
   65: *>          A is COMPLEX*16 array, dimension (LDA,N)
   66: *>          The N-by-N Hermitian positive definite matrix whose scaling
   67: *>          factors are to be computed.  Only the diagonal elements of A
   68: *>          are referenced.
   69: *> \endverbatim
   70: *>
   71: *> \param[in] LDA
   72: *> \verbatim
   73: *>          LDA is INTEGER
   74: *>          The leading dimension of the array A.  LDA >= max(1,N).
   75: *> \endverbatim
   76: *>
   77: *> \param[out] S
   78: *> \verbatim
   79: *>          S is DOUBLE PRECISION array, dimension (N)
   80: *>          If INFO = 0, S contains the scale factors for A.
   81: *> \endverbatim
   82: *>
   83: *> \param[out] SCOND
   84: *> \verbatim
   85: *>          SCOND is DOUBLE PRECISION
   86: *>          If INFO = 0, S contains the ratio of the smallest S(i) to
   87: *>          the largest S(i).  If SCOND >= 0.1 and AMAX is neither too
   88: *>          large nor too small, it is not worth scaling by S.
   89: *> \endverbatim
   90: *>
   91: *> \param[out] AMAX
   92: *> \verbatim
   93: *>          AMAX is DOUBLE PRECISION
   94: *>          Absolute value of largest matrix element.  If AMAX is very
   95: *>          close to overflow or very close to underflow, the matrix
   96: *>          should be scaled.
   97: *> \endverbatim
   98: *>
   99: *> \param[out] INFO
  100: *> \verbatim
  101: *>          INFO is INTEGER
  102: *>          = 0:  successful exit
  103: *>          < 0:  if INFO = -i, the i-th argument had an illegal value
  104: *>          > 0:  if INFO = i, the i-th diagonal element is nonpositive.
  105: *> \endverbatim
  106: *
  107: *  Authors:
  108: *  ========
  109: *
  110: *> \author Univ. of Tennessee
  111: *> \author Univ. of California Berkeley
  112: *> \author Univ. of Colorado Denver
  113: *> \author NAG Ltd.
  114: *
  115: *> \date December 2016
  116: *
  117: *> \ingroup complex16POcomputational
  118: *
  119: *  =====================================================================
  120:       SUBROUTINE ZPOEQUB( N, A, LDA, S, SCOND, AMAX, INFO )
  121: *
  122: *  -- LAPACK computational routine (version 3.7.0) --
  123: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
  124: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  125: *     December 2016
  126: *
  127: *     .. Scalar Arguments ..
  128:       INTEGER            INFO, LDA, N
  129:       DOUBLE PRECISION   AMAX, SCOND
  130: *     ..
  131: *     .. Array Arguments ..
  132:       COMPLEX*16         A( LDA, * )
  133:       DOUBLE PRECISION   S( * )
  134: *     ..
  135: *
  136: *  =====================================================================
  137: *
  138: *     .. Parameters ..
  139:       DOUBLE PRECISION   ZERO, ONE
  140:       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
  141: *     ..
  142: *     .. Local Scalars ..
  143:       INTEGER            I
  144:       DOUBLE PRECISION   SMIN, BASE, TMP
  145: *     ..
  146: *     .. External Functions ..
  147:       DOUBLE PRECISION   DLAMCH
  148:       EXTERNAL           DLAMCH
  149: *     ..
  150: *     .. External Subroutines ..
  151:       EXTERNAL           XERBLA
  152: *     ..
  153: *     .. Intrinsic Functions ..
  154:       INTRINSIC          MAX, MIN, SQRT, LOG, INT, REAL, DIMAG
  155: *     ..
  156: *     .. Executable Statements ..
  157: *
  158: *     Test the input parameters.
  159: *
  160: *     Positive definite only performs 1 pass of equilibration.
  161: *
  162:       INFO = 0
  163:       IF( N.LT.0 ) THEN
  164:          INFO = -1
  165:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  166:          INFO = -3
  167:       END IF
  168:       IF( INFO.NE.0 ) THEN
  169:          CALL XERBLA( 'ZPOEQUB', -INFO )
  170:          RETURN
  171:       END IF
  172: *
  173: *     Quick return if possible.
  174: *
  175:       IF( N.EQ.0 ) THEN
  176:          SCOND = ONE
  177:          AMAX = ZERO
  178:          RETURN
  179:       END IF
  180: 
  181:       BASE = DLAMCH( 'B' )
  182:       TMP = -0.5D+0 / LOG ( BASE )
  183: *
  184: *     Find the minimum and maximum diagonal elements.
  185: *
  186:       S( 1 ) = A( 1, 1 )
  187:       SMIN = S( 1 )
  188:       AMAX = S( 1 )
  189:       DO 10 I = 2, N
  190:          S( I ) = A( I, I )
  191:          SMIN = MIN( SMIN, S( I ) )
  192:          AMAX = MAX( AMAX, S( I ) )
  193:    10 CONTINUE
  194: *
  195:       IF( SMIN.LE.ZERO ) THEN
  196: *
  197: *        Find the first non-positive diagonal element and return.
  198: *
  199:          DO 20 I = 1, N
  200:             IF( S( I ).LE.ZERO ) THEN
  201:                INFO = I
  202:                RETURN
  203:             END IF
  204:    20    CONTINUE
  205:       ELSE
  206: *
  207: *        Set the scale factors to the reciprocals
  208: *        of the diagonal elements.
  209: *
  210:          DO 30 I = 1, N
  211:             S( I ) = BASE ** INT( TMP * LOG( S( I ) ) )
  212:    30    CONTINUE
  213: *
  214: *        Compute SCOND = min(S(I)) / max(S(I)).
  215: *
  216:          SCOND = SQRT( SMIN ) / SQRT( AMAX )
  217:       END IF
  218: *
  219:       RETURN
  220: *
  221: *     End of ZPOEQUB
  222: *
  223:       END

CVSweb interface <joel.bertrand@systella.fr>