--- 
:name: sgelsx
:md5sum: e4e07c42aeca28db21674ddeedfea311
:category: :subroutine
:arguments: 
- m: 
    :type: integer
    :intent: input
- n: 
    :type: integer
    :intent: input
- nrhs: 
    :type: integer
    :intent: input
- a: 
    :type: real
    :intent: input/output
    :dims: 
    - lda
    - n
- lda: 
    :type: integer
    :intent: input
- b: 
    :type: real
    :intent: input/output
    :dims: 
    - ldb
    - nrhs
- ldb: 
    :type: integer
    :intent: input
- jpvt: 
    :type: integer
    :intent: input/output
    :dims: 
    - n
- rcond: 
    :type: real
    :intent: input
- rank: 
    :type: integer
    :intent: output
- work: 
    :type: real
    :intent: workspace
    :dims: 
    - MAX((MIN(m,n))+3*n,2*(MIN(m,n))*nrhs)
- info: 
    :type: integer
    :intent: output
:substitutions: {}

:fortran_help: "      SUBROUTINE SGELSX( M, N, NRHS, A, LDA, B, LDB, JPVT, RCOND, RANK, WORK, INFO )\n\n\
  *  Purpose\n\
  *  =======\n\
  *\n\
  *  This routine is deprecated and has been replaced by routine SGELSY.\n\
  *\n\
  *  SGELSX computes the minimum-norm solution to a real linear least\n\
  *  squares problem:\n\
  *      minimize || A * X - B ||\n\
  *  using a complete orthogonal factorization of A.  A is an M-by-N\n\
  *  matrix which may be rank-deficient.\n\
  *\n\
  *  Several right hand side vectors b and solution vectors x can be \n\
  *  handled in a single call; they are stored as the columns of the\n\
  *  M-by-NRHS right hand side matrix B and the N-by-NRHS solution\n\
  *  matrix X.\n\
  *\n\
  *  The routine first computes a QR factorization with column pivoting:\n\
  *      A * P = Q * [ R11 R12 ]\n\
  *                  [  0  R22 ]\n\
  *  with R11 defined as the largest leading submatrix whose estimated\n\
  *  condition number is less than 1/RCOND.  The order of R11, RANK,\n\
  *  is the effective rank of A.\n\
  *\n\
  *  Then, R22 is considered to be negligible, and R12 is annihilated\n\
  *  by orthogonal transformations from the right, arriving at the\n\
  *  complete orthogonal factorization:\n\
  *     A * P = Q * [ T11 0 ] * Z\n\
  *                 [  0  0 ]\n\
  *  The minimum-norm solution is then\n\
  *     X = P * Z' [ inv(T11)*Q1'*B ]\n\
  *                [        0       ]\n\
  *  where Q1 consists of the first RANK columns of Q.\n\
  *\n\n\
  *  Arguments\n\
  *  =========\n\
  *\n\
  *  M       (input) INTEGER\n\
  *          The number of rows of the matrix A.  M >= 0.\n\
  *\n\
  *  N       (input) INTEGER\n\
  *          The number of columns of the matrix A.  N >= 0.\n\
  *\n\
  *  NRHS    (input) INTEGER\n\
  *          The number of right hand sides, i.e., the number of\n\
  *          columns of matrices B and X. NRHS >= 0.\n\
  *\n\
  *  A       (input/output) REAL array, dimension (LDA,N)\n\
  *          On entry, the M-by-N matrix A.\n\
  *          On exit, A has been overwritten by details of its\n\
  *          complete orthogonal factorization.\n\
  *\n\
  *  LDA     (input) INTEGER\n\
  *          The leading dimension of the array A.  LDA >= max(1,M).\n\
  *\n\
  *  B       (input/output) REAL array, dimension (LDB,NRHS)\n\
  *          On entry, the M-by-NRHS right hand side matrix B.\n\
  *          On exit, the N-by-NRHS solution matrix X.\n\
  *          If m >= n and RANK = n, the residual sum-of-squares for\n\
  *          the solution in the i-th column is given by the sum of\n\
  *          squares of elements N+1:M in that column.\n\
  *\n\
  *  LDB     (input) INTEGER\n\
  *          The leading dimension of the array B. LDB >= max(1,M,N).\n\
  *\n\
  *  JPVT    (input/output) INTEGER array, dimension (N)\n\
  *          On entry, if JPVT(i) .ne. 0, the i-th column of A is an\n\
  *          initial column, otherwise it is a free column.  Before\n\
  *          the QR factorization of A, all initial columns are\n\
  *          permuted to the leading positions; only the remaining\n\
  *          free columns are moved as a result of column pivoting\n\
  *          during the factorization.\n\
  *          On exit, if JPVT(i) = k, then the i-th column of A*P\n\
  *          was the k-th column of A.\n\
  *\n\
  *  RCOND   (input) REAL\n\
  *          RCOND is used to determine the effective rank of A, which\n\
  *          is defined as the order of the largest leading triangular\n\
  *          submatrix R11 in the QR factorization with pivoting of A,\n\
  *          whose estimated condition number < 1/RCOND.\n\
  *\n\
  *  RANK    (output) INTEGER\n\
  *          The effective rank of A, i.e., the order of the submatrix\n\
  *          R11.  This is the same as the order of the submatrix T11\n\
  *          in the complete orthogonal factorization of A.\n\
  *\n\
  *  WORK    (workspace) REAL array, dimension\n\
  *                      (max( min(M,N)+3*N, 2*min(M,N)+NRHS )),\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\
  *  =====================================================================\n\
  *\n"
