205 SUBROUTINE dbdsdc( UPLO, COMPQ, N, D, E, U, LDU, VT, LDVT, Q, IQ,
206 $ work, iwork, info )
214 CHARACTER COMPQ, UPLO
215 INTEGER INFO, LDU, LDVT, N
218 INTEGER IQ( * ), IWORK( * )
219 DOUBLE PRECISION D( * ), E( * ), Q( * ), U( ldu, * ),
220 $ vt( ldvt, * ), work( * )
229 DOUBLE PRECISION ZERO, ONE, TWO
230 parameter ( zero = 0.0d+0, one = 1.0d+0, two = 2.0d+0 )
233 INTEGER DIFL, DIFR, GIVCOL, GIVNUM, GIVPTR, I, IC,
234 $ icompq, ierr, ii, is, iu, iuplo, ivt, j, k, kk,
235 $ mlvl, nm1, nsize, perm, poles, qstart, smlsiz,
236 $ smlszp, sqre, start, wstart, z
237 DOUBLE PRECISION CS, EPS, ORGNRM, P, R, SN
242 DOUBLE PRECISION DLAMCH, DLANST
243 EXTERNAL lsame, ilaenv, dlamch, dlanst
250 INTRINSIC abs, dble, int, log, sign
259 IF( lsame( uplo,
'U' ) )
261 IF( lsame( uplo,
'L' ) )
263 IF( lsame( compq,
'N' ) )
THEN
265 ELSE IF( lsame( compq,
'P' ) )
THEN
267 ELSE IF( lsame( compq,
'I' ) )
THEN
272 IF( iuplo.EQ.0 )
THEN
274 ELSE IF( icompq.LT.0 )
THEN
276 ELSE IF( n.LT.0 )
THEN
278 ELSE IF( ( ldu.LT.1 ) .OR. ( ( icompq.EQ.2 ) .AND. ( ldu.LT.
281 ELSE IF( ( ldvt.LT.1 ) .OR. ( ( icompq.EQ.2 ) .AND. ( ldvt.LT.
286 CALL xerbla(
'DBDSDC', -info )
294 smlsiz = ilaenv( 9,
'DBDSDC',
' ', 0, 0, 0, 0 )
296 IF( icompq.EQ.1 )
THEN
297 q( 1 ) = sign( one, d( 1 ) )
298 q( 1+smlsiz*n ) = one
299 ELSE IF( icompq.EQ.2 )
THEN
300 u( 1, 1 ) = sign( one, d( 1 ) )
303 d( 1 ) = abs( d( 1 ) )
313 IF( icompq.EQ.1 )
THEN
314 CALL dcopy( n, d, 1, q( 1 ), 1 )
315 CALL dcopy( n-1, e, 1, q( n+1 ), 1 )
317 IF( iuplo.EQ.2 )
THEN
321 CALL dlartg( d( i ), e( i ), cs, sn, r )
324 d( i+1 ) = cs*d( i+1 )
325 IF( icompq.EQ.1 )
THEN
328 ELSE IF( icompq.EQ.2 )
THEN
337 IF( icompq.EQ.0 )
THEN
341 CALL dlasdq(
'U', 0, n, 0, 0, 0, d, e, vt, ldvt, u, ldu, u,
342 $ ldu, work( 1 ), info )
349 IF( n.LE.smlsiz )
THEN
350 IF( icompq.EQ.2 )
THEN
351 CALL dlaset(
'A', n, n, zero, one, u, ldu )
352 CALL dlaset(
'A', n, n, zero, one, vt, ldvt )
353 CALL dlasdq(
'U', 0, n, n, n, 0, d, e, vt, ldvt, u, ldu, u,
354 $ ldu, work( wstart ), info )
355 ELSE IF( icompq.EQ.1 )
THEN
358 CALL dlaset(
'A', n, n, zero, one, q( iu+( qstart-1 )*n ),
360 CALL dlaset(
'A', n, n, zero, one, q( ivt+( qstart-1 )*n ),
362 CALL dlasdq(
'U', 0, n, n, n, 0, d, e,
363 $ q( ivt+( qstart-1 )*n ), n,
364 $ q( iu+( qstart-1 )*n ), n,
365 $ q( iu+( qstart-1 )*n ), n, work( wstart ),
371 IF( icompq.EQ.2 )
THEN
372 CALL dlaset(
'A', n, n, zero, one, u, ldu )
373 CALL dlaset(
'A', n, n, zero, one, vt, ldvt )
378 orgnrm = dlanst(
'M', n, d, e )
381 CALL dlascl(
'G', 0, 0, orgnrm, one, n, 1, d, n, ierr )
382 CALL dlascl(
'G', 0, 0, orgnrm, one, nm1, 1, e, nm1, ierr )
384 eps = (0.9d+0)*dlamch(
'Epsilon' )
386 mlvl = int( log( dble( n ) / dble( smlsiz+1 ) ) / log( two ) ) + 1
389 IF( icompq.EQ.1 )
THEN
398 givnum = poles + 2*mlvl
407 IF( abs( d( i ) ).LT.eps )
THEN
408 d( i ) = sign( eps, d( i ) )
416 IF( ( abs( e( i ) ).LT.eps ) .OR. ( i.EQ.nm1 ) )
THEN
425 nsize = i - start + 1
426 ELSE IF( abs( e( i ) ).GE.eps )
THEN
430 nsize = n - start + 1
437 nsize = i - start + 1
438 IF( icompq.EQ.2 )
THEN
439 u( n, n ) = sign( one, d( n ) )
441 ELSE IF( icompq.EQ.1 )
THEN
442 q( n+( qstart-1 )*n ) = sign( one, d( n ) )
443 q( n+( smlsiz+qstart-1 )*n ) = one
445 d( n ) = abs( d( n ) )
447 IF( icompq.EQ.2 )
THEN
448 CALL dlasd0( nsize, sqre, d( start ), e( start ),
449 $ u( start, start ), ldu, vt( start, start ),
450 $ ldvt, smlsiz, iwork, work( wstart ), info )
452 CALL dlasda( icompq, smlsiz, nsize, sqre, d( start ),
453 $ e( start ), q( start+( iu+qstart-2 )*n ), n,
454 $ q( start+( ivt+qstart-2 )*n ),
455 $ iq( start+k*n ), q( start+( difl+qstart-2 )*
456 $ n ), q( start+( difr+qstart-2 )*n ),
457 $ q( start+( z+qstart-2 )*n ),
458 $ q( start+( poles+qstart-2 )*n ),
459 $ iq( start+givptr*n ), iq( start+givcol*n ),
460 $ n, iq( start+perm*n ),
461 $ q( start+( givnum+qstart-2 )*n ),
462 $ q( start+( ic+qstart-2 )*n ),
463 $ q( start+( is+qstart-2 )*n ),
464 $ work( wstart ), iwork, info )
475 CALL dlascl(
'G', 0, 0, one, orgnrm, n, 1, d, n, ierr )
485 IF( d( j ).GT.p )
THEN
493 IF( icompq.EQ.1 )
THEN
495 ELSE IF( icompq.EQ.2 )
THEN
496 CALL dswap( n, u( 1, i ), 1, u( 1, kk ), 1 )
497 CALL dswap( n, vt( i, 1 ), ldvt, vt( kk, 1 ), ldvt )
499 ELSE IF( icompq.EQ.1 )
THEN
506 IF( icompq.EQ.1 )
THEN
507 IF( iuplo.EQ.1 )
THEN
517 IF( ( iuplo.EQ.2 ) .AND. ( icompq.EQ.2 ) )
518 $
CALL dlasr(
'L',
'V',
'B', n, n, work( 1 ), work( n ), u, ldu )
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 dcopy(N, DX, INCX, DY, INCY)
DCOPY
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 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 xerbla(SRNAME, INFO)
XERBLA
subroutine dswap(N, DX, INCX, DY, INCY)
DSWAP
subroutine dlasr(SIDE, PIVOT, DIRECT, M, N, C, S, A, LDA)
DLASR applies a sequence of plane rotations to a general rectangular matrix.
subroutine dbdsdc(UPLO, COMPQ, N, D, E, U, LDU, VT, LDVT, Q, IQ, WORK, IWORK, INFO)
DBDSDC
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 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 dlartg(F, G, CS, SN, R)
DLARTG generates a plane rotation with real cosine and real sine.