1 *> \brief \b DLARTGS generates a plane rotation designed to introduce a bulge in implicit QR iteration for the bidiagonal SVD problem.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DLARTGS + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlartgs.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlartgs.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlartgs.f">
21 * SUBROUTINE DLARTGS( X, Y, SIGMA, CS, SN )
23 * .. Scalar Arguments ..
24 * DOUBLE PRECISION CS, SIGMA, SN, X, Y
33 *> DLARTGS generates a plane rotation designed to introduce a bulge in
34 *> Golub-Reinsch-style implicit QR iteration for the bidiagonal SVD
35 *> problem. X and Y are the top-row entries, and SIGMA is the shift.
36 *> The computed CS and SN define a plane rotation satisfying
38 *> [ CS SN ] . [ X^2 - SIGMA ] = [ R ],
39 *> [ -SN CS ] [ X * Y ] [ 0 ]
41 *> with R nonnegative. If X^2 - SIGMA and X * Y are 0, then the
42 *> rotation is by PI/2.
50 *> X is DOUBLE PRECISION
51 *> The (1,1) entry of an upper bidiagonal matrix.
56 *> Y is DOUBLE PRECISION
57 *> The (1,2) entry of an upper bidiagonal matrix.
62 *> SIGMA is DOUBLE PRECISION
68 *> CS is DOUBLE PRECISION
69 *> The cosine of the rotation.
74 *> SN is DOUBLE PRECISION
75 *> The sine of the rotation.
81 *> \author Univ. of Tennessee
82 *> \author Univ. of California Berkeley
83 *> \author Univ. of Colorado Denver
86 *> \date September 2012
88 *> \ingroup auxOTHERcomputational
90 * =====================================================================
91 SUBROUTINE DLARTGS( X, Y, SIGMA, CS, SN )
93 * -- LAPACK computational routine (version 3.4.2) --
94 * -- LAPACK is a software package provided by Univ. of Tennessee, --
95 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
98 * .. Scalar Arguments ..
99 DOUBLE PRECISION CS, SIGMA, SN, X, Y
102 * ===================================================================
105 DOUBLE PRECISION NEGONE, ONE, ZERO
106 PARAMETER ( NEGONE = -1.0D0, ONE = 1.0D0, ZERO = 0.0D0 )
108 * .. Local Scalars ..
109 DOUBLE PRECISION R, S, THRESH, W, Z
111 * .. External Functions ..
112 DOUBLE PRECISION DLAMCH
114 * .. Executable Statements ..
118 * Compute the first column of B**T*B - SIGMA^2*I, up to a scale
121 IF( (SIGMA .EQ. ZERO .AND. ABS(X) .LT. THRESH) .OR.
122 $ (ABS(X) .EQ. SIGMA .AND. Y .EQ. ZERO) ) THEN
125 ELSE IF( SIGMA .EQ. ZERO ) THEN
126 IF( X .GE. ZERO ) THEN
133 ELSE IF( ABS(X) .LT. THRESH ) THEN
137 IF( X .GE. ZERO ) THEN
142 Z = S * (ABS(X)-SIGMA) * (S+SIGMA/X)
146 * Generate the rotation.
147 * CALL DLARTGP( Z, W, CS, SN, R ) might seem more natural;
148 * reordering the arguments ensures that if Z = 0 then the rotation
151 CALL DLARTGP( W, Z, SN, CS, R )