LAPACK 3.12.1
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 102 of file slas2.f.

103*
104* -- LAPACK auxiliary routine --
105* -- LAPACK is a software package provided by Univ. of Tennessee, --
106* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
107*
108* .. Scalar Arguments ..
109 REAL F, G, H, SSMAX, SSMIN
110* ..
111*
112* ====================================================================
113*
114* .. Parameters ..
115 REAL ZERO
116 parameter( zero = 0.0e0 )
117 REAL ONE
118 parameter( one = 1.0e0 )
119 REAL TWO
120 parameter( two = 2.0e0 )
121* ..
122* .. Local Scalars ..
123 REAL AS, AT, AU, C, FA, FHMN, FHMX, GA, HA
124* ..
125* .. Intrinsic Functions ..
126 INTRINSIC abs, max, min, sqrt
127* ..
128* .. Executable Statements ..
129*
130 fa = abs( f )
131 ga = abs( g )
132 ha = abs( h )
133 fhmn = min( fa, ha )
134 fhmx = max( fa, ha )
135 IF( fhmn.EQ.zero ) THEN
136 ssmin = zero
137 IF( fhmx.EQ.zero ) THEN
138 ssmax = ga
139 ELSE
140 ssmax = max( fhmx, ga )*sqrt( one+
141 $ ( min( fhmx, ga ) / max( fhmx, ga ) )**2 )
142 END IF
143 ELSE
144 IF( ga.LT.fhmx ) THEN
145 as = one + fhmn / fhmx
146 at = ( fhmx-fhmn ) / fhmx
147 au = ( ga / fhmx )**2
148 c = two / ( sqrt( as*as+au )+sqrt( at*at+au ) )
149 ssmin = fhmn*c
150 ssmax = fhmx / c
151 ELSE
152 au = fhmx / ga
153 IF( au.EQ.zero ) THEN
154*
155* Avoid possible harmful underflow if exponent range
156* asymmetric (true SSMIN may not underflow even if
157* AU underflows)
158*
159 ssmin = ( fhmn*fhmx ) / ga
160 ssmax = ga
161 ELSE
162 as = one + fhmn / fhmx
163 at = ( fhmx-fhmn ) / fhmx
164 c = one / ( sqrt( one+( as*au )**2 )+
165 $ sqrt( one+( at*au )**2 ) )
166 ssmin = ( fhmn*c )*au
167 ssmin = ssmin + ssmin
168 ssmax = ga / ( c+c )
169 END IF
170 END IF
171 END IF
172 RETURN
173*
174* End of SLAS2
175*
Here is the caller graph for this function: