--- 
:name: dlalsd
:md5sum: daa27e524befeb510c616ce5488bea0f
:category: :subroutine
:arguments: 
- uplo: 
    :type: char
    :intent: input
- smlsiz: 
    :type: integer
    :intent: input
- n: 
    :type: integer
    :intent: input
- nrhs: 
    :type: integer
    :intent: input
- d: 
    :type: doublereal
    :intent: input/output
    :dims: 
    - n
- e: 
    :type: doublereal
    :intent: input/output
    :dims: 
    - n-1
- b: 
    :type: doublereal
    :intent: input/output
    :dims: 
    - ldb
    - nrhs
- ldb: 
    :type: integer
    :intent: input
- rcond: 
    :type: doublereal
    :intent: input
- rank: 
    :type: integer
    :intent: output
- work: 
    :type: doublereal
    :intent: workspace
    :dims: 
    - 9*n + 2*n*smlsiz + 8*n*nlvl + n*nrhs + pow(smlsiz+1,2)
- iwork: 
    :type: integer
    :intent: workspace
    :dims: 
    - 3*n*nlvl + 11*n
- info: 
    :type: integer
    :intent: output
:substitutions: 
  nlvl: MAX(0, (int)(1.0/log(2.0)*log((double)n/(smlsiz+1))) + 1)
:extras:
  nlvl: integer
:fortran_help: "      SUBROUTINE DLALSD( UPLO, SMLSIZ, N, NRHS, D, E, B, LDB, RCOND, RANK, WORK, IWORK, INFO )\n\n\
  *  Purpose\n\
  *  =======\n\
  *\n\
  *  DLALSD uses the singular value decomposition of A to solve the least\n\
  *  squares problem of finding X to minimize the Euclidean norm of each\n\
  *  column of A*X-B, where A is N-by-N upper bidiagonal, and X and B\n\
  *  are N-by-NRHS. The solution X overwrites B.\n\
  *\n\
  *  The singular values of A smaller than RCOND times the largest\n\
  *  singular value are treated as zero in solving the least squares\n\
  *  problem; in this case a minimum norm solution is returned.\n\
  *  The actual singular values are returned in D in ascending order.\n\
  *\n\
  *  This code makes very mild assumptions about floating point\n\
  *  arithmetic. It will work on machines with a guard digit in\n\
  *  add/subtract, or on those binary machines without guard digits\n\
  *  which subtract like the Cray XMP, Cray YMP, Cray C 90, or Cray 2.\n\
  *  It could conceivably fail on hexadecimal or decimal machines\n\
  *  without guard digits, but we know of none.\n\
  *\n\n\
  *  Arguments\n\
  *  =========\n\
  *\n\
  *  UPLO   (input) CHARACTER*1\n\
  *         = 'U': D and E define an upper bidiagonal matrix.\n\
  *         = 'L': D and E define a  lower bidiagonal matrix.\n\
  *\n\
  *  SMLSIZ (input) INTEGER\n\
  *         The maximum size of the subproblems at the bottom of the\n\
  *         computation tree.\n\
  *\n\
  *  N      (input) INTEGER\n\
  *         The dimension of the  bidiagonal matrix.  N >= 0.\n\
  *\n\
  *  NRHS   (input) INTEGER\n\
  *         The number of columns of B. NRHS must be at least 1.\n\
  *\n\
  *  D      (input/output) DOUBLE PRECISION array, dimension (N)\n\
  *         On entry D contains the main diagonal of the bidiagonal\n\
  *         matrix. On exit, if INFO = 0, D contains its singular values.\n\
  *\n\
  *  E      (input/output) DOUBLE PRECISION array, dimension (N-1)\n\
  *         Contains the super-diagonal entries of the bidiagonal matrix.\n\
  *         On exit, E has been destroyed.\n\
  *\n\
  *  B      (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)\n\
  *         On input, B contains the right hand sides of the least\n\
  *         squares problem. On output, B contains the solution X.\n\
  *\n\
  *  LDB    (input) INTEGER\n\
  *         The leading dimension of B in the calling subprogram.\n\
  *         LDB must be at least max(1,N).\n\
  *\n\
  *  RCOND  (input) DOUBLE PRECISION\n\
  *         The singular values of A less than or equal to RCOND times\n\
  *         the largest singular value are treated as zero in solving\n\
  *         the least squares problem. If RCOND is negative,\n\
  *         machine precision is used instead.\n\
  *         For example, if diag(S)*X=B were the least squares problem,\n\
  *         where diag(S) is a diagonal matrix of singular values, the\n\
  *         solution would be X(i) = B(i) / S(i) if S(i) is greater than\n\
  *         RCOND*max(S), and X(i) = 0 if S(i) is less than or equal to\n\
  *         RCOND*max(S).\n\
  *\n\
  *  RANK   (output) INTEGER\n\
  *         The number of singular values of A greater than RCOND times\n\
  *         the largest singular value.\n\
  *\n\
  *  WORK   (workspace) DOUBLE PRECISION array, dimension at least\n\
  *         (9*N + 2*N*SMLSIZ + 8*N*NLVL + N*NRHS + (SMLSIZ+1)**2),\n\
  *         where NLVL = max(0, INT(log_2 (N/(SMLSIZ+1))) + 1).\n\
  *\n\
  *  IWORK  (workspace) INTEGER array, dimension at least\n\
  *         (3*N*NLVL + 11*N)\n\
  *\n\
  *  INFO   (output) INTEGER\n\
  *         = 0:  successful exit.\n\
  *         < 0:  if INFO = -i, the i-th argument had an illegal value.\n\
  *         > 0:  The algorithm failed to compute a singular value while\n\
  *               working on the submatrix lying in rows and columns\n\
  *               INFO/(N+1) through MOD(INFO,N+1).\n\
  *\n\n\
  *  Further Details\n\
  *  ===============\n\
  *\n\
  *  Based on contributions by\n\
  *     Ming Gu and Ren-Cang Li, Computer Science Division, University of\n\
  *       California at Berkeley, USA\n\
  *     Osni Marques, LBNL/NERSC, USA\n\
  *\n\
  *  =====================================================================\n\
  *\n"
