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

◆ slasd0()

subroutine slasd0 ( integer  N,
integer  SQRE,
real, dimension( * )  D,
real, dimension( * )  E,
real, dimension( ldu, * )  U,
integer  LDU,
real, dimension( ldvt, * )  VT,
integer  LDVT,
integer  SMLSIZ,
integer, dimension( * )  IWORK,
real, dimension( * )  WORK,
integer  INFO 
)

SLASD0 computes the singular values of a real upper bidiagonal n-by-m matrix B with diagonal d and off-diagonal e. Used by sbdsdc.

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

Purpose:
 Using a divide and conquer approach, SLASD0 computes the singular
 value decomposition (SVD) of a real upper bidiagonal N-by-M
 matrix B with diagonal D and offdiagonal E, where M = N + SQRE.
 The algorithm computes orthogonal matrices U and VT such that
 B = U * S * VT. The singular values S are overwritten on D.

 A related subroutine, SLASDA, computes only the singular values,
 and optionally, the singular vectors in compact form.
Parameters
[in]N
          N is INTEGER
         On entry, the row dimension of the upper bidiagonal matrix.
         This is also the dimension of the main diagonal array D.
[in]SQRE
          SQRE is INTEGER
         Specifies the column dimension of the bidiagonal matrix.
         = 0: The bidiagonal matrix has column dimension M = N;
         = 1: The bidiagonal matrix has column dimension M = N+1;
[in,out]D
          D is REAL array, dimension (N)
         On entry D contains the main diagonal of the bidiagonal
         matrix.
         On exit D, if INFO = 0, contains its singular values.
[in,out]E
          E is REAL array, dimension (M-1)
         Contains the subdiagonal entries of the bidiagonal matrix.
         On exit, E has been destroyed.
[out]U
          U is REAL array, dimension (LDU, N)
         On exit, U contains the left singular vectors.
[in]LDU
          LDU is INTEGER
         On entry, leading dimension of U.
[out]VT
          VT is REAL array, dimension (LDVT, M)
         On exit, VT**T contains the right singular vectors.
[in]LDVT
          LDVT is INTEGER
         On entry, leading dimension of VT.
[in]SMLSIZ
          SMLSIZ is INTEGER
         On entry, maximum size of the subproblems at the
         bottom of the computation tree.
[out]IWORK
          IWORK is INTEGER array, dimension (8*N)
[out]WORK
          WORK is REAL array, dimension (3*M**2+2*M)
[out]INFO
          INFO is INTEGER
          = 0:  successful exit.
          < 0:  if INFO = -i, the i-th argument had an illegal value.
          > 0:  if INFO = 1, a singular value did not converge
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors:
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA

Definition at line 148 of file slasd0.f.

150*
151* -- LAPACK auxiliary routine --
152* -- LAPACK is a software package provided by Univ. of Tennessee, --
153* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
154*
155* .. Scalar Arguments ..
156 INTEGER INFO, LDU, LDVT, N, SMLSIZ, SQRE
157* ..
158* .. Array Arguments ..
159 INTEGER IWORK( * )
160 REAL D( * ), E( * ), U( LDU, * ), VT( LDVT, * ),
161 $ WORK( * )
162* ..
163*
164* =====================================================================
165*
166* .. Local Scalars ..
167 INTEGER I, I1, IC, IDXQ, IDXQC, IM1, INODE, ITEMP, IWK,
168 $ J, LF, LL, LVL, M, NCC, ND, NDB1, NDIML, NDIMR,
169 $ NL, NLF, NLP1, NLVL, NR, NRF, NRP1, SQREI
170 REAL ALPHA, BETA
171* ..
172* .. External Subroutines ..
173 EXTERNAL slasd1, slasdq, slasdt, xerbla
174* ..
175* .. Executable Statements ..
176*
177* Test the input parameters.
178*
179 info = 0
180*
181 IF( n.LT.0 ) THEN
182 info = -1
183 ELSE IF( ( sqre.LT.0 ) .OR. ( sqre.GT.1 ) ) THEN
184 info = -2
185 END IF
186*
187 m = n + sqre
188*
189 IF( ldu.LT.n ) THEN
190 info = -6
191 ELSE IF( ldvt.LT.m ) THEN
192 info = -8
193 ELSE IF( smlsiz.LT.3 ) THEN
194 info = -9
195 END IF
196 IF( info.NE.0 ) THEN
197 CALL xerbla( 'SLASD0', -info )
198 RETURN
199 END IF
200*
201* If the input matrix is too small, call SLASDQ to find the SVD.
202*
203 IF( n.LE.smlsiz ) THEN
204 CALL slasdq( 'U', sqre, n, m, n, 0, d, e, vt, ldvt, u, ldu, u,
205 $ ldu, work, info )
206 RETURN
207 END IF
208*
209* Set up the computation tree.
210*
211 inode = 1
212 ndiml = inode + n
213 ndimr = ndiml + n
214 idxq = ndimr + n
215 iwk = idxq + n
216 CALL slasdt( n, nlvl, nd, iwork( inode ), iwork( ndiml ),
217 $ iwork( ndimr ), smlsiz )
218*
219* For the nodes on bottom level of the tree, solve
220* their subproblems by SLASDQ.
221*
222 ndb1 = ( nd+1 ) / 2
223 ncc = 0
224 DO 30 i = ndb1, nd
225*
226* IC : center row of each node
227* NL : number of rows of left subproblem
228* NR : number of rows of right subproblem
229* NLF: starting row of the left subproblem
230* NRF: starting row of the right subproblem
231*
232 i1 = i - 1
233 ic = iwork( inode+i1 )
234 nl = iwork( ndiml+i1 )
235 nlp1 = nl + 1
236 nr = iwork( ndimr+i1 )
237 nrp1 = nr + 1
238 nlf = ic - nl
239 nrf = ic + 1
240 sqrei = 1
241 CALL slasdq( 'U', sqrei, nl, nlp1, nl, ncc, d( nlf ), e( nlf ),
242 $ vt( nlf, nlf ), ldvt, u( nlf, nlf ), ldu,
243 $ u( nlf, nlf ), ldu, work, info )
244 IF( info.NE.0 ) THEN
245 RETURN
246 END IF
247 itemp = idxq + nlf - 2
248 DO 10 j = 1, nl
249 iwork( itemp+j ) = j
250 10 CONTINUE
251 IF( i.EQ.nd ) THEN
252 sqrei = sqre
253 ELSE
254 sqrei = 1
255 END IF
256 nrp1 = nr + sqrei
257 CALL slasdq( 'U', sqrei, nr, nrp1, nr, ncc, d( nrf ), e( nrf ),
258 $ vt( nrf, nrf ), ldvt, u( nrf, nrf ), ldu,
259 $ u( nrf, nrf ), ldu, work, info )
260 IF( info.NE.0 ) THEN
261 RETURN
262 END IF
263 itemp = idxq + ic
264 DO 20 j = 1, nr
265 iwork( itemp+j-1 ) = j
266 20 CONTINUE
267 30 CONTINUE
268*
269* Now conquer each subproblem bottom-up.
270*
271 DO 50 lvl = nlvl, 1, -1
272*
273* Find the first node LF and last node LL on the
274* current level LVL.
275*
276 IF( lvl.EQ.1 ) THEN
277 lf = 1
278 ll = 1
279 ELSE
280 lf = 2**( lvl-1 )
281 ll = 2*lf - 1
282 END IF
283 DO 40 i = lf, ll
284 im1 = i - 1
285 ic = iwork( inode+im1 )
286 nl = iwork( ndiml+im1 )
287 nr = iwork( ndimr+im1 )
288 nlf = ic - nl
289 IF( ( sqre.EQ.0 ) .AND. ( i.EQ.ll ) ) THEN
290 sqrei = sqre
291 ELSE
292 sqrei = 1
293 END IF
294 idxqc = idxq + nlf - 1
295 alpha = d( ic )
296 beta = e( ic )
297 CALL slasd1( nl, nr, sqrei, d( nlf ), alpha, beta,
298 $ u( nlf, nlf ), ldu, vt( nlf, nlf ), ldvt,
299 $ iwork( idxqc ), iwork( iwk ), work, info )
300*
301* Report the possible convergence failure.
302*
303 IF( info.NE.0 ) THEN
304 RETURN
305 END IF
306 40 CONTINUE
307 50 CONTINUE
308*
309 RETURN
310*
311* End of SLASD0
312*
subroutine slasd1(NL, NR, SQRE, D, ALPHA, BETA, U, LDU, VT, LDVT, IDXQ, IWORK, WORK, INFO)
SLASD1 computes the SVD of an upper bidiagonal matrix B of the specified size. Used by sbdsdc.
Definition: slasd1.f:204
subroutine slasdq(UPLO, SQRE, N, NCVT, NRU, NCC, D, E, VT, LDVT, U, LDU, C, LDC, WORK, INFO)
SLASDQ computes the SVD of a real bidiagonal matrix with diagonal d and off-diagonal e....
Definition: slasdq.f:211
subroutine slasdt(N, LVL, ND, INODE, NDIML, NDIMR, MSUB)
SLASDT creates a tree of subproblems for bidiagonal divide and conquer. Used by sbdsdc.
Definition: slasdt.f:105
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
Here is the call graph for this function:
Here is the caller graph for this function: