3 /* Subroutine */ int dlas2_(doublereal *f, doublereal *g, doublereal *h__,
4 doublereal *ssmin, doublereal *ssmax)
6 /* System generated locals */
9 /* Builtin functions */
10 double sqrt(doublereal);
13 doublereal c__, fa, ga, ha, as, at, au, fhmn, fhmx;
16 /* -- LAPACK auxiliary routine (version 3.1) -- */
17 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
20 /* .. Scalar Arguments .. */
26 /* DLAS2 computes the singular values of the 2-by-2 matrix */
29 /* On return, SSMIN is the smaller singular value and SSMAX is the */
30 /* larger singular value. */
35 /* F (input) DOUBLE PRECISION */
36 /* The (1,1) element of the 2-by-2 matrix. */
38 /* G (input) DOUBLE PRECISION */
39 /* The (1,2) element of the 2-by-2 matrix. */
41 /* H (input) DOUBLE PRECISION */
42 /* The (2,2) element of the 2-by-2 matrix. */
44 /* SSMIN (output) DOUBLE PRECISION */
45 /* The smaller singular value. */
47 /* SSMAX (output) DOUBLE PRECISION */
48 /* The larger singular value. */
53 /* Barring over/underflow, all output quantities are correct to within */
54 /* a few units in the last place (ulps), even in the absence of a guard */
55 /* digit in addition/subtraction. */
57 /* In IEEE arithmetic, the code works correctly if one matrix element is */
60 /* Overflow will not occur unless the largest singular value itself */
61 /* overflows, or is within a few ulps of overflow. (On machines with */
62 /* partial overflow, like the Cray, overflow may occur if the largest */
63 /* singular value is within a factor of 2 of overflow.) */
65 /* Underflow is harmless if underflow is gradual. Otherwise, results */
66 /* may correspond to a matrix modified by perturbations of size near */
67 /* the underflow threshold. */
69 /* ==================================================================== */
71 /* .. Parameters .. */
73 /* .. Local Scalars .. */
75 /* .. Intrinsic Functions .. */
77 /* .. Executable Statements .. */
89 /* Computing 2nd power */
90 d__1 = min(fhmx,ga) / max(fhmx,ga);
91 *ssmax = max(fhmx,ga) * sqrt(d__1 * d__1 + 1.);
95 as = fhmn / fhmx + 1.;
96 at = (fhmx - fhmn) / fhmx;
97 /* Computing 2nd power */
100 c__ = 2. / (sqrt(as * as + au) + sqrt(at * at + au));
107 /* Avoid possible harmful underflow if exponent range */
108 /* asymmetric (true SSMIN may not underflow even if */
111 *ssmin = fhmn * fhmx / ga;
114 as = fhmn / fhmx + 1.;
115 at = (fhmx - fhmn) / fhmx;
116 /* Computing 2nd power */
118 /* Computing 2nd power */
120 c__ = 1. / (sqrt(d__1 * d__1 + 1.) + sqrt(d__2 * d__2 + 1.));
121 *ssmin = fhmn * c__ * au;
123 *ssmax = ga / (c__ + c__);