LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ slas2()

subroutine slas2 ( real  f,
real  g,
real  h,
real  ssmin,
real  ssmax 
)

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

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

Purpose:
 SLAS2  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 REAL
          The (1,1) element of the 2-by-2 matrix.
[in]G
          G is REAL
          The (1,2) element of the 2-by-2 matrix.
[in]H
          H is REAL
          The (2,2) element of the 2-by-2 matrix.
[out]SSMIN
          SSMIN is REAL
          The smaller singular value.
[out]SSMAX
          SSMAX is REAL
          The larger singular value.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
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.

  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 104 of file slas2.f.

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 REAL F, G, H, SSMAX, SSMIN
112* ..
113*
114* ====================================================================
115*
116* .. Parameters ..
117 REAL ZERO
118 parameter( zero = 0.0e0 )
119 REAL ONE
120 parameter( one = 1.0e0 )
121 REAL TWO
122 parameter( two = 2.0e0 )
123* ..
124* .. Local Scalars ..
125 REAL 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 SLAS2
177*
Here is the caller graph for this function: