3 /* Subroutine */ int slas2_(real *f, real *g, real *h__, real *ssmin, real *
6 /* System generated locals */
9 /* Builtin functions */
10 double sqrt(doublereal);
13 real 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 /* SLAS2 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. */
36 /* The (1,1) element of the 2-by-2 matrix. */
39 /* The (1,2) element of the 2-by-2 matrix. */
42 /* The (2,2) element of the 2-by-2 matrix. */
44 /* SSMIN (output) REAL */
45 /* The smaller singular value. */
47 /* SSMAX (output) REAL */
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 r__1 = dmin(fhmx,ga) / dmax(fhmx,ga);
91 *ssmax = dmax(fhmx,ga) * sqrt(r__1 * r__1 + 1.f);
95 as = fhmn / fhmx + 1.f;
96 at = (fhmx - fhmn) / fhmx;
97 /* Computing 2nd power */
100 c__ = 2.f / (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.f;
115 at = (fhmx - fhmn) / fhmx;
116 /* Computing 2nd power */
118 /* Computing 2nd power */
120 c__ = 1.f / (sqrt(r__1 * r__1 + 1.f) + sqrt(r__2 * r__2 + 1.f)
122 *ssmin = fhmn * c__ * au;
124 *ssmax = ga / (c__ + c__);