LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine dlasd6 ( integer  ICOMPQ,
integer  NL,
integer  NR,
integer  SQRE,
double precision, dimension( * )  D,
double precision, dimension( * )  VF,
double precision, dimension( * )  VL,
double precision  ALPHA,
double precision  BETA,
integer, dimension( * )  IDXQ,
integer, dimension( * )  PERM,
integer  GIVPTR,
integer, dimension( ldgcol, * )  GIVCOL,
integer  LDGCOL,
double precision, dimension( ldgnum, * )  GIVNUM,
integer  LDGNUM,
double precision, dimension( ldgnum, * )  POLES,
double precision, dimension( * )  DIFL,
double precision, dimension( * )  DIFR,
double precision, dimension( * )  Z,
integer  K,
double precision  C,
double precision  S,
double precision, dimension( * )  WORK,
integer, dimension( * )  IWORK,
integer  INFO 
)

DLASD6 computes the SVD of an updated upper bidiagonal matrix obtained by merging two smaller ones by appending a row. Used by sbdsdc.

Download DLASD6 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 DLASD6 computes the SVD of an updated upper bidiagonal matrix B
 obtained by merging two smaller ones by appending a row. This
 routine is used only for the problem which requires all singular
 values and optionally singular vector matrices in factored form.
 B is an N-by-M matrix with N = NL + NR + 1 and M = N + SQRE.
 A related subroutine, DLASD1, handles the case in which all singular
 values and singular vectors of the bidiagonal matrix are desired.

 DLASD6 computes the SVD as follows:

               ( D1(in)    0    0       0 )
   B = U(in) * (   Z1**T   a   Z2**T    b ) * VT(in)
               (   0       0   D2(in)   0 )

     = U(out) * ( D(out) 0) * VT(out)

 where Z**T = (Z1**T a Z2**T b) = u**T VT**T, and u is a vector of dimension M
 with ALPHA and BETA in the NL+1 and NL+2 th entries and zeros
 elsewhere; and the entry b is empty if SQRE = 0.

 The singular values of B can be computed using D1, D2, the first
 components of all the right singular vectors of the lower block, and
 the last components of all the right singular vectors of the upper
 block. These components are stored and updated in VF and VL,
 respectively, in DLASD6. Hence U and VT are not explicitly
 referenced.

 The singular values are stored in D. The algorithm consists of two
 stages:

       The first stage consists of deflating the size of the problem
       when there are multiple singular values or if there is a zero
       in the Z vector. For each such occurrence the dimension of the
       secular equation problem is reduced by one. This stage is
       performed by the routine DLASD7.

       The second stage consists of calculating the updated
       singular values. This is done by finding the roots of the
       secular equation via the routine DLASD4 (as called by DLASD8).
       This routine also updates VF and VL and computes the distances
       between the updated singular values and the old singular
       values.

 DLASD6 is called from DLASDA.
Parameters
[in]ICOMPQ
          ICOMPQ is INTEGER
         Specifies whether singular vectors are to be computed in
         factored form:
         = 0: Compute singular values only.
         = 1: Compute singular vectors in factored form as well.
[in]NL
          NL is INTEGER
         The row dimension of the upper block.  NL >= 1.
[in]NR
          NR is INTEGER
         The row dimension of the lower block.  NR >= 1.
[in]SQRE
          SQRE is INTEGER
         = 0: the lower block is an NR-by-NR square matrix.
         = 1: the lower block is an NR-by-(NR+1) rectangular matrix.

         The bidiagonal matrix has row dimension N = NL + NR + 1,
         and column dimension M = N + SQRE.
[in,out]D
          D is DOUBLE PRECISION array, dimension ( NL+NR+1 ).
         On entry D(1:NL,1:NL) contains the singular values of the
         upper block, and D(NL+2:N) contains the singular values
         of the lower block. On exit D(1:N) contains the singular
         values of the modified matrix.
[in,out]VF
          VF is DOUBLE PRECISION array, dimension ( M )
         On entry, VF(1:NL+1) contains the first components of all
         right singular vectors of the upper block; and VF(NL+2:M)
         contains the first components of all right singular vectors
         of the lower block. On exit, VF contains the first components
         of all right singular vectors of the bidiagonal matrix.
[in,out]VL
          VL is DOUBLE PRECISION array, dimension ( M )
         On entry, VL(1:NL+1) contains the  last components of all
         right singular vectors of the upper block; and VL(NL+2:M)
         contains the last components of all right singular vectors of
         the lower block. On exit, VL contains the last components of
         all right singular vectors of the bidiagonal matrix.
[in,out]ALPHA
          ALPHA is DOUBLE PRECISION
         Contains the diagonal element associated with the added row.
[in,out]BETA
          BETA is DOUBLE PRECISION
         Contains the off-diagonal element associated with the added
         row.
[in,out]IDXQ
          IDXQ is INTEGER array, dimension ( N )
         This contains the permutation which will reintegrate the
         subproblem just solved back into sorted order, i.e.
         D( IDXQ( I = 1, N ) ) will be in ascending order.
[out]PERM
          PERM is INTEGER array, dimension ( N )
         The permutations (from deflation and sorting) to be applied
         to each block. Not referenced if ICOMPQ = 0.
[out]GIVPTR
          GIVPTR is INTEGER
         The number of Givens rotations which took place in this
         subproblem. Not referenced if ICOMPQ = 0.
[out]GIVCOL
          GIVCOL is INTEGER array, dimension ( LDGCOL, 2 )
         Each pair of numbers indicates a pair of columns to take place
         in a Givens rotation. Not referenced if ICOMPQ = 0.
[in]LDGCOL
          LDGCOL is INTEGER
         leading dimension of GIVCOL, must be at least N.
[out]GIVNUM
          GIVNUM is DOUBLE PRECISION array, dimension ( LDGNUM, 2 )
         Each number indicates the C or S value to be used in the
         corresponding Givens rotation. Not referenced if ICOMPQ = 0.
[in]LDGNUM
          LDGNUM is INTEGER
         The leading dimension of GIVNUM and POLES, must be at least N.
[out]POLES
          POLES is DOUBLE PRECISION array, dimension ( LDGNUM, 2 )
         On exit, POLES(1,*) is an array containing the new singular
         values obtained from solving the secular equation, and
         POLES(2,*) is an array containing the poles in the secular
         equation. Not referenced if ICOMPQ = 0.
[out]DIFL
          DIFL is DOUBLE PRECISION array, dimension ( N )
         On exit, DIFL(I) is the distance between I-th updated
         (undeflated) singular value and the I-th (undeflated) old
         singular value.
[out]DIFR
          DIFR is DOUBLE PRECISION array,
                   dimension ( LDDIFR, 2 ) if ICOMPQ = 1 and
                   dimension ( K ) if ICOMPQ = 0.
          On exit, DIFR(I,1) = D(I) - DSIGMA(I+1), DIFR(K,1) is not
          defined and will not be referenced.

          If ICOMPQ = 1, DIFR(1:K,2) is an array containing the
          normalizing factors for the right singular vector matrix.

         See DLASD8 for details on DIFL and DIFR.
[out]Z
          Z is DOUBLE PRECISION array, dimension ( M )
         The first elements of this array contain the components
         of the deflation-adjusted updating row vector.
[out]K
          K is INTEGER
         Contains the dimension of the non-deflated matrix,
         This is the order of the related secular equation. 1 <= K <=N.
[out]C
          C is DOUBLE PRECISION
         C contains garbage if SQRE =0 and the C-value of a Givens
         rotation related to the right null space if SQRE = 1.
[out]S
          S is DOUBLE PRECISION
         S contains garbage if SQRE =0 and the S-value of a Givens
         rotation related to the right null space if SQRE = 1.
[out]WORK
          WORK is DOUBLE PRECISION array, dimension ( 4 * M )
[out]IWORK
          IWORK is INTEGER array, dimension ( 3 * N )
[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.
Date
June 2016
Contributors:
Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA

Definition at line 315 of file dlasd6.f.

315 *
316 * -- LAPACK auxiliary routine (version 3.6.1) --
317 * -- LAPACK is a software package provided by Univ. of Tennessee, --
318 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
319 * June 2016
320 *
321 * .. Scalar Arguments ..
322  INTEGER givptr, icompq, info, k, ldgcol, ldgnum, nl,
323  $ nr, sqre
324  DOUBLE PRECISION alpha, beta, c, s
325 * ..
326 * .. Array Arguments ..
327  INTEGER givcol( ldgcol, * ), idxq( * ), iwork( * ),
328  $ perm( * )
329  DOUBLE PRECISION d( * ), difl( * ), difr( * ),
330  $ givnum( ldgnum, * ), poles( ldgnum, * ),
331  $ vf( * ), vl( * ), work( * ), z( * )
332 * ..
333 *
334 * =====================================================================
335 *
336 * .. Parameters ..
337  DOUBLE PRECISION one, zero
338  parameter ( one = 1.0d+0, zero = 0.0d+0 )
339 * ..
340 * .. Local Scalars ..
341  INTEGER i, idx, idxc, idxp, isigma, ivfw, ivlw, iw, m,
342  $ n, n1, n2
343  DOUBLE PRECISION orgnrm
344 * ..
345 * .. External Subroutines ..
346  EXTERNAL dcopy, dlamrg, dlascl, dlasd7, dlasd8, xerbla
347 * ..
348 * .. Intrinsic Functions ..
349  INTRINSIC abs, max
350 * ..
351 * .. Executable Statements ..
352 *
353 * Test the input parameters.
354 *
355  info = 0
356  n = nl + nr + 1
357  m = n + sqre
358 *
359  IF( ( icompq.LT.0 ) .OR. ( icompq.GT.1 ) ) THEN
360  info = -1
361  ELSE IF( nl.LT.1 ) THEN
362  info = -2
363  ELSE IF( nr.LT.1 ) THEN
364  info = -3
365  ELSE IF( ( sqre.LT.0 ) .OR. ( sqre.GT.1 ) ) THEN
366  info = -4
367  ELSE IF( ldgcol.LT.n ) THEN
368  info = -14
369  ELSE IF( ldgnum.LT.n ) THEN
370  info = -16
371  END IF
372  IF( info.NE.0 ) THEN
373  CALL xerbla( 'DLASD6', -info )
374  RETURN
375  END IF
376 *
377 * The following values are for bookkeeping purposes only. They are
378 * integer pointers which indicate the portion of the workspace
379 * used by a particular array in DLASD7 and DLASD8.
380 *
381  isigma = 1
382  iw = isigma + n
383  ivfw = iw + m
384  ivlw = ivfw + m
385 *
386  idx = 1
387  idxc = idx + n
388  idxp = idxc + n
389 *
390 * Scale.
391 *
392  orgnrm = max( abs( alpha ), abs( beta ) )
393  d( nl+1 ) = zero
394  DO 10 i = 1, n
395  IF( abs( d( i ) ).GT.orgnrm ) THEN
396  orgnrm = abs( d( i ) )
397  END IF
398  10 CONTINUE
399  CALL dlascl( 'G', 0, 0, orgnrm, one, n, 1, d, n, info )
400  alpha = alpha / orgnrm
401  beta = beta / orgnrm
402 *
403 * Sort and Deflate singular values.
404 *
405  CALL dlasd7( icompq, nl, nr, sqre, k, d, z, work( iw ), vf,
406  $ work( ivfw ), vl, work( ivlw ), alpha, beta,
407  $ work( isigma ), iwork( idx ), iwork( idxp ), idxq,
408  $ perm, givptr, givcol, ldgcol, givnum, ldgnum, c, s,
409  $ info )
410 *
411 * Solve Secular Equation, compute DIFL, DIFR, and update VF, VL.
412 *
413  CALL dlasd8( icompq, k, d, z, vf, vl, difl, difr, ldgnum,
414  $ work( isigma ), work( iw ), info )
415 *
416 * Report the possible convergence failure.
417 *
418  IF( info.NE.0 ) THEN
419  RETURN
420  END IF
421 *
422 * Save the poles if ICOMPQ = 1.
423 *
424  IF( icompq.EQ.1 ) THEN
425  CALL dcopy( k, d, 1, poles( 1, 1 ), 1 )
426  CALL dcopy( k, work( isigma ), 1, poles( 1, 2 ), 1 )
427  END IF
428 *
429 * Unscale.
430 *
431  CALL dlascl( 'G', 0, 0, one, orgnrm, n, 1, d, n, info )
432 *
433 * Prepare the IDXQ sorting permutation.
434 *
435  n1 = k
436  n2 = n - k
437  CALL dlamrg( n1, n2, d, 1, -1, idxq )
438 *
439  RETURN
440 *
441 * End of DLASD6
442 *
subroutine dlasd8(ICOMPQ, K, D, Z, VF, VL, DIFL, DIFR, LDDIFR, DSIGMA, WORK, INFO)
DLASD8 finds the square roots of the roots of the secular equation, and stores, for each element in D...
Definition: dlasd8.f:168
subroutine dcopy(N, DX, INCX, DY, INCY)
DCOPY
Definition: dcopy.f:53
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.
Definition: dlascl.f:145
subroutine dlamrg(N1, N2, A, DTRD1, DTRD2, INDEX)
DLAMRG creates a permutation list to merge the entries of two independently sorted sets into a single...
Definition: dlamrg.f:101
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine dlasd7(ICOMPQ, NL, NR, SQRE, K, D, Z, ZW, VF, VFW, VL, VLW, ALPHA, BETA, DSIGMA, IDX, IDXP, IDXQ, PERM, GIVPTR, GIVCOL, LDGCOL, GIVNUM, LDGNUM, C, S, INFO)
DLASD7 merges the two sets of singular values together into a single sorted set. Then it tries to def...
Definition: dlasd7.f:282

Here is the call graph for this function:

Here is the caller graph for this function: