lasd2#

Functions

void slasd2(
    const INT           nl,
    const INT           nr,
    const INT           sqre,
          INT*          k,
          f32* restrict D,
          f32* restrict Z,
    const f32           alpha,
    const f32           beta,
          f32* restrict U,
    const INT           ldu,
          f32* restrict VT,
    const INT           ldvt,
          f32* restrict DSIGMA,
          f32* restrict U2,
    const INT           ldu2,
          f32* restrict VT2,
    const INT           ldvt2,
          INT* restrict IDXP,
          INT* restrict IDX,
          INT* restrict IDXC,
          INT* restrict IDXQ,
          INT* restrict COLTYP,
          INT*          info
);
void slasd2(const INT nl, const INT nr, const INT sqre, INT *k, f32 *restrict D, f32 *restrict Z, const f32 alpha, const f32 beta, f32 *restrict U, const INT ldu, f32 *restrict VT, const INT ldvt, f32 *restrict DSIGMA, f32 *restrict U2, const INT ldu2, f32 *restrict VT2, const INT ldvt2, INT *restrict IDXP, INT *restrict IDX, INT *restrict IDXC, INT *restrict IDXQ, INT *restrict COLTYP, INT *info)#

SLASD2 merges the two sets of singular values together into a single sorted set.

Then it tries to deflate the size of the problem. There are two ways in which deflation can occur: when two or more singular values are close together or if there is a tiny entry in the Z vector. For each such occurrence the order of the related secular equation problem is reduced by one.

SLASD2 is called from SLASD1.

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 n = nl + nr + 1 rows and m = n + sqre >= n columns.

out
k

Contains the dimension of the non-deflated matrix, This is the order of the related secular equation. 1 <= k <= n.

inout
D

Double precision array, dimension (n). On entry D contains the singular values of the two submatrices to be combined. On exit D contains the trailing (n-k) updated singular values (those which were deflated) sorted into decreasing order.

out
Z

Double precision array, dimension (m). On exit Z contains the updating row vector in the secular equation.

in
alpha

Contains the diagonal element associated with the added row.

in
beta

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

inout
U

Double precision array, dimension (ldu, n). On entry U contains the left singular vectors of two submatrices in the two square blocks with corners at (0,0), (nl-1, nl-1), and (nl+1, nl+1), (n-1,n-1). On exit U contains the trailing (n-k) updated left singular vectors (those which were deflated) in its last n-k columns.

in
ldu

The leading dimension of the array U. ldu >= n.

inout
VT

Double precision array, dimension (ldvt, m). On entry VT**T contains the right singular vectors of two submatrices in the two square blocks with corners at (0,0), (nl, nl), and (nl+1, nl+1), (m-1,m-1). On exit VT**T contains the trailing (n-k) updated right singular vectors (those which were deflated) in its last n-k columns. In case sqre =1, the last row of VT spans the right null space.

in
ldvt

The leading dimension of the array VT. ldvt >= m.

out
DSIGMA

Double precision array, dimension (n). Contains a copy of the diagonal elements (k-1 singular values and one zero) in the secular equation.

out
U2

Double precision array, dimension (ldu2, n). Contains a copy of the first k-1 left singular vectors which will be used by SLASD3 in a matrix multiply (DGEMM) to solve for the new left singular vectors. U2 is arranged into four blocks. The first block contains a column with 1 at nl and zero everywhere else; the second block contains non-zero entries only at and above nl-1; the third contains non-zero entries only below nl; and the fourth is dense.

in
ldu2

The leading dimension of the array U2. ldu2 >= n.

out
VT2

Double precision array, dimension (ldvt2, m). VT2**T contains a copy of the first k right singular vectors which will be used by SLASD3 in a matrix multiply (DGEMM) to solve for the new right singular vectors. VT2 is arranged into three blocks. The first block contains a row that corresponds to the special 0 diagonal element in SIGMA; the second block contains non-zeros only at and before nl; the third block contains non-zeros only at and after nl+1.

in
ldvt2

The leading dimension of the array VT2. ldvt2 >= m.

out
IDXP

Integer array, dimension (n). This will contain the permutation used to place deflated values of D at the end of the array. On output IDXP[1:k-1] points to the nondeflated D-values and IDXP[k:n-1] points to the deflated singular values.

out
IDX

Integer array, dimension (n). This will contain the permutation used to sort the contents of D into ascending order.

out
IDXC

Integer array, dimension (n). This will contain the permutation used to arrange the columns of the deflated U matrix into three groups: the first group contains non-zero entries only at and above nl-1, the second contains non-zero entries only below nl+1, and the third is dense.

inout
IDXQ

Integer array, dimension (n). This contains the permutation which separately sorts the two sub-problems in D into ascending order. Note that entries in the first half of this permutation must first be moved one position backward; and entries in the second half must first have nl+1 added to their values.

out
COLTYP

Integer array, dimension (n). As workspace, this will contain a label which will indicate which of the following types a column in the U2 matrix or a row in the VT2 matrix is: 0 : non-zero in the upper half only 1 : non-zero in the lower half only 2 : dense 3 : deflated On exit, it is an array of dimension 4, with COLTYP[i] being the dimension of the i-th type columns.

out
info

  • = 0: successful exit.

  • < 0: if info = -i, the i-th argument had an illegal value.

Functions

void dlasd2(
    const INT           nl,
    const INT           nr,
    const INT           sqre,
          INT*          k,
          f64* restrict D,
          f64* restrict Z,
    const f64           alpha,
    const f64           beta,
          f64* restrict U,
    const INT           ldu,
          f64* restrict VT,
    const INT           ldvt,
          f64* restrict DSIGMA,
          f64* restrict U2,
    const INT           ldu2,
          f64* restrict VT2,
    const INT           ldvt2,
          INT* restrict IDXP,
          INT* restrict IDX,
          INT* restrict IDXC,
          INT* restrict IDXQ,
          INT* restrict COLTYP,
          INT*          info
);
void dlasd2(const INT nl, const INT nr, const INT sqre, INT *k, f64 *restrict D, f64 *restrict Z, const f64 alpha, const f64 beta, f64 *restrict U, const INT ldu, f64 *restrict VT, const INT ldvt, f64 *restrict DSIGMA, f64 *restrict U2, const INT ldu2, f64 *restrict VT2, const INT ldvt2, INT *restrict IDXP, INT *restrict IDX, INT *restrict IDXC, INT *restrict IDXQ, INT *restrict COLTYP, INT *info)#

DLASD2 merges the two sets of singular values together into a single sorted set.

Then it tries to deflate the size of the problem. There are two ways in which deflation can occur: when two or more singular values are close together or if there is a tiny entry in the Z vector. For each such occurrence the order of the related secular equation problem is reduced by one.

DLASD2 is called from DLASD1.

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 n = nl + nr + 1 rows and m = n + sqre >= n columns.

out
k

Contains the dimension of the non-deflated matrix, This is the order of the related secular equation. 1 <= k <= n.

inout
D

Double precision array, dimension (n). On entry D contains the singular values of the two submatrices to be combined. On exit D contains the trailing (n-k) updated singular values (those which were deflated) sorted into decreasing order.

out
Z

Double precision array, dimension (m). On exit Z contains the updating row vector in the secular equation.

in
alpha

Contains the diagonal element associated with the added row.

in
beta

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

inout
U

Double precision array, dimension (ldu, n). On entry U contains the left singular vectors of two submatrices in the two square blocks with corners at (0,0), (nl-1, nl-1), and (nl+1, nl+1), (n-1,n-1). On exit U contains the trailing (n-k) updated left singular vectors (those which were deflated) in its last n-k columns.

in
ldu

The leading dimension of the array U. ldu >= n.

inout
VT

Double precision array, dimension (ldvt, m). On entry VT**T contains the right singular vectors of two submatrices in the two square blocks with corners at (0,0), (nl, nl), and (nl+1, nl+1), (m-1,m-1). On exit VT**T contains the trailing (n-k) updated right singular vectors (those which were deflated) in its last n-k columns. In case sqre =1, the last row of VT spans the right null space.

in
ldvt

The leading dimension of the array VT. ldvt >= m.

out
DSIGMA

Double precision array, dimension (n). Contains a copy of the diagonal elements (k-1 singular values and one zero) in the secular equation.

out
U2

Double precision array, dimension (ldu2, n). Contains a copy of the first k-1 left singular vectors which will be used by DLASD3 in a matrix multiply (DGEMM) to solve for the new left singular vectors. U2 is arranged into four blocks. The first block contains a column with 1 at nl and zero everywhere else; the second block contains non-zero entries only at and above nl-1; the third contains non-zero entries only below nl; and the fourth is dense.

in
ldu2

The leading dimension of the array U2. ldu2 >= n.

out
VT2

Double precision array, dimension (ldvt2, m). VT2**T contains a copy of the first k right singular vectors which will be used by DLASD3 in a matrix multiply (DGEMM) to solve for the new right singular vectors. VT2 is arranged into three blocks. The first block contains a row that corresponds to the special 0 diagonal element in SIGMA; the second block contains non-zeros only at and before nl; the third block contains non-zeros only at and after nl+1.

in
ldvt2

The leading dimension of the array VT2. ldvt2 >= m.

out
IDXP

Integer array, dimension (n). This will contain the permutation used to place deflated values of D at the end of the array. On output IDXP[1:k-1] points to the nondeflated D-values and IDXP[k:n-1] points to the deflated singular values.

out
IDX

Integer array, dimension (n). This will contain the permutation used to sort the contents of D into ascending order.

out
IDXC

Integer array, dimension (n). This will contain the permutation used to arrange the columns of the deflated U matrix into three groups: the first group contains non-zero entries only at and above nl-1, the second contains non-zero entries only below nl+1, and the third is dense.

inout
IDXQ

Integer array, dimension (n). This contains the permutation which separately sorts the two sub-problems in D into ascending order. Note that entries in the first half of this permutation must first be moved one position backward; and entries in the second half must first have nl+1 added to their values.

out
COLTYP

Integer array, dimension (n). As workspace, this will contain a label which will indicate which of the following types a column in the U2 matrix or a row in the VT2 matrix is: 0 : non-zero in the upper half only 1 : non-zero in the lower half only 2 : dense 3 : deflated On exit, it is an array of dimension 4, with COLTYP[i] being the dimension of the i-th type columns.

out
info

  • = 0: successful exit.

  • < 0: if info = -i, the i-th argument had an illegal value.