196 SUBROUTINE sbdsdc( 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 REAL D( * ), E( * ), Q( * ), U( LDU, * ),
210 $ vt( ldvt, * ), work( * )
220 parameter( zero = 0.0e+0, one = 1.0e+0, two = 2.0e+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 REAL CS, EPS, ORGNRM, P, R, SN
233 EXTERNAL slamch, slanst, ilaenv, lsame
240 INTRINSIC real, abs, 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(
'SBDSDC', -info )
284 smlsiz = ilaenv( 9,
'SBDSDC',
' ', 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 scopy( n, d, 1, q( 1 ), 1 )
305 CALL scopy( 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 slartg( 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 slasdq(
'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 slaset(
'A', n, n, zero, one, u, ldu )
342 CALL slaset(
'A', n, n, zero, one, vt, ldvt )
343 CALL slasdq(
'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 slaset(
'A', n, n, zero, one, q( iu+( qstart-1 )*n ),
350 CALL slaset(
'A', n, n, zero, one, q( ivt+( qstart-1 )*n ),
352 CALL slasdq(
'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 slaset(
'A', n, n, zero, one, u, ldu )
363 CALL slaset(
'A', n, n, zero, one, vt, ldvt )
368 orgnrm = slanst(
'M', n, d, e )
371 CALL slascl(
'G', 0, 0, orgnrm, one, n, 1, d, n, ierr )
372 CALL slascl(
'G', 0, 0, orgnrm, one, nm1, 1, e, nm1, ierr )
374 eps = slamch(
'Epsilon' )
376 mlvl = int( log( real( n ) / real( 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 slasd0( nsize, sqre, d( start ), e( start ),
439 $ u( start, start ), ldu, vt( start, start ),
440 $ ldvt, smlsiz, iwork, work( wstart ), info )
442 CALL slasda( 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 slascl(
'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 sswap( n, u( 1, i ), 1, u( 1, kk ), 1 )
487 CALL sswap( 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 slasr(
'L',
'V',
'B', n, n, work( 1 ), work( n ), u, ldu )
subroutine xerbla(srname, info)
subroutine sbdsdc(uplo, compq, n, d, e, u, ldu, vt, ldvt, q, iq, work, iwork, info)
SBDSDC
subroutine scopy(n, sx, incx, sy, incy)
SCOPY
subroutine slartg(f, g, c, s, r)
SLARTG generates a plane rotation with real cosine and real sine.
subroutine slascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
SLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine slasd0(n, sqre, d, e, u, ldu, vt, ldvt, smlsiz, iwork, work, info)
SLASD0 computes the singular values of a real upper bidiagonal n-by-m matrix B with diagonal d and of...
subroutine slasda(icompq, smlsiz, n, sqre, d, e, u, ldu, vt, k, difl, difr, z, poles, givptr, givcol, ldgcol, perm, givnum, c, s, work, iwork, info)
SLASDA computes the singular value decomposition (SVD) of a real upper bidiagonal matrix with diagona...
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....
subroutine slaset(uplo, m, n, alpha, beta, a, lda)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine slasr(side, pivot, direct, m, n, c, s, a, lda)
SLASR applies a sequence of plane rotations to a general rectangular matrix.
subroutine sswap(n, sx, incx, sy, incy)
SSWAP