--- 
:name: dlasd7
:md5sum: f4a96aafe698a9fe1dc5bee822c506d3
:category: :subroutine
:arguments: 
- icompq: 
    :type: integer
    :intent: input
- nl: 
    :type: integer
    :intent: input
- nr: 
    :type: integer
    :intent: input
- sqre: 
    :type: integer
    :intent: input
- k: 
    :type: integer
    :intent: output
- d: 
    :type: doublereal
    :intent: input/output
    :dims: 
    - n
- z: 
    :type: doublereal
    :intent: output
    :dims: 
    - m
- zw: 
    :type: doublereal
    :intent: workspace
    :dims: 
    - m
- vf: 
    :type: doublereal
    :intent: input/output
    :dims: 
    - m
- vfw: 
    :type: doublereal
    :intent: workspace
    :dims: 
    - m
- vl: 
    :type: doublereal
    :intent: input/output
    :dims: 
    - m
- vlw: 
    :type: doublereal
    :intent: workspace
    :dims: 
    - m
- alpha: 
    :type: doublereal
    :intent: input
- beta: 
    :type: doublereal
    :intent: input
- dsigma: 
    :type: doublereal
    :intent: output
    :dims: 
    - n
- idx: 
    :type: integer
    :intent: workspace
    :dims: 
    - n
- idxp: 
    :type: integer
    :intent: workspace
    :dims: 
    - n
- idxq: 
    :type: integer
    :intent: input
    :dims: 
    - n
- perm: 
    :type: integer
    :intent: output
    :dims: 
    - n
- givptr: 
    :type: integer
    :intent: output
- givcol: 
    :type: integer
    :intent: output
    :dims: 
    - ldgcol
    - "2"
- ldgcol: 
    :type: integer
    :intent: input
- givnum: 
    :type: doublereal
    :intent: output
    :dims: 
    - ldgnum
    - "2"
- ldgnum: 
    :type: integer
    :intent: input
- c: 
    :type: doublereal
    :intent: output
- s: 
    :type: doublereal
    :intent: output
- info: 
    :type: integer
    :intent: output
:substitutions: 
  ldgnum: n
  ldgcol: n
:fortran_help: "      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 )\n\n\
  *  Purpose\n\
  *  =======\n\
  *\n\
  *  DLASD7 merges the two sets of singular values together into a single\n\
  *  sorted set. Then it tries to deflate the size of the problem. There\n\
  *  are two ways in which deflation can occur:  when two or more singular\n\
  *  values are close together or if there is a tiny entry in the Z\n\
  *  vector. For each such occurrence the order of the related\n\
  *  secular equation problem is reduced by one.\n\
  *\n\
  *  DLASD7 is called from DLASD6.\n\
  *\n\n\
  *  Arguments\n\
  *  =========\n\
  *\n\
  *  ICOMPQ  (input) INTEGER\n\
  *          Specifies whether singular vectors are to be computed\n\
  *          in compact form, as follows:\n\
  *          = 0: Compute singular values only.\n\
  *          = 1: Compute singular vectors of upper\n\
  *               bidiagonal matrix in compact form.\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\n\
  *         N = NL + NR + 1 rows and\n\
  *         M = N + SQRE >= N columns.\n\
  *\n\
  *  K      (output) INTEGER\n\
  *         Contains the dimension of the non-deflated matrix, this is\n\
  *         the order of the related secular equation. 1 <= K <=N.\n\
  *\n\
  *  D      (input/output) DOUBLE PRECISION array, dimension ( N )\n\
  *         On entry D contains the singular values of the two submatrices\n\
  *         to be combined. On exit D contains the trailing (N-K) updated\n\
  *         singular values (those which were deflated) sorted into\n\
  *         increasing order.\n\
  *\n\
  *  Z      (output) DOUBLE PRECISION array, dimension ( M )\n\
  *         On exit Z contains the updating row vector in the secular\n\
  *         equation.\n\
  *\n\
  *  ZW     (workspace) DOUBLE PRECISION array, dimension ( M )\n\
  *         Workspace for Z.\n\
  *\n\
  *  VF     (input/output) DOUBLE PRECISION array, dimension ( M )\n\
  *         On entry, VF(1:NL+1) contains the first components of all\n\
  *         right singular vectors of the upper block; and VF(NL+2:M)\n\
  *         contains the first components of all right singular vectors\n\
  *         of the lower block. On exit, VF contains the first components\n\
  *         of all right singular vectors of the bidiagonal matrix.\n\
  *\n\
  *  VFW    (workspace) DOUBLE PRECISION array, dimension ( M )\n\
  *         Workspace for VF.\n\
  *\n\
  *  VL     (input/output) DOUBLE PRECISION array, dimension ( M )\n\
  *         On entry, VL(1:NL+1) contains the  last components of all\n\
  *         right singular vectors of the upper block; and VL(NL+2:M)\n\
  *         contains the last components of all right singular vectors\n\
  *         of the lower block. On exit, VL contains the last components\n\
  *         of all right singular vectors of the bidiagonal matrix.\n\
  *\n\
  *  VLW    (workspace) DOUBLE PRECISION array, dimension ( M )\n\
  *         Workspace for VL.\n\
  *\n\
  *  ALPHA  (input) DOUBLE PRECISION\n\
  *         Contains the diagonal element associated with the added row.\n\
  *\n\
  *  BETA   (input) DOUBLE PRECISION\n\
  *         Contains the off-diagonal element associated with the added\n\
  *         row.\n\
  *\n\
  *  DSIGMA (output) DOUBLE PRECISION array, dimension ( N )\n\
  *         Contains a copy of the diagonal elements (K-1 singular values\n\
  *         and one zero) in the secular equation.\n\
  *\n\
  *  IDX    (workspace) INTEGER array, dimension ( N )\n\
  *         This will contain the permutation used to sort the contents of\n\
  *         D into ascending order.\n\
  *\n\
  *  IDXP   (workspace) INTEGER array, dimension ( N )\n\
  *         This will contain the permutation used to place deflated\n\
  *         values of D at the end of the array. On output IDXP(2:K)\n\
  *         points to the nondeflated D-values and IDXP(K+1:N)\n\
  *         points to the deflated singular values.\n\
  *\n\
  *  IDXQ   (input) INTEGER array, dimension ( N )\n\
  *         This contains the permutation which separately sorts the two\n\
  *         sub-problems in D into ascending order.  Note that entries in\n\
  *         the first half of this permutation must first be moved one\n\
  *         position backward; and entries in the second half\n\
  *         must first have NL+1 added to their values.\n\
  *\n\
  *  PERM   (output) INTEGER array, dimension ( N )\n\
  *         The permutations (from deflation and sorting) to be applied\n\
  *         to each singular block. Not referenced if ICOMPQ = 0.\n\
  *\n\
  *  GIVPTR (output) INTEGER\n\
  *         The number of Givens rotations which took place in this\n\
  *         subproblem. Not referenced if ICOMPQ = 0.\n\
  *\n\
  *  GIVCOL (output) INTEGER array, dimension ( LDGCOL, 2 )\n\
  *         Each pair of numbers indicates a pair of columns to take place\n\
  *         in a Givens rotation. Not referenced if ICOMPQ = 0.\n\
  *\n\
  *  LDGCOL (input) INTEGER\n\
  *         The leading dimension of GIVCOL, must be at least N.\n\
  *\n\
  *  GIVNUM (output) DOUBLE PRECISION array, dimension ( LDGNUM, 2 )\n\
  *         Each number indicates the C or S value to be used in the\n\
  *         corresponding Givens rotation. Not referenced if ICOMPQ = 0.\n\
  *\n\
  *  LDGNUM (input) INTEGER\n\
  *         The leading dimension of GIVNUM, must be at least N.\n\
  *\n\
  *  C      (output) DOUBLE PRECISION\n\
  *         C contains garbage if SQRE =0 and the C-value of a Givens\n\
  *         rotation related to the right null space if SQRE = 1.\n\
  *\n\
  *  S      (output) DOUBLE PRECISION\n\
  *         S contains garbage if SQRE =0 and the S-value of a Givens\n\
  *         rotation related to the right null space if SQRE = 1.\n\
  *\n\
  *  INFO   (output) INTEGER\n\
  *         = 0:  successful exit.\n\
  *         < 0:  if INFO = -i, the i-th argument had an illegal value.\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"
