LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine dlas2 ( double precision  F,
double precision  G,
double precision  H,
double precision  SSMIN,
double precision  SSMAX 
)

DLAS2 computes singular values of a 2-by-2 triangular matrix.

Download DLAS2 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 DLAS2  computes the singular values of the 2-by-2 matrix
    [  F   G  ]
    [  0   H  ].
 On return, SSMIN is the smaller singular value and SSMAX is the
 larger singular value.
Parameters
[in]F
          F is DOUBLE PRECISION
          The (1,1) element of the 2-by-2 matrix.
[in]G
          G is DOUBLE PRECISION
          The (1,2) element of the 2-by-2 matrix.
[in]H
          H is DOUBLE PRECISION
          The (2,2) element of the 2-by-2 matrix.
[out]SSMIN
          SSMIN is DOUBLE PRECISION
          The smaller singular value.
[out]SSMAX
          SSMAX is DOUBLE PRECISION
          The larger singular value.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012
Further Details:
  Barring over/underflow, all output quantities are correct to within
  a few units in the last place (ulps), even in the absence of a guard
  digit in addition/subtraction.

  In IEEE arithmetic, the code works correctly if one matrix element is
  infinite.

  Overflow will not occur unless the largest singular value itself
  overflows, or is within a few ulps of overflow. (On machines with
  partial overflow, like the Cray, overflow may occur if the largest
  singular value is within a factor of 2 of overflow.)

  Underflow is harmless if underflow is gradual. Otherwise, results
  may correspond to a matrix modified by perturbations of size near
  the underflow threshold.

Definition at line 109 of file dlas2.f.

109 *
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..--
113 * September 2012
114 *
115 * .. Scalar Arguments ..
116  DOUBLE PRECISION f, g, h, ssmax, ssmin
117 * ..
118 *
119 * ====================================================================
120 *
121 * .. Parameters ..
122  DOUBLE PRECISION zero
123  parameter ( zero = 0.0d0 )
124  DOUBLE PRECISION one
125  parameter ( one = 1.0d0 )
126  DOUBLE PRECISION two
127  parameter ( two = 2.0d0 )
128 * ..
129 * .. Local Scalars ..
130  DOUBLE PRECISION as, at, au, c, fa, fhmn, fhmx, ga, ha
131 * ..
132 * .. Intrinsic Functions ..
133  INTRINSIC abs, max, min, sqrt
134 * ..
135 * .. Executable Statements ..
136 *
137  fa = abs( f )
138  ga = abs( g )
139  ha = abs( h )
140  fhmn = min( fa, ha )
141  fhmx = max( fa, ha )
142  IF( fhmn.EQ.zero ) THEN
143  ssmin = zero
144  IF( fhmx.EQ.zero ) THEN
145  ssmax = ga
146  ELSE
147  ssmax = max( fhmx, ga )*sqrt( one+
148  $ ( min( fhmx, ga ) / max( fhmx, ga ) )**2 )
149  END IF
150  ELSE
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 ) )
156  ssmin = fhmn*c
157  ssmax = fhmx / c
158  ELSE
159  au = fhmx / ga
160  IF( au.EQ.zero ) THEN
161 *
162 * Avoid possible harmful underflow if exponent range
163 * asymmetric (true SSMIN may not underflow even if
164 * AU underflows)
165 *
166  ssmin = ( fhmn*fhmx ) / ga
167  ssmax = ga
168  ELSE
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
175  ssmax = ga / ( c+c )
176  END IF
177  END IF
178  END IF
179  RETURN
180 *
181 * End of DLAS2
182 *

Here is the caller graph for this function: