LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dlas2.f
Go to the documentation of this file.
1*> \brief \b DLAS2 computes singular values of a 2-by-2 triangular matrix.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> \htmlonly
9*> Download DLAS2 + dependencies
10*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlas2.f">
11*> [TGZ]</a>
12*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlas2.f">
13*> [ZIP]</a>
14*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlas2.f">
15*> [TXT]</a>
16*> \endhtmlonly
17*
18* Definition:
19* ===========
20*
21* SUBROUTINE DLAS2( F, G, H, SSMIN, SSMAX )
22*
23* .. Scalar Arguments ..
24* DOUBLE PRECISION F, G, H, SSMAX, SSMIN
25* ..
26*
27*
28*> \par Purpose:
29* =============
30*>
31*> \verbatim
32*>
33*> DLAS2 computes the singular values of the 2-by-2 matrix
34*> [ F G ]
35*> [ 0 H ].
36*> On return, SSMIN is the smaller singular value and SSMAX is the
37*> larger singular value.
38*> \endverbatim
39*
40* Arguments:
41* ==========
42*
43*> \param[in] F
44*> \verbatim
45*> F is DOUBLE PRECISION
46*> The (1,1) element of the 2-by-2 matrix.
47*> \endverbatim
48*>
49*> \param[in] G
50*> \verbatim
51*> G is DOUBLE PRECISION
52*> The (1,2) element of the 2-by-2 matrix.
53*> \endverbatim
54*>
55*> \param[in] H
56*> \verbatim
57*> H is DOUBLE PRECISION
58*> The (2,2) element of the 2-by-2 matrix.
59*> \endverbatim
60*>
61*> \param[out] SSMIN
62*> \verbatim
63*> SSMIN is DOUBLE PRECISION
64*> The smaller singular value.
65*> \endverbatim
66*>
67*> \param[out] SSMAX
68*> \verbatim
69*> SSMAX is DOUBLE PRECISION
70*> The larger singular 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 las2
82*
83*> \par Further Details:
84* =====================
85*>
86*> \verbatim
87*>
88*> Barring over/underflow, all output quantities are correct to within
89*> a few units in the last place (ulps), even in the absence of a guard
90*> digit in addition/subtraction.
91*>
92*> In IEEE arithmetic, the code works correctly if one matrix element is
93*> infinite.
94*>
95*> Overflow will not occur unless the largest singular value itself
96*> overflows, or is within a few ulps of overflow.
97*>
98*> Underflow is harmless if underflow is gradual. Otherwise, results
99*> may correspond to a matrix modified by perturbations of size near
100*> the underflow threshold.
101*> \endverbatim
102*>
103* =====================================================================
104 SUBROUTINE dlas2( F, G, H, SSMIN, SSMAX )
105*
106* -- LAPACK auxiliary routine --
107* -- LAPACK is a software package provided by Univ. of Tennessee, --
108* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
109*
110* .. Scalar Arguments ..
111 DOUBLE PRECISION F, G, H, SSMAX, SSMIN
112* ..
113*
114* ====================================================================
115*
116* .. Parameters ..
117 DOUBLE PRECISION ZERO
118 parameter( zero = 0.0d0 )
119 DOUBLE PRECISION ONE
120 parameter( one = 1.0d0 )
121 DOUBLE PRECISION TWO
122 parameter( two = 2.0d0 )
123* ..
124* .. Local Scalars ..
125 DOUBLE PRECISION AS, AT, AU, C, FA, FHMN, FHMX, GA, HA
126* ..
127* .. Intrinsic Functions ..
128 INTRINSIC abs, max, min, sqrt
129* ..
130* .. Executable Statements ..
131*
132 fa = abs( f )
133 ga = abs( g )
134 ha = abs( h )
135 fhmn = min( fa, ha )
136 fhmx = max( fa, ha )
137 IF( fhmn.EQ.zero ) THEN
138 ssmin = zero
139 IF( fhmx.EQ.zero ) THEN
140 ssmax = ga
141 ELSE
142 ssmax = max( fhmx, ga )*sqrt( one+
143 $ ( min( fhmx, ga ) / max( fhmx, ga ) )**2 )
144 END IF
145 ELSE
146 IF( ga.LT.fhmx ) THEN
147 as = one + fhmn / fhmx
148 at = ( fhmx-fhmn ) / fhmx
149 au = ( ga / fhmx )**2
150 c = two / ( sqrt( as*as+au )+sqrt( at*at+au ) )
151 ssmin = fhmn*c
152 ssmax = fhmx / c
153 ELSE
154 au = fhmx / ga
155 IF( au.EQ.zero ) THEN
156*
157* Avoid possible harmful underflow if exponent range
158* asymmetric (true SSMIN may not underflow even if
159* AU underflows)
160*
161 ssmin = ( fhmn*fhmx ) / ga
162 ssmax = ga
163 ELSE
164 as = one + fhmn / fhmx
165 at = ( fhmx-fhmn ) / fhmx
166 c = one / ( sqrt( one+( as*au )**2 )+
167 $ sqrt( one+( at*au )**2 ) )
168 ssmin = ( fhmn*c )*au
169 ssmin = ssmin + ssmin
170 ssmax = ga / ( c+c )
171 END IF
172 END IF
173 END IF
174 RETURN
175*
176* End of DLAS2
177*
178 END
subroutine dlas2(f, g, h, ssmin, ssmax)
DLAS2 computes singular values of a 2-by-2 triangular matrix.
Definition dlas2.f:105