196 SUBROUTINE dbdsdc( UPLO, COMPQ, N, D, E, U, LDU, VT, LDVT, Q, IQ,
197 $ WORK, IWORK, INFO )
204 CHARACTER COMPQ, UPLO
205 INTEGER INFO, LDU, LDVT, N
208 INTEGER IQ( * ), IWORK( * )
209 DOUBLE PRECISION D( * ), E( * ), Q( * ), U( LDU, * ),
210 $ vt( ldvt, * ), work( * )
219 DOUBLE PRECISION ZERO, ONE, TWO
220 parameter( zero = 0.0d+0, one = 1.0d+0, two = 2.0d+0 )
223 INTEGER DIFL, DIFR, GIVCOL, GIVNUM, GIVPTR, I, IC,
224 $ icompq, ierr, ii, is, iu, iuplo, ivt, j, k, kk,
225 $ mlvl, nm1, nsize, perm, poles, qstart, smlsiz,
226 $ smlszp, sqre, start, wstart, z
227 DOUBLE PRECISION CS, EPS, ORGNRM, P, R, SN
232 DOUBLE PRECISION DLAMCH, DLANST
233 EXTERNAL lsame, ilaenv, dlamch, dlanst
240 INTRINSIC abs, dble, int, log, sign
249 IF( lsame( uplo,
'U' ) )
251 IF( lsame( uplo,
'L' ) )
253 IF( lsame( compq,
'N' ) )
THEN
255 ELSE IF( lsame( compq,
'P' ) )
THEN
257 ELSE IF( lsame( compq,
'I' ) )
THEN
262 IF( iuplo.EQ.0 )
THEN
264 ELSE IF( icompq.LT.0 )
THEN
266 ELSE IF( n.LT.0 )
THEN
268 ELSE IF( ( ldu.LT.1 ) .OR. ( ( icompq.EQ.2 ) .AND. ( ldu.LT.
271 ELSE IF( ( ldvt.LT.1 ) .OR. ( ( icompq.EQ.2 ) .AND. ( ldvt.LT.
276 CALL xerbla(
'DBDSDC', -info )
284 smlsiz = ilaenv( 9,
'DBDSDC',
' ', 0, 0, 0, 0 )
286 IF( icompq.EQ.1 )
THEN
287 q( 1 ) = sign( one, d( 1 ) )
288 q( 1+smlsiz*n ) = one
289 ELSE IF( icompq.EQ.2 )
THEN
290 u( 1, 1 ) = sign( one, d( 1 ) )
293 d( 1 ) = abs( d( 1 ) )
303 IF( icompq.EQ.1 )
THEN
304 CALL dcopy( n, d, 1, q( 1 ), 1 )
305 CALL dcopy( n-1, e, 1, q( n+1 ), 1 )
307 IF( iuplo.EQ.2 )
THEN
309 IF( icompq .EQ. 2 ) wstart = 2*n - 1
311 CALL dlartg( d( i ), e( i ), cs, sn, r )
314 d( i+1 ) = cs*d( i+1 )
315 IF( icompq.EQ.1 )
THEN
318 ELSE IF( icompq.EQ.2 )
THEN
327 IF( icompq.EQ.0 )
THEN
331 CALL dlasdq(
'U', 0, n, 0, 0, 0, d, e, vt, ldvt, u, ldu, u,
332 $ ldu, work( 1 ), info )
339 IF( n.LE.smlsiz )
THEN
340 IF( icompq.EQ.2 )
THEN
341 CALL dlaset(
'A', n, n, zero, one, u, ldu )
342 CALL dlaset(
'A', n, n, zero, one, vt, ldvt )
343 CALL dlasdq(
'U', 0, n, n, n, 0, d, e, vt, ldvt, u, ldu, u,
344 $ ldu, work( wstart ), info )
345 ELSE IF( icompq.EQ.1 )
THEN
348 CALL dlaset(
'A', n, n, zero, one, q( iu+( qstart-1 )*n ),
350 CALL dlaset(
'A', n, n, zero, one, q( ivt+( qstart-1 )*n ),
352 CALL dlasdq(
'U', 0, n, n, n, 0, d, e,
353 $ q( ivt+( qstart-1 )*n ), n,
354 $ q( iu+( qstart-1 )*n ), n,
355 $ q( iu+( qstart-1 )*n ), n, work( wstart ),
361 IF( icompq.EQ.2 )
THEN
362 CALL dlaset(
'A', n, n, zero, one, u, ldu )
363 CALL dlaset(
'A', n, n, zero, one, vt, ldvt )
368 orgnrm = dlanst(
'M', n, d, e )
371 CALL dlascl(
'G', 0, 0, orgnrm, one, n, 1, d, n, ierr )
372 CALL dlascl(
'G', 0, 0, orgnrm, one, nm1, 1, e, nm1, ierr )
374 eps = (0.9d+0)*dlamch(
'Epsilon' )
376 mlvl = int( log( dble( n ) / dble( smlsiz+1 ) ) / log( two ) ) + 1
379 IF( icompq.EQ.1 )
THEN
388 givnum = poles + 2*mlvl
397 IF( abs( d( i ) ).LT.eps )
THEN
398 d( i ) = sign( eps, d( i ) )
406 IF( ( abs( e( i ) ).LT.eps ) .OR. ( i.EQ.nm1 ) )
THEN
415 nsize = i - start + 1
416 ELSE IF( abs( e( i ) ).GE.eps )
THEN
420 nsize = n - start + 1
427 nsize = i - start + 1
428 IF( icompq.EQ.2 )
THEN
429 u( n, n ) = sign( one, d( n ) )
431 ELSE IF( icompq.EQ.1 )
THEN
432 q( n+( qstart-1 )*n ) = sign( one, d( n ) )
433 q( n+( smlsiz+qstart-1 )*n ) = one
435 d( n ) = abs( d( n ) )
437 IF( icompq.EQ.2 )
THEN
438 CALL dlasd0( nsize, sqre, d( start ), e( start ),
439 $ u( start, start ), ldu, vt( start, start ),
440 $ ldvt, smlsiz, iwork, work( wstart ), info )
442 CALL dlasda( icompq, smlsiz, nsize, sqre, d( start ),
443 $ e( start ), q( start+( iu+qstart-2 )*n ), n,
444 $ q( start+( ivt+qstart-2 )*n ),
445 $ iq( start+k*n ), q( start+( difl+qstart-2 )*
446 $ n ), q( start+( difr+qstart-2 )*n ),
447 $ q( start+( z+qstart-2 )*n ),
448 $ q( start+( poles+qstart-2 )*n ),
449 $ iq( start+givptr*n ), iq( start+givcol*n ),
450 $ n, iq( start+perm*n ),
451 $ q( start+( givnum+qstart-2 )*n ),
452 $ q( start+( ic+qstart-2 )*n ),
453 $ q( start+( is+qstart-2 )*n ),
454 $ work( wstart ), iwork, info )
465 CALL dlascl(
'G', 0, 0, one, orgnrm, n, 1, d, n, ierr )
475 IF( d( j ).GT.p )
THEN
483 IF( icompq.EQ.1 )
THEN
485 ELSE IF( icompq.EQ.2 )
THEN
486 CALL dswap( n, u( 1, i ), 1, u( 1, kk ), 1 )
487 CALL dswap( n, vt( i, 1 ), ldvt, vt( kk, 1 ), ldvt )
489 ELSE IF( icompq.EQ.1 )
THEN
496 IF( icompq.EQ.1 )
THEN
497 IF( iuplo.EQ.1 )
THEN
507 IF( ( iuplo.EQ.2 ) .AND. ( icompq.EQ.2 ) )
508 $
CALL dlasr(
'L',
'V',
'B', n, n, work( 1 ), work( n ), u, ldu )
subroutine xerbla(srname, info)
subroutine dbdsdc(uplo, compq, n, d, e, u, ldu, vt, ldvt, q, iq, work, iwork, info)
DBDSDC
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
subroutine dlartg(f, g, c, s, r)
DLARTG generates a plane rotation with real cosine and real sine.
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.
subroutine dlasd0(n, sqre, d, e, u, ldu, vt, ldvt, smlsiz, iwork, work, info)
DLASD0 computes the singular values of a real upper bidiagonal n-by-m matrix B with diagonal d and of...
subroutine dlasda(icompq, smlsiz, n, sqre, d, e, u, ldu, vt, k, difl, difr, z, poles, givptr, givcol, ldgcol, perm, givnum, c, s, work, iwork, info)
DLASDA computes the singular value decomposition (SVD) of a real upper bidiagonal matrix with diagona...
subroutine dlasdq(uplo, sqre, n, ncvt, nru, ncc, d, e, vt, ldvt, u, ldu, c, ldc, work, info)
DLASDQ computes the SVD of a real bidiagonal matrix with diagonal d and off-diagonal e....
subroutine dlaset(uplo, m, n, alpha, beta, a, lda)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine dlasr(side, pivot, direct, m, n, c, s, a, lda)
DLASR applies a sequence of plane rotations to a general rectangular matrix.
subroutine dswap(n, dx, incx, dy, incy)
DSWAP