LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine slasq1 ( integer  N,
real, dimension( * )  D,
real, dimension( * )  E,
real, dimension( * )  WORK,
integer  INFO 
)

SLASQ1 computes the singular values of a real square bidiagonal matrix. Used by sbdsqr.

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

Purpose:
 SLASQ1 computes the singular values of a real N-by-N bidiagonal
 matrix with diagonal D and off-diagonal E. The singular values
 are computed to high relative accuracy, in the absence of
 denormalization, underflow and overflow. The algorithm was first
 presented in

 "Accurate singular values and differential qd algorithms" by K. V.
 Fernando and B. N. Parlett, Numer. Math., Vol-67, No. 2, pp. 191-230,
 1994,

 and the present implementation is described in "An implementation of
 the dqds Algorithm (Positive Case)", LAPACK Working Note.
Parameters
[in]N
          N is INTEGER
        The number of rows and columns in the matrix. N >= 0.
[in,out]D
          D is REAL array, dimension (N)
        On entry, D contains the diagonal elements of the
        bidiagonal matrix whose SVD is desired. On normal exit,
        D contains the singular values in decreasing order.
[in,out]E
          E is REAL array, dimension (N)
        On entry, elements E(1:N-1) contain the off-diagonal elements
        of the bidiagonal matrix whose SVD is desired.
        On exit, E is overwritten.
[out]WORK
          WORK is REAL array, dimension (4*N)
[out]INFO
          INFO is INTEGER
        = 0: successful exit
        < 0: if INFO = -i, the i-th argument had an illegal value
        > 0: the algorithm failed
             = 1, a split was marked by a positive value in E
             = 2, current block of Z not diagonalized after 100*N
                  iterations (in inner while loop)  On exit D and E
                  represent a matrix with the same singular values
                  which the calling subroutine could use to finish the
                  computation, or even feed back into SLASQ1
             = 3, termination criterion of outer while loop not met 
                  (program created more than N unreduced blocks)
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2015

Definition at line 110 of file slasq1.f.

110 *
111 * -- LAPACK computational routine (version 3.6.0) --
112 * -- LAPACK is a software package provided by Univ. of Tennessee, --
113 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
114 * November 2015
115 *
116 * .. Scalar Arguments ..
117  INTEGER info, n
118 * ..
119 * .. Array Arguments ..
120  REAL d( * ), e( * ), work( * )
121 * ..
122 *
123 * =====================================================================
124 *
125 * .. Parameters ..
126  REAL zero
127  parameter ( zero = 0.0e0 )
128 * ..
129 * .. Local Scalars ..
130  INTEGER i, iinfo
131  REAL eps, scale, safmin, sigmn, sigmx
132 * ..
133 * .. External Subroutines ..
134  EXTERNAL scopy, slas2, slascl, slasq2, slasrt, xerbla
135 * ..
136 * .. External Functions ..
137  REAL slamch
138  EXTERNAL slamch
139 * ..
140 * .. Intrinsic Functions ..
141  INTRINSIC abs, max, sqrt
142 * ..
143 * .. Executable Statements ..
144 *
145  info = 0
146  IF( n.LT.0 ) THEN
147  info = -1
148  CALL xerbla( 'SLASQ1', -info )
149  RETURN
150  ELSE IF( n.EQ.0 ) THEN
151  RETURN
152  ELSE IF( n.EQ.1 ) THEN
153  d( 1 ) = abs( d( 1 ) )
154  RETURN
155  ELSE IF( n.EQ.2 ) THEN
156  CALL slas2( d( 1 ), e( 1 ), d( 2 ), sigmn, sigmx )
157  d( 1 ) = sigmx
158  d( 2 ) = sigmn
159  RETURN
160  END IF
161 *
162 * Estimate the largest singular value.
163 *
164  sigmx = zero
165  DO 10 i = 1, n - 1
166  d( i ) = abs( d( i ) )
167  sigmx = max( sigmx, abs( e( i ) ) )
168  10 CONTINUE
169  d( n ) = abs( d( n ) )
170 *
171 * Early return if SIGMX is zero (matrix is already diagonal).
172 *
173  IF( sigmx.EQ.zero ) THEN
174  CALL slasrt( 'D', n, d, iinfo )
175  RETURN
176  END IF
177 *
178  DO 20 i = 1, n
179  sigmx = max( sigmx, d( i ) )
180  20 CONTINUE
181 *
182 * Copy D and E into WORK (in the Z format) and scale (squaring the
183 * input data makes scaling by a power of the radix pointless).
184 *
185  eps = slamch( 'Precision' )
186  safmin = slamch( 'Safe minimum' )
187  scale = sqrt( eps / safmin )
188  CALL scopy( n, d, 1, work( 1 ), 2 )
189  CALL scopy( n-1, e, 1, work( 2 ), 2 )
190  CALL slascl( 'G', 0, 0, sigmx, scale, 2*n-1, 1, work, 2*n-1,
191  $ iinfo )
192 *
193 * Compute the q's and e's.
194 *
195  DO 30 i = 1, 2*n - 1
196  work( i ) = work( i )**2
197  30 CONTINUE
198  work( 2*n ) = zero
199 *
200  CALL slasq2( n, work, info )
201 *
202  IF( info.EQ.0 ) THEN
203  DO 40 i = 1, n
204  d( i ) = sqrt( work( i ) )
205  40 CONTINUE
206  CALL slascl( 'G', 0, 0, scale, sigmx, n, 1, d, n, iinfo )
207  ELSE IF( info.EQ.2 ) THEN
208 *
209 * Maximum number of iterations exceeded. Move data from WORK
210 * into D and E so the calling subroutine can try to finish
211 *
212  DO i = 1, n
213  d( i ) = sqrt( work( 2*i-1 ) )
214  e( i ) = sqrt( work( 2*i ) )
215  END DO
216  CALL slascl( 'G', 0, 0, scale, sigmx, n, 1, d, n, iinfo )
217  CALL slascl( 'G', 0, 0, scale, sigmx, n, 1, e, n, iinfo )
218  END IF
219 *
220  RETURN
221 *
222 * End of SLASQ1
223 *
subroutine slascl(TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO)
SLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
Definition: slascl.f:145
subroutine slas2(F, G, H, SSMIN, SSMAX)
SLAS2 computes singular values of a 2-by-2 triangular matrix.
Definition: slas2.f:109
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine slasrt(ID, N, D, INFO)
SLASRT sorts numbers in increasing or decreasing order.
Definition: slasrt.f:90
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine scopy(N, SX, INCX, SY, INCY)
SCOPY
Definition: scopy.f:53
subroutine slasq2(N, Z, INFO)
SLASQ2 computes all the eigenvalues of the symmetric positive definite tridiagonal matrix associated ...
Definition: slasq2.f:114

Here is the call graph for this function:

Here is the caller graph for this function: