LAPACK 3.12.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.
[in,out]U
          U is REAL array, dimension (LDU, N)
         On exit, U contains the left singular vectors,
          if U passed in as (N, N) Identity.
[in]LDU
          LDU is INTEGER
         On entry, leading dimension of U.
[in,out]VT
          VT is REAL array, dimension (LDVT, M)
         On exit, VT**T contains the right singular vectors,
          if VT passed in as (M, M) Identity.
[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 150 of file slasd0.f.

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