lasd1#

Functions

void slasd1(
    const INT           nl,
    const INT           nr,
    const INT           sqre,
          f32* restrict D,
          f32*          alpha,
          f32*          beta,
          f32* restrict U,
    const INT           ldu,
          f32* restrict VT,
    const INT           ldvt,
          INT* restrict IDXQ,
          INT* restrict IWORK,
          f32* restrict work,
          INT*          info
);
void slasd1(const INT nl, const INT nr, const INT sqre, f32 *restrict D, f32 *alpha, f32 *beta, f32 *restrict U, const INT ldu, f32 *restrict VT, const INT ldvt, INT *restrict IDXQ, INT *restrict IWORK, f32 *restrict work, INT *info)#

SLASD1 computes the SVD of an upper bidiagonal n-by-m matrix B, where n = nl + nr + 1 and m = n + sqre.

SLASD1 is called from SLASD0.

A related subroutine SLASD7 handles the case in which the singular values (and the singular vectors in factored form) are desired.

SLASD1 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 u[nl] and u[nl+1] and zeros elsewhere; and the entry b is empty if sqre = 0.

The left singular vectors of the original matrix are stored in U, and the transpose of the right singular vectors are stored in VT, and the singular values are in D. The algorithm consists of three stages:

The first stage consists of deflating the size of the problem when there are multiple singular values or when there are zeros 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 SLASD2.

The second stage consists of calculating the updated singular values. This is done by finding the square roots of the roots of the secular equation via the routine SLASD4 (as called by SLASD3). This routine also calculates the singular vectors of the current problem.

The final stage consists of computing the updated singular vectors directly using the updated singular values. The singular vectors for the current problem are multiplied with the singular vectors from the overall problem.

Contributors:

Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA

Parameters

in
nl

The row dimension of the upper block. nl >= 1.

in
nr

The row dimension of the lower block. nr >= 1.

in
sqre

= 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.

inout
D

Double precision array, dimension (n = nl+nr+1). On entry D[0:nl-1, 0:nl-1] contains the singular values of the upper block; and D[nl+1:n-1] contains the singular values of the lower block. On exit D[0:n-1] contains the singular values of the modified matrix.

inout
alpha

Contains the diagonal element associated with the added row.

inout
beta

Contains the off-diagonal element associated with the added row.

inout
U

Double precision array, dimension (ldu, n). On entry U[0:nl-1, 0:nl-1] contains the left singular vectors of the upper block; U[nl+1:n-1, nl+1:n-1] contains the left singular vectors of the lower block. On exit U contains the left singular vectors of the bidiagonal matrix.

in
ldu

The leading dimension of the array U. ldu >= max( 1, n ).

inout
VT

Double precision array, dimension (ldvt, m) where m = n + sqre. On entry VT[0:nl, 0:nl]**T contains the right singular vectors of the upper block; VT[nl+1:m-1, nl+1:m-1]**T contains the right singular vectors of the lower block. On exit VT**T contains the right singular vectors of the bidiagonal matrix.

in
ldvt

The leading dimension of the array VT. ldvt >= max( 1, m ).

inout
IDXQ

Integer array, dimension (n). This contains the permutation which will reintegrate the subproblem just solved back into sorted order, i.e. D[ IDXQ[ i = 0, n-1 ] ] will be in ascending order.

out
IWORK

Integer array, dimension (4*n).

out
work

Double precision array, dimension (3*m**2 + 2*m).

out
info

  • = 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

Functions

void dlasd1(
    const INT           nl,
    const INT           nr,
    const INT           sqre,
          f64* restrict D,
          f64*          alpha,
          f64*          beta,
          f64* restrict U,
    const INT           ldu,
          f64* restrict VT,
    const INT           ldvt,
          INT* restrict IDXQ,
          INT* restrict IWORK,
          f64* restrict work,
          INT*          info
);
void dlasd1(const INT nl, const INT nr, const INT sqre, f64 *restrict D, f64 *alpha, f64 *beta, f64 *restrict U, const INT ldu, f64 *restrict VT, const INT ldvt, INT *restrict IDXQ, INT *restrict IWORK, f64 *restrict work, INT *info)#

DLASD1 computes the SVD of an upper bidiagonal n-by-m matrix B, where n = nl + nr + 1 and m = n + sqre.

DLASD1 is called from DLASD0.

A related subroutine DLASD7 handles the case in which the singular values (and the singular vectors in factored form) are desired.

DLASD1 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 u[nl] and u[nl+1] and zeros elsewhere; and the entry b is empty if sqre = 0.

The left singular vectors of the original matrix are stored in U, and the transpose of the right singular vectors are stored in VT, and the singular values are in D. The algorithm consists of three stages:

The first stage consists of deflating the size of the problem when there are multiple singular values or when there are zeros 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 DLASD2.

The second stage consists of calculating the updated singular values. This is done by finding the square roots of the roots of the secular equation via the routine DLASD4 (as called by DLASD3). This routine also calculates the singular vectors of the current problem.

The final stage consists of computing the updated singular vectors directly using the updated singular values. The singular vectors for the current problem are multiplied with the singular vectors from the overall problem.

Contributors:

Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA

Parameters

in
nl

The row dimension of the upper block. nl >= 1.

in
nr

The row dimension of the lower block. nr >= 1.

in
sqre

= 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.

inout
D

Double precision array, dimension (n = nl+nr+1). On entry D[0:nl-1, 0:nl-1] contains the singular values of the upper block; and D[nl+1:n-1] contains the singular values of the lower block. On exit D[0:n-1] contains the singular values of the modified matrix.

inout
alpha

Contains the diagonal element associated with the added row.

inout
beta

Contains the off-diagonal element associated with the added row.

inout
U

Double precision array, dimension (ldu, n). On entry U[0:nl-1, 0:nl-1] contains the left singular vectors of the upper block; U[nl+1:n-1, nl+1:n-1] contains the left singular vectors of the lower block. On exit U contains the left singular vectors of the bidiagonal matrix.

in
ldu

The leading dimension of the array U. ldu >= max( 1, n ).

inout
VT

Double precision array, dimension (ldvt, m) where m = n + sqre. On entry VT[0:nl, 0:nl]**T contains the right singular vectors of the upper block; VT[nl+1:m-1, nl+1:m-1]**T contains the right singular vectors of the lower block. On exit VT**T contains the right singular vectors of the bidiagonal matrix.

in
ldvt

The leading dimension of the array VT. ldvt >= max( 1, m ).

inout
IDXQ

Integer array, dimension (n). This contains the permutation which will reintegrate the subproblem just solved back into sorted order, i.e. D[ IDXQ[ i = 0, n-1 ] ] will be in ascending order.

out
IWORK

Integer array, dimension (4*n).

out
work

Double precision array, dimension (3*m**2 + 2*m).

out
info

  • = 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