slas2.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 144 行
HTML
144 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>slas2.f</title>
<meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!--
body { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default a { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.comment { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.comment a { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
--></style>
</head>
<body>
<pre>
SUBROUTINE <a name="SLAS2.1"></a><a href="slas2.f.html#SLAS2.1">SLAS2</a>( F, G, H, SSMIN, SSMAX )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK auxiliary routine (version 3.1) --
</span><span class="comment">*</span><span class="comment"> Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment"> November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Scalar Arguments ..
</span> REAL F, G, H, SSMAX, SSMIN
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Purpose
</span><span class="comment">*</span><span class="comment"> =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="SLAS2.14"></a><a href="slas2.f.html#SLAS2.1">SLAS2</a> computes the singular values of the 2-by-2 matrix
</span><span class="comment">*</span><span class="comment"> [ F G ]
</span><span class="comment">*</span><span class="comment"> [ 0 H ].
</span><span class="comment">*</span><span class="comment"> On return, SSMIN is the smaller singular value and SSMAX is the
</span><span class="comment">*</span><span class="comment"> larger singular value.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Arguments
</span><span class="comment">*</span><span class="comment"> =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> F (input) REAL
</span><span class="comment">*</span><span class="comment"> The (1,1) element of the 2-by-2 matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> G (input) REAL
</span><span class="comment">*</span><span class="comment"> The (1,2) element of the 2-by-2 matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> H (input) REAL
</span><span class="comment">*</span><span class="comment"> The (2,2) element of the 2-by-2 matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> SSMIN (output) REAL
</span><span class="comment">*</span><span class="comment"> The smaller singular value.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> SSMAX (output) REAL
</span><span class="comment">*</span><span class="comment"> The larger singular value.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Further Details
</span><span class="comment">*</span><span class="comment"> ===============
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Barring over/underflow, all output quantities are correct to within
</span><span class="comment">*</span><span class="comment"> a few units in the last place (ulps), even in the absence of a guard
</span><span class="comment">*</span><span class="comment"> digit in addition/subtraction.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> In IEEE arithmetic, the code works correctly if one matrix element is
</span><span class="comment">*</span><span class="comment"> infinite.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Overflow will not occur unless the largest singular value itself
</span><span class="comment">*</span><span class="comment"> overflows, or is within a few ulps of overflow. (On machines with
</span><span class="comment">*</span><span class="comment"> partial overflow, like the Cray, overflow may occur if the largest
</span><span class="comment">*</span><span class="comment"> singular value is within a factor of 2 of overflow.)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Underflow is harmless if underflow is gradual. Otherwise, results
</span><span class="comment">*</span><span class="comment"> may correspond to a matrix modified by perturbations of size near
</span><span class="comment">*</span><span class="comment"> the underflow threshold.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> ====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Parameters ..
</span> REAL ZERO
PARAMETER ( ZERO = 0.0E0 )
REAL ONE
PARAMETER ( ONE = 1.0E0 )
REAL TWO
PARAMETER ( TWO = 2.0E0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> REAL AS, AT, AU, C, FA, FHMN, FHMX, GA, HA
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC ABS, MAX, MIN, SQRT
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span> FA = ABS( F )
GA = ABS( G )
HA = ABS( H )
FHMN = MIN( FA, HA )
FHMX = MAX( FA, HA )
IF( FHMN.EQ.ZERO ) THEN
SSMIN = ZERO
IF( FHMX.EQ.ZERO ) THEN
SSMAX = GA
ELSE
SSMAX = MAX( FHMX, GA )*SQRT( ONE+
$ ( MIN( FHMX, GA ) / MAX( FHMX, GA ) )**2 )
END IF
ELSE
IF( GA.LT.FHMX ) THEN
AS = ONE + FHMN / FHMX
AT = ( FHMX-FHMN ) / FHMX
AU = ( GA / FHMX )**2
C = TWO / ( SQRT( AS*AS+AU )+SQRT( AT*AT+AU ) )
SSMIN = FHMN*C
SSMAX = FHMX / C
ELSE
AU = FHMX / GA
IF( AU.EQ.ZERO ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Avoid possible harmful underflow if exponent range
</span><span class="comment">*</span><span class="comment"> asymmetric (true SSMIN may not underflow even if
</span><span class="comment">*</span><span class="comment"> AU underflows)
</span><span class="comment">*</span><span class="comment">
</span> SSMIN = ( FHMN*FHMX ) / GA
SSMAX = GA
ELSE
AS = ONE + FHMN / FHMX
AT = ( FHMX-FHMN ) / FHMX
C = ONE / ( SQRT( ONE+( AS*AU )**2 )+
$ SQRT( ONE+( AT*AU )**2 ) )
SSMIN = ( FHMN*C )*AU
SSMIN = SSMIN + SSMIN
SSMAX = GA / ( C+C )
END IF
END IF
END IF
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="SLAS2.119"></a><a href="slas2.f.html#SLAS2.1">SLAS2</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?