![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b SLAE2 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download SLAE2 + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slae2.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slae2.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slae2.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE SLAE2( A, B, C, RT1, RT2 ) 00022 * 00023 * .. Scalar Arguments .. 00024 * REAL A, B, C, RT1, RT2 00025 * .. 00026 * 00027 * 00028 *> \par Purpose: 00029 * ============= 00030 *> 00031 *> \verbatim 00032 *> 00033 *> SLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix 00034 *> [ A B ] 00035 *> [ B C ]. 00036 *> On return, RT1 is the eigenvalue of larger absolute value, and RT2 00037 *> is the eigenvalue of smaller absolute value. 00038 *> \endverbatim 00039 * 00040 * Arguments: 00041 * ========== 00042 * 00043 *> \param[in] A 00044 *> \verbatim 00045 *> A is REAL 00046 *> The (1,1) element of the 2-by-2 matrix. 00047 *> \endverbatim 00048 *> 00049 *> \param[in] B 00050 *> \verbatim 00051 *> B is REAL 00052 *> The (1,2) and (2,1) elements of the 2-by-2 matrix. 00053 *> \endverbatim 00054 *> 00055 *> \param[in] C 00056 *> \verbatim 00057 *> C is REAL 00058 *> The (2,2) element of the 2-by-2 matrix. 00059 *> \endverbatim 00060 *> 00061 *> \param[out] RT1 00062 *> \verbatim 00063 *> RT1 is REAL 00064 *> The eigenvalue of larger absolute value. 00065 *> \endverbatim 00066 *> 00067 *> \param[out] RT2 00068 *> \verbatim 00069 *> RT2 is REAL 00070 *> The eigenvalue of smaller absolute value. 00071 *> \endverbatim 00072 * 00073 * Authors: 00074 * ======== 00075 * 00076 *> \author Univ. of Tennessee 00077 *> \author Univ. of California Berkeley 00078 *> \author Univ. of Colorado Denver 00079 *> \author NAG Ltd. 00080 * 00081 *> \date November 2011 00082 * 00083 *> \ingroup auxOTHERauxiliary 00084 * 00085 *> \par Further Details: 00086 * ===================== 00087 *> 00088 *> \verbatim 00089 *> 00090 *> RT1 is accurate to a few ulps barring over/underflow. 00091 *> 00092 *> RT2 may be inaccurate if there is massive cancellation in the 00093 *> determinant A*C-B*B; higher precision or correctly rounded or 00094 *> correctly truncated arithmetic would be needed to compute RT2 00095 *> accurately in all cases. 00096 *> 00097 *> Overflow is possible only if RT1 is within a factor of 5 of overflow. 00098 *> Underflow is harmless if the input data is 0 or exceeds 00099 *> underflow_threshold / macheps. 00100 *> \endverbatim 00101 *> 00102 * ===================================================================== 00103 SUBROUTINE SLAE2( A, B, C, RT1, RT2 ) 00104 * 00105 * -- LAPACK auxiliary routine (version 3.4.0) -- 00106 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00107 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00108 * November 2011 00109 * 00110 * .. Scalar Arguments .. 00111 REAL A, B, C, RT1, RT2 00112 * .. 00113 * 00114 * ===================================================================== 00115 * 00116 * .. Parameters .. 00117 REAL ONE 00118 PARAMETER ( ONE = 1.0E0 ) 00119 REAL TWO 00120 PARAMETER ( TWO = 2.0E0 ) 00121 REAL ZERO 00122 PARAMETER ( ZERO = 0.0E0 ) 00123 REAL HALF 00124 PARAMETER ( HALF = 0.5E0 ) 00125 * .. 00126 * .. Local Scalars .. 00127 REAL AB, ACMN, ACMX, ADF, DF, RT, SM, TB 00128 * .. 00129 * .. Intrinsic Functions .. 00130 INTRINSIC ABS, SQRT 00131 * .. 00132 * .. Executable Statements .. 00133 * 00134 * Compute the eigenvalues 00135 * 00136 SM = A + C 00137 DF = A - C 00138 ADF = ABS( DF ) 00139 TB = B + B 00140 AB = ABS( TB ) 00141 IF( ABS( A ).GT.ABS( C ) ) THEN 00142 ACMX = A 00143 ACMN = C 00144 ELSE 00145 ACMX = C 00146 ACMN = A 00147 END IF 00148 IF( ADF.GT.AB ) THEN 00149 RT = ADF*SQRT( ONE+( AB / ADF )**2 ) 00150 ELSE IF( ADF.LT.AB ) THEN 00151 RT = AB*SQRT( ONE+( ADF / AB )**2 ) 00152 ELSE 00153 * 00154 * Includes case AB=ADF=0 00155 * 00156 RT = AB*SQRT( TWO ) 00157 END IF 00158 IF( SM.LT.ZERO ) THEN 00159 RT1 = HALF*( SM-RT ) 00160 * 00161 * Order of execution important. 00162 * To get fully accurate smaller eigenvalue, 00163 * next line needs to be executed in higher precision. 00164 * 00165 RT2 = ( ACMX / RT1 )*ACMN - ( B / RT1 )*B 00166 ELSE IF( SM.GT.ZERO ) THEN 00167 RT1 = HALF*( SM+RT ) 00168 * 00169 * Order of execution important. 00170 * To get fully accurate smaller eigenvalue, 00171 * next line needs to be executed in higher precision. 00172 * 00173 RT2 = ( ACMX / RT1 )*ACMN - ( B / RT1 )*B 00174 ELSE 00175 * 00176 * Includes case RT1 = RT2 = 0 00177 * 00178 RT1 = HALF*RT 00179 RT2 = -HALF*RT 00180 END IF 00181 RETURN 00182 * 00183 * End of SLAE2 00184 * 00185 END