LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine dlasq1 ( integer  N,
double precision, dimension( * )  D,
double precision, dimension( * )  E,
double precision, dimension( * )  WORK,
integer  INFO 
)

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

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

Purpose:
 DLASQ1 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 DOUBLE PRECISION 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 DOUBLE PRECISION 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 DOUBLE PRECISION 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 DLASQ1
             = 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 dlasq1.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  DOUBLE PRECISION d( * ), e( * ), work( * )
121 * ..
122 *
123 * =====================================================================
124 *
125 * .. Parameters ..
126  DOUBLE PRECISION zero
127  parameter ( zero = 0.0d0 )
128 * ..
129 * .. Local Scalars ..
130  INTEGER i, iinfo
131  DOUBLE PRECISION eps, scale, safmin, sigmn, sigmx
132 * ..
133 * .. External Subroutines ..
134  EXTERNAL dcopy, dlas2, dlascl, dlasq2, dlasrt, xerbla
135 * ..
136 * .. External Functions ..
137  DOUBLE PRECISION dlamch
138  EXTERNAL dlamch
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( 'DLASQ1', -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 dlas2( 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 dlasrt( '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 = dlamch( 'Precision' )
186  safmin = dlamch( 'Safe minimum' )
187  scale = sqrt( eps / safmin )
188  CALL dcopy( n, d, 1, work( 1 ), 2 )
189  CALL dcopy( n-1, e, 1, work( 2 ), 2 )
190  CALL dlascl( '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 dlasq2( 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 dlascl( '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 dlascl( 'G', 0, 0, scale, sigmx, n, 1, d, n, iinfo )
217  CALL dlascl( 'G', 0, 0, scale, sigmx, n, 1, e, n, iinfo )
218  END IF
219 *
220  RETURN
221 *
222 * End of DLASQ1
223 *
subroutine dlasrt(ID, N, D, INFO)
DLASRT sorts numbers in increasing or decreasing order.
Definition: dlasrt.f:90
subroutine dcopy(N, DX, INCX, DY, INCY)
DCOPY
Definition: dcopy.f:53
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine dlascl(TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO)
DLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
Definition: dlascl.f:145
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine dlasq2(N, Z, INFO)
DLASQ2 computes all the eigenvalues of the symmetric positive definite tridiagonal matrix associated ...
Definition: dlasq2.f:114
subroutine dlas2(F, G, H, SSMIN, SSMAX)
DLAS2 computes singular values of a 2-by-2 triangular matrix.
Definition: dlas2.f:109

Here is the call graph for this function:

Here is the caller graph for this function: