1 *> \brief \b DLASV2 computes the singular value decomposition of a 2-by-2 triangular matrix.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DLASV2 + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlasv2.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlasv2.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlasv2.f">
21 * SUBROUTINE DLASV2( F, G, H, SSMIN, SSMAX, SNR, CSR, SNL, CSL )
23 * .. Scalar Arguments ..
24 * DOUBLE PRECISION CSL, CSR, F, G, H, SNL, SNR, SSMAX, SSMIN
33 *> DLASV2 computes the singular value decomposition of a 2-by-2
37 *> On return, abs(SSMAX) is the larger singular value, abs(SSMIN) is the
38 *> smaller singular value, and (CSL,SNL) and (CSR,SNR) are the left and
39 *> right singular vectors for abs(SSMAX), giving the decomposition
41 *> [ CSL SNL ] [ F G ] [ CSR -SNR ] = [ SSMAX 0 ]
42 *> [-SNL CSL ] [ 0 H ] [ SNR CSR ] [ 0 SSMIN ].
50 *> F is DOUBLE PRECISION
51 *> The (1,1) element of the 2-by-2 matrix.
56 *> G is DOUBLE PRECISION
57 *> The (1,2) element of the 2-by-2 matrix.
62 *> H is DOUBLE PRECISION
63 *> The (2,2) element of the 2-by-2 matrix.
68 *> SSMIN is DOUBLE PRECISION
69 *> abs(SSMIN) is the smaller singular value.
74 *> SSMAX is DOUBLE PRECISION
75 *> abs(SSMAX) is the larger singular value.
80 *> SNL is DOUBLE PRECISION
85 *> CSL is DOUBLE PRECISION
86 *> The vector (CSL, SNL) is a unit left singular vector for the
87 *> singular value abs(SSMAX).
92 *> SNR is DOUBLE PRECISION
97 *> CSR is DOUBLE PRECISION
98 *> The vector (CSR, SNR) is a unit right singular vector for the
99 *> singular value abs(SSMAX).
105 *> \author Univ. of Tennessee
106 *> \author Univ. of California Berkeley
107 *> \author Univ. of Colorado Denver
110 *> \date September 2012
112 *> \ingroup auxOTHERauxiliary
114 *> \par Further Details:
115 * =====================
119 *> Any input parameter may be aliased with any output parameter.
121 *> Barring over/underflow and assuming a guard digit in subtraction, all
122 *> output quantities are correct to within a few units in the last
125 *> In IEEE arithmetic, the code works correctly if one matrix element is
128 *> Overflow will not occur unless the largest singular value itself
129 *> overflows or is within a few ulps of overflow. (On machines with
130 *> partial overflow, like the Cray, overflow may occur if the largest
131 *> singular value is within a factor of 2 of overflow.)
133 *> Underflow is harmless if underflow is gradual. Otherwise, results
134 *> may correspond to a matrix modified by perturbations of size near
135 *> the underflow threshold.
138 * =====================================================================
139 SUBROUTINE DLASV2( F, G, H, SSMIN, SSMAX, SNR, CSR, SNL, CSL )
141 * -- LAPACK auxiliary routine (version 3.4.2) --
142 * -- LAPACK is a software package provided by Univ. of Tennessee, --
143 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
146 * .. Scalar Arguments ..
147 DOUBLE PRECISION CSL, CSR, F, G, H, SNL, SNR, SSMAX, SSMIN
150 * =====================================================================
153 DOUBLE PRECISION ZERO
154 PARAMETER ( ZERO = 0.0D0 )
155 DOUBLE PRECISION HALF
156 PARAMETER ( HALF = 0.5D0 )
158 PARAMETER ( ONE = 1.0D0 )
160 PARAMETER ( TWO = 2.0D0 )
161 DOUBLE PRECISION FOUR
162 PARAMETER ( FOUR = 4.0D0 )
164 * .. Local Scalars ..
167 DOUBLE PRECISION A, CLT, CRT, D, FA, FT, GA, GT, HA, HT, L, M,
168 $ MM, R, S, SLT, SRT, T, TEMP, TSIGN, TT
170 * .. Intrinsic Functions ..
171 INTRINSIC ABS, SIGN, SQRT
173 * .. External Functions ..
174 DOUBLE PRECISION DLAMCH
177 * .. Executable Statements ..
184 * PMAX points to the maximum absolute element of matrix
185 * PMAX = 1 if F largest in absolute values
186 * PMAX = 2 if G largest in absolute values
187 * PMAX = 3 if H largest in absolute values
205 IF( GA.EQ.ZERO ) THEN
219 IF( ( FA / GA ).LT.DLAMCH( 'EPS' ) ) THEN
221 * Case of very large GA
226 SSMIN = FA / ( GA / HA )
228 SSMIN = ( FA / GA )*HA
243 * Copes with infinite F or H
250 * Note that 0 .le. L .le. 1
254 * Note that abs(M) .le. 1/macheps
264 * Note that 1 .le. S .le. 1 + 1/macheps
272 * Note that 0 .le. R .le. 1 + 1/macheps
276 * Note that 1 .le. A .le. 1 + abs(M)
280 IF( MM.EQ.ZERO ) THEN
282 * Note that M is very tiny
285 T = SIGN( TWO, FT )*SIGN( ONE, GT )
287 T = GT / SIGN( D, FT ) + M / T
290 T = ( M / ( S+T )+M / ( R+L ) )*( ONE+A )
295 CLT = ( CRT+SRT*M ) / A
296 SLT = ( HT / FT )*SRT / A
311 * Correct signs of SSMAX and SSMIN
314 $ TSIGN = SIGN( ONE, CSR )*SIGN( ONE, CSL )*SIGN( ONE, F )
316 $ TSIGN = SIGN( ONE, SNR )*SIGN( ONE, CSL )*SIGN( ONE, G )
318 $ TSIGN = SIGN( ONE, SNR )*SIGN( ONE, SNL )*SIGN( ONE, H )
319 SSMAX = SIGN( SSMAX, TSIGN )
320 SSMIN = SIGN( SSMIN, TSIGN*SIGN( ONE, F )*SIGN( ONE, H ) )