1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
|
---
:name: zgelsd
:md5sum: 3cda6a4e059bdc95d6c1841204c3d144
:category: :subroutine
:arguments:
- m:
:type: integer
:intent: input
- n:
:type: integer
:intent: input
- nrhs:
:type: integer
:intent: input
- a:
:type: doublecomplex
:intent: input
:dims:
- lda
- n
- lda:
:type: integer
:intent: input
- b:
:type: doublecomplex
:intent: input/output
:dims:
- m
- nrhs
:outdims:
- n
- nrhs
- ldb:
:type: integer
:intent: input
- s:
:type: doublereal
:intent: output
:dims:
- MIN(m,n)
- rcond:
:type: doublereal
:intent: input
- rank:
:type: integer
:intent: output
- work:
:type: doublecomplex
:intent: output
:dims:
- MAX(1,lwork)
- lwork:
:type: integer
:intent: input
:option: true
:default: "m>=n ? 2*n+n*nrhs : 2*m+m*nrhs"
- rwork:
:type: doublereal
:intent: workspace
:dims:
- MAX(1,lrwork)
- iwork:
:type: integer
:intent: workspace
:dims:
- MAX(1,liwork)
- info:
:type: integer
:intent: output
:substitutions:
m: lda
ldb: MAX(m,n)
c__9: "9"
c__0: "0"
liwork: MAX(1,3*(MIN(m,n))*nlvl+11*(MIN(m,n)))
lrwork: "m>=n ? 10*n+2*n*smlsiz+8*n*nlvl+3*smlsiz*nrhs+(smlsiz+1)*(smlsiz+1) : 10*m+2*m*smlsiz+8*m*nlvl+2*smlsiz*nrhs+(smlsiz+1)*(smlsiz+1)"
nlvl: MAX(0,(int)(log(1.0*MIN(m,n)/(smlsiz+1))/log(2.0)))
smlsiz: ilaenv_(&c__9,"ZGELSD"," ",&c__0,&c__0,&c__0,&c__0)
:fortran_help: " SUBROUTINE ZGELSD( M, N, NRHS, A, LDA, B, LDB, S, RCOND, RANK, WORK, LWORK, RWORK, IWORK, INFO )\n\n\
* Purpose\n\
* =======\n\
*\n\
* ZGELSD computes the minimum-norm solution to a real linear least\n\
* squares problem:\n\
* minimize 2-norm(| b - A*x |)\n\
* using the singular value decomposition (SVD) 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 problem is solved in three steps:\n\
* (1) Reduce the coefficient matrix A to bidiagonal form with\n\
* Householder transformations, reducing the original problem\n\
* into a \"bidiagonal least squares problem\" (BLS)\n\
* (2) Solve the BLS using a divide and conquer approach.\n\
* (3) Apply back all the Householder transformations to solve\n\
* the original least squares problem.\n\
*\n\
* The effective rank of A is determined by treating as zero those\n\
* singular values which are less than RCOND times the largest singular\n\
* value.\n\
*\n\
* The divide and conquer algorithm makes very mild assumptions about\n\
* floating point arithmetic. It will work on machines with a guard\n\
* digit in add/subtract, or on those binary machines without guard\n\
* digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or\n\
* Cray-2. 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\
* 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 columns\n\
* of the matrices B and X. NRHS >= 0.\n\
*\n\
* A (input) COMPLEX*16 array, dimension (LDA,N)\n\
* On entry, the M-by-N matrix A.\n\
* On exit, A has been destroyed.\n\
*\n\
* LDA (input) INTEGER\n\
* The leading dimension of the array A. LDA >= max(1,M).\n\
*\n\
* B (input/output) COMPLEX*16 array, dimension (LDB,NRHS)\n\
* On entry, the M-by-NRHS right hand side matrix B.\n\
* On exit, B is overwritten by 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 the modulus 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\
* S (output) DOUBLE PRECISION array, dimension (min(M,N))\n\
* The singular values of A in decreasing order.\n\
* The condition number of A in the 2-norm = S(1)/S(min(m,n)).\n\
*\n\
* RCOND (input) DOUBLE PRECISION\n\
* RCOND is used to determine the effective rank of A.\n\
* Singular values S(i) <= RCOND*S(1) are treated as zero.\n\
* If RCOND < 0, machine precision is used instead.\n\
*\n\
* RANK (output) INTEGER\n\
* The effective rank of A, i.e., the number of singular values\n\
* which are greater than RCOND*S(1).\n\
*\n\
* WORK (workspace/output) COMPLEX*16 array, dimension (MAX(1,LWORK))\n\
* On exit, if INFO = 0, WORK(1) returns the optimal LWORK.\n\
*\n\
* LWORK (input) INTEGER\n\
* The dimension of the array WORK. LWORK must be at least 1.\n\
* The exact minimum amount of workspace needed depends on M,\n\
* N and NRHS. As long as LWORK is at least\n\
* 2*N + N*NRHS\n\
* if M is greater than or equal to N or\n\
* 2*M + M*NRHS\n\
* if M is less than N, the code will execute correctly.\n\
* For good performance, LWORK should generally be larger.\n\
*\n\
* If LWORK = -1, then a workspace query is assumed; the routine\n\
* only calculates the optimal size of the array WORK and the\n\
* minimum sizes of the arrays RWORK and IWORK, and returns\n\
* these values as the first entries of the WORK, RWORK and\n\
* IWORK arrays, and no error message related to LWORK is issued\n\
* by XERBLA.\n\
*\n\
* RWORK (workspace) DOUBLE PRECISION array, dimension (MAX(1,LRWORK))\n\
* LRWORK >=\n\
* 10*N + 2*N*SMLSIZ + 8*N*NLVL + 3*SMLSIZ*NRHS +\n\
* MAX( (SMLSIZ+1)**2, N*(1+NRHS) + 2*NRHS )\n\
* if M is greater than or equal to N or\n\
* 10*M + 2*M*SMLSIZ + 8*M*NLVL + 3*SMLSIZ*NRHS +\n\
* MAX( (SMLSIZ+1)**2, N*(1+NRHS) + 2*NRHS )\n\
* if M is less than N, the code will execute correctly.\n\
* SMLSIZ is returned by ILAENV and is equal to the maximum\n\
* size of the subproblems at the bottom of the computation\n\
* tree (usually about 25), and\n\
* NLVL = MAX( 0, INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) + 1 )\n\
* On exit, if INFO = 0, RWORK(1) returns the minimum LRWORK.\n\
*\n\
* IWORK (workspace) INTEGER array, dimension (MAX(1,LIWORK))\n\
* LIWORK >= max(1, 3*MINMN*NLVL + 11*MINMN),\n\
* where MINMN = MIN( M,N ).\n\
* On exit, if INFO = 0, IWORK(1) returns the minimum LIWORK.\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 for computing the SVD failed to converge;\n\
* if INFO = i, i off-diagonal elements of an intermediate\n\
* bidiagonal form did not converge to zero.\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"
|