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

◆ dlas2()

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.
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 106 of file dlas2.f.

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