--- 
:name: dlasd1
:md5sum: 4f6a6e622373feee99a1d18bb5f55bec
:category: :subroutine
:arguments: 
- nl: 
    :type: integer
    :intent: input
- nr: 
    :type: integer
    :intent: input
- sqre: 
    :type: integer
    :intent: input
- d: 
    :type: doublereal
    :intent: input/output
    :dims: 
    - n
- alpha: 
    :type: doublereal
    :intent: input/output
- beta: 
    :type: doublereal
    :intent: input/output
- u: 
    :type: doublereal
    :intent: input/output
    :dims: 
    - ldu
    - n
- ldu: 
    :type: integer
    :intent: input
- vt: 
    :type: doublereal
    :intent: input/output
    :dims: 
    - ldvt
    - m
- ldvt: 
    :type: integer
    :intent: input
- idxq: 
    :type: integer
    :intent: output
    :dims: 
    - n
- iwork: 
    :type: integer
    :intent: workspace
    :dims: 
    - 4 * n
- work: 
    :type: doublereal
    :intent: workspace
    :dims: 
    - 3*pow(m,2) + 2*m
- info: 
    :type: integer
    :intent: output
:substitutions: 
  m: n + sqre
  n: nl+nr+1
:fortran_help: "      SUBROUTINE DLASD1( NL, NR, SQRE, D, ALPHA, BETA, U, LDU, VT, LDVT, IDXQ, IWORK, WORK, INFO )\n\n\
  *  Purpose\n\
  *  =======\n\
  *\n\
  *  DLASD1 computes the SVD of an upper bidiagonal N-by-M matrix B,\n\
  *  where N = NL + NR + 1 and M = N + SQRE. DLASD1 is called from DLASD0.\n\
  *\n\
  *  A related subroutine DLASD7 handles the case in which the singular\n\
  *  values (and the singular vectors in factored form) are desired.\n\
  *\n\
  *  DLASD1 computes the SVD as follows:\n\
  *\n\
  *                ( D1(in)  0    0     0 )\n\
  *    B = U(in) * (   Z1'   a   Z2'    b ) * VT(in)\n\
  *                (   0     0   D2(in) 0 )\n\
  *\n\
  *      = U(out) * ( D(out) 0) * VT(out)\n\
  *\n\
  *  where Z' = (Z1' a Z2' b) = u' VT', and u is a vector of dimension M\n\
  *  with ALPHA and BETA in the NL+1 and NL+2 th entries and zeros\n\
  *  elsewhere; and the entry b is empty if SQRE = 0.\n\
  *\n\
  *  The left singular vectors of the original matrix are stored in U, and\n\
  *  the transpose of the right singular vectors are stored in VT, and the\n\
  *  singular values are in D.  The algorithm consists of three stages:\n\
  *\n\
  *     The first stage consists of deflating the size of the problem\n\
  *     when there are multiple singular values or when there are zeros in\n\
  *     the Z vector.  For each such occurence the dimension of the\n\
  *     secular equation problem is reduced by one.  This stage is\n\
  *     performed by the routine DLASD2.\n\
  *\n\
  *     The second stage consists of calculating the updated\n\
  *     singular values. This is done by finding the square roots of the\n\
  *     roots of the secular equation via the routine DLASD4 (as called\n\
  *     by DLASD3). This routine also calculates the singular vectors of\n\
  *     the current problem.\n\
  *\n\
  *     The final stage consists of computing the updated singular vectors\n\
  *     directly using the updated singular values.  The singular vectors\n\
  *     for the current problem are multiplied with the singular vectors\n\
  *     from the overall problem.\n\
  *\n\n\
  *  Arguments\n\
  *  =========\n\
  *\n\
  *  NL     (input) INTEGER\n\
  *         The row dimension of the upper block.  NL >= 1.\n\
  *\n\
  *  NR     (input) INTEGER\n\
  *         The row dimension of the lower block.  NR >= 1.\n\
  *\n\
  *  SQRE   (input) INTEGER\n\
  *         = 0: the lower block is an NR-by-NR square matrix.\n\
  *         = 1: the lower block is an NR-by-(NR+1) rectangular matrix.\n\
  *\n\
  *         The bidiagonal matrix has row dimension N = NL + NR + 1,\n\
  *         and column dimension M = N + SQRE.\n\
  *\n\
  *  D      (input/output) DOUBLE PRECISION array,\n\
  *                        dimension (N = NL+NR+1).\n\
  *         On entry D(1:NL,1:NL) contains the singular values of the\n\
  *         upper block; and D(NL+2:N) contains the singular values of\n\
  *         the lower block. On exit D(1:N) contains the singular values\n\
  *         of the modified matrix.\n\
  *\n\
  *  ALPHA  (input/output) DOUBLE PRECISION\n\
  *         Contains the diagonal element associated with the added row.\n\
  *\n\
  *  BETA   (input/output) DOUBLE PRECISION\n\
  *         Contains the off-diagonal element associated with the added\n\
  *         row.\n\
  *\n\
  *  U      (input/output) DOUBLE PRECISION array, dimension(LDU,N)\n\
  *         On entry U(1:NL, 1:NL) contains the left singular vectors of\n\
  *         the upper block; U(NL+2:N, NL+2:N) contains the left singular\n\
  *         vectors of the lower block. On exit U contains the left\n\
  *         singular vectors of the bidiagonal matrix.\n\
  *\n\
  *  LDU    (input) INTEGER\n\
  *         The leading dimension of the array U.  LDU >= max( 1, N ).\n\
  *\n\
  *  VT     (input/output) DOUBLE PRECISION array, dimension(LDVT,M)\n\
  *         where M = N + SQRE.\n\
  *         On entry VT(1:NL+1, 1:NL+1)' contains the right singular\n\
  *         vectors of the upper block; VT(NL+2:M, NL+2:M)' contains\n\
  *         the right singular vectors of the lower block. On exit\n\
  *         VT' contains the right singular vectors of the\n\
  *         bidiagonal matrix.\n\
  *\n\
  *  LDVT   (input) INTEGER\n\
  *         The leading dimension of the array VT.  LDVT >= max( 1, M ).\n\
  *\n\
  *  IDXQ  (output) INTEGER array, dimension(N)\n\
  *         This contains the permutation which will reintegrate the\n\
  *         subproblem just solved back into sorted order, i.e.\n\
  *         D( IDXQ( I = 1, N ) ) will be in ascending order.\n\
  *\n\
  *  IWORK  (workspace) INTEGER array, dimension( 4 * N )\n\
  *\n\
  *  WORK   (workspace) DOUBLE PRECISION array, dimension( 3*M**2 + 2*M )\n\
  *\n\
  *  INFO   (output) INTEGER\n\
  *          = 0:  successful exit.\n\
  *          < 0:  if INFO = -i, the i-th argument had an illegal value.\n\
  *          > 0:  if INFO = 1, a singular value did not converge\n\
  *\n\n\
  *  Further Details\n\
  *  ===============\n\
  *\n\
  *  Based on contributions by\n\
  *     Ming Gu and Huan Ren, Computer Science Division, University of\n\
  *     California at Berkeley, USA\n\
  *\n\
  *  =====================================================================\n\
  *\n"
