File:  [local] / rpl / lapack / lapack / dlae2.f
Revision 1.18: download - view: text, annotated - select for diffs - revision graph
Mon Aug 7 08:38:53 2023 UTC (8 months, 3 weeks ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_35, rpl-4_1_34, HEAD
Première mise à jour de lapack et blas.

    1: *> \brief \b DLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix.
    2: *
    3: *  =========== DOCUMENTATION ===========
    4: *
    5: * Online html documentation available at
    6: *            http://www.netlib.org/lapack/explore-html/
    7: *
    8: *> \htmlonly
    9: *> Download DLAE2 + dependencies
   10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlae2.f">
   11: *> [TGZ]</a>
   12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlae2.f">
   13: *> [ZIP]</a>
   14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlae2.f">
   15: *> [TXT]</a>
   16: *> \endhtmlonly
   17: *
   18: *  Definition:
   19: *  ===========
   20: *
   21: *       SUBROUTINE DLAE2( A, B, C, RT1, RT2 )
   22: *
   23: *       .. Scalar Arguments ..
   24: *       DOUBLE PRECISION   A, B, C, RT1, RT2
   25: *       ..
   26: *
   27: *
   28: *> \par Purpose:
   29: *  =============
   30: *>
   31: *> \verbatim
   32: *>
   33: *> DLAE2  computes the eigenvalues of a 2-by-2 symmetric matrix
   34: *>    [  A   B  ]
   35: *>    [  B   C  ].
   36: *> On return, RT1 is the eigenvalue of larger absolute value, and RT2
   37: *> is the eigenvalue of smaller absolute value.
   38: *> \endverbatim
   39: *
   40: *  Arguments:
   41: *  ==========
   42: *
   43: *> \param[in] A
   44: *> \verbatim
   45: *>          A is DOUBLE PRECISION
   46: *>          The (1,1) element of the 2-by-2 matrix.
   47: *> \endverbatim
   48: *>
   49: *> \param[in] B
   50: *> \verbatim
   51: *>          B is DOUBLE PRECISION
   52: *>          The (1,2) and (2,1) elements of the 2-by-2 matrix.
   53: *> \endverbatim
   54: *>
   55: *> \param[in] C
   56: *> \verbatim
   57: *>          C is DOUBLE PRECISION
   58: *>          The (2,2) element of the 2-by-2 matrix.
   59: *> \endverbatim
   60: *>
   61: *> \param[out] RT1
   62: *> \verbatim
   63: *>          RT1 is DOUBLE PRECISION
   64: *>          The eigenvalue of larger absolute value.
   65: *> \endverbatim
   66: *>
   67: *> \param[out] RT2
   68: *> \verbatim
   69: *>          RT2 is DOUBLE PRECISION
   70: *>          The eigenvalue of smaller absolute value.
   71: *> \endverbatim
   72: *
   73: *  Authors:
   74: *  ========
   75: *
   76: *> \author Univ. of Tennessee
   77: *> \author Univ. of California Berkeley
   78: *> \author Univ. of Colorado Denver
   79: *> \author NAG Ltd.
   80: *
   81: *> \ingroup OTHERauxiliary
   82: *
   83: *> \par Further Details:
   84: *  =====================
   85: *>
   86: *> \verbatim
   87: *>
   88: *>  RT1 is accurate to a few ulps barring over/underflow.
   89: *>
   90: *>  RT2 may be inaccurate if there is massive cancellation in the
   91: *>  determinant A*C-B*B; higher precision or correctly rounded or
   92: *>  correctly truncated arithmetic would be needed to compute RT2
   93: *>  accurately in all cases.
   94: *>
   95: *>  Overflow is possible only if RT1 is within a factor of 5 of overflow.
   96: *>  Underflow is harmless if the input data is 0 or exceeds
   97: *>     underflow_threshold / macheps.
   98: *> \endverbatim
   99: *>
  100: *  =====================================================================
  101:       SUBROUTINE DLAE2( A, B, C, RT1, RT2 )
  102: *
  103: *  -- LAPACK auxiliary routine --
  104: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
  105: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  106: *
  107: *     .. Scalar Arguments ..
  108:       DOUBLE PRECISION   A, B, C, RT1, RT2
  109: *     ..
  110: *
  111: * =====================================================================
  112: *
  113: *     .. Parameters ..
  114:       DOUBLE PRECISION   ONE
  115:       PARAMETER          ( ONE = 1.0D0 )
  116:       DOUBLE PRECISION   TWO
  117:       PARAMETER          ( TWO = 2.0D0 )
  118:       DOUBLE PRECISION   ZERO
  119:       PARAMETER          ( ZERO = 0.0D0 )
  120:       DOUBLE PRECISION   HALF
  121:       PARAMETER          ( HALF = 0.5D0 )
  122: *     ..
  123: *     .. Local Scalars ..
  124:       DOUBLE PRECISION   AB, ACMN, ACMX, ADF, DF, RT, SM, TB
  125: *     ..
  126: *     .. Intrinsic Functions ..
  127:       INTRINSIC          ABS, SQRT
  128: *     ..
  129: *     .. Executable Statements ..
  130: *
  131: *     Compute the eigenvalues
  132: *
  133:       SM = A + C
  134:       DF = A - C
  135:       ADF = ABS( DF )
  136:       TB = B + B
  137:       AB = ABS( TB )
  138:       IF( ABS( A ).GT.ABS( C ) ) THEN
  139:          ACMX = A
  140:          ACMN = C
  141:       ELSE
  142:          ACMX = C
  143:          ACMN = A
  144:       END IF
  145:       IF( ADF.GT.AB ) THEN
  146:          RT = ADF*SQRT( ONE+( AB / ADF )**2 )
  147:       ELSE IF( ADF.LT.AB ) THEN
  148:          RT = AB*SQRT( ONE+( ADF / AB )**2 )
  149:       ELSE
  150: *
  151: *        Includes case AB=ADF=0
  152: *
  153:          RT = AB*SQRT( TWO )
  154:       END IF
  155:       IF( SM.LT.ZERO ) THEN
  156:          RT1 = HALF*( SM-RT )
  157: *
  158: *        Order of execution important.
  159: *        To get fully accurate smaller eigenvalue,
  160: *        next line needs to be executed in higher precision.
  161: *
  162:          RT2 = ( ACMX / RT1 )*ACMN - ( B / RT1 )*B
  163:       ELSE IF( SM.GT.ZERO ) THEN
  164:          RT1 = HALF*( SM+RT )
  165: *
  166: *        Order of execution important.
  167: *        To get fully accurate smaller eigenvalue,
  168: *        next line needs to be executed in higher precision.
  169: *
  170:          RT2 = ( ACMX / RT1 )*ACMN - ( B / RT1 )*B
  171:       ELSE
  172: *
  173: *        Includes case RT1 = RT2 = 0
  174: *
  175:          RT1 = HALF*RT
  176:          RT2 = -HALF*RT
  177:       END IF
  178:       RETURN
  179: *
  180: *     End of DLAE2
  181: *
  182:       END

CVSweb interface <joel.bertrand@systella.fr>