1 *> \brief \b DLAS2 computes singular values of a 2-by-2 triangular matrix.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DLAS2 + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlas2.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlas2.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlas2.f">
21 * SUBROUTINE DLAS2( F, G, H, SSMIN, SSMAX )
23 * .. Scalar Arguments ..
24 * DOUBLE PRECISION F, G, H, SSMAX, SSMIN
33 *> DLAS2 computes the singular values of the 2-by-2 matrix
36 *> On return, SSMIN is the smaller singular value and SSMAX is the
37 *> larger singular value.
45 *> F is DOUBLE PRECISION
46 *> The (1,1) element of the 2-by-2 matrix.
51 *> G is DOUBLE PRECISION
52 *> The (1,2) element of the 2-by-2 matrix.
57 *> H is DOUBLE PRECISION
58 *> The (2,2) element of the 2-by-2 matrix.
63 *> SSMIN is DOUBLE PRECISION
64 *> The smaller singular value.
69 *> SSMAX is DOUBLE PRECISION
70 *> The larger singular value.
76 *> \author Univ. of Tennessee
77 *> \author Univ. of California Berkeley
78 *> \author Univ. of Colorado Denver
81 *> \date September 2012
83 *> \ingroup OTHERauxiliary
85 *> \par Further Details:
86 * =====================
90 *> Barring over/underflow, all output quantities are correct to within
91 *> a few units in the last place (ulps), even in the absence of a guard
92 *> digit in addition/subtraction.
94 *> In IEEE arithmetic, the code works correctly if one matrix element is
97 *> Overflow will not occur unless the largest singular value itself
98 *> overflows, or is within a few ulps of overflow. (On machines with
99 *> partial overflow, like the Cray, overflow may occur if the largest
100 *> singular value is within a factor of 2 of overflow.)
102 *> Underflow is harmless if underflow is gradual. Otherwise, results
103 *> may correspond to a matrix modified by perturbations of size near
104 *> the underflow threshold.
107 * =====================================================================
108 SUBROUTINE DLAS2( F, G, H, SSMIN, SSMAX )
110 * -- LAPACK auxiliary routine (version 3.4.2) --
111 * -- LAPACK is a software package provided by Univ. of Tennessee, --
112 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
115 * .. Scalar Arguments ..
116 DOUBLE PRECISION F, G, H, SSMAX, SSMIN
119 * ====================================================================
122 DOUBLE PRECISION ZERO
123 PARAMETER ( ZERO = 0.0D0 )
125 PARAMETER ( ONE = 1.0D0 )
127 PARAMETER ( TWO = 2.0D0 )
129 * .. Local Scalars ..
130 DOUBLE PRECISION AS, AT, AU, C, FA, FHMN, FHMX, GA, HA
132 * .. Intrinsic Functions ..
133 INTRINSIC ABS, MAX, MIN, SQRT
135 * .. Executable Statements ..
142 IF( FHMN.EQ.ZERO ) THEN
144 IF( FHMX.EQ.ZERO ) THEN
147 SSMAX = MAX( FHMX, GA )*SQRT( ONE+
148 $ ( MIN( FHMX, GA ) / MAX( FHMX, GA ) )**2 )
151 IF( GA.LT.FHMX ) THEN
152 AS = ONE + FHMN / FHMX
153 AT = ( FHMX-FHMN ) / FHMX
154 AU = ( GA / FHMX )**2
155 C = TWO / ( SQRT( AS*AS+AU )+SQRT( AT*AT+AU ) )
160 IF( AU.EQ.ZERO ) THEN
162 * Avoid possible harmful underflow if exponent range
163 * asymmetric (true SSMIN may not underflow even if
166 SSMIN = ( FHMN*FHMX ) / GA
169 AS = ONE + FHMN / FHMX
170 AT = ( FHMX-FHMN ) / FHMX
171 C = ONE / ( SQRT( ONE+( AS*AU )**2 )+
172 $ SQRT( ONE+( AT*AU )**2 ) )
173 SSMIN = ( FHMN*C )*AU
174 SSMIN = SSMIN + SSMIN