LAPACK 3.12.1
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 148 of file slasd0.f.

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