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
|
---
:name: zgels
:md5sum: d543f789adef7ad831c7880fbac31097
:category: :subroutine
:arguments:
- trans:
:type: char
:intent: input
- m:
:type: integer
:intent: input
- n:
:type: integer
:intent: input
- nrhs:
:type: integer
:intent: input
- a:
:type: doublecomplex
:intent: input/output
: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
- work:
:type: doublecomplex
:intent: output
:dims:
- MAX(1,lwork)
- lwork:
:type: integer
:intent: input
:option: true
:default: MIN(m,n) + MAX(MIN(m,n),nrhs)
- info:
:type: integer
:intent: output
:substitutions:
m: lda
ldb: MAX(m,n)
:fortran_help: " SUBROUTINE ZGELS( TRANS, M, N, NRHS, A, LDA, B, LDB, WORK, LWORK, INFO )\n\n\
* Purpose\n\
* =======\n\
*\n\
* ZGELS solves overdetermined or underdetermined complex linear systems\n\
* involving an M-by-N matrix A, or its conjugate-transpose, using a QR\n\
* or LQ factorization of A. It is assumed that A has full rank.\n\
*\n\
* The following options are provided:\n\
*\n\
* 1. If TRANS = 'N' and m >= n: find the least squares solution of\n\
* an overdetermined system, i.e., solve the least squares problem\n\
* minimize || B - A*X ||.\n\
*\n\
* 2. If TRANS = 'N' and m < n: find the minimum norm solution of\n\
* an underdetermined system A * X = B.\n\
*\n\
* 3. If TRANS = 'C' and m >= n: find the minimum norm solution of\n\
* an undetermined system A**H * X = B.\n\
*\n\
* 4. If TRANS = 'C' and m < n: find the least squares solution of\n\
* an overdetermined system, i.e., solve the least squares problem\n\
* minimize || B - A**H * X ||.\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\n\
* Arguments\n\
* =========\n\
*\n\
* TRANS (input) CHARACTER*1\n\
* = 'N': the linear system involves A;\n\
* = 'C': the linear system involves A**H.\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 the matrices B and X. NRHS >= 0.\n\
*\n\
* A (input/output) COMPLEX*16 array, dimension (LDA,N)\n\
* On entry, the M-by-N matrix A.\n\
* if M >= N, A is overwritten by details of its QR\n\
* factorization as returned by ZGEQRF;\n\
* if M < N, A is overwritten by details of its LQ\n\
* factorization as returned by ZGELQF.\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 matrix B of right hand side vectors, stored\n\
* columnwise; B is M-by-NRHS if TRANS = 'N', or N-by-NRHS\n\
* if TRANS = 'C'.\n\
* On exit, if INFO = 0, B is overwritten by the solution\n\
* vectors, stored columnwise:\n\
* if TRANS = 'N' and m >= n, rows 1 to n of B contain the least\n\
* squares solution vectors; the residual sum of squares for the\n\
* solution in each column is given by the sum of squares of the\n\
* modulus of elements N+1 to M in that column;\n\
* if TRANS = 'N' and m < n, rows 1 to N of B contain the\n\
* minimum norm solution vectors;\n\
* if TRANS = 'C' and m >= n, rows 1 to M of B contain the\n\
* minimum norm solution vectors;\n\
* if TRANS = 'C' and m < n, rows 1 to M of B contain the\n\
* least squares solution vectors; the residual sum of squares\n\
* for the solution in each column is given by the sum of\n\
* squares of the modulus of elements M+1 to N in that column.\n\
*\n\
* LDB (input) INTEGER\n\
* The leading dimension of the array B. LDB >= MAX(1,M,N).\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.\n\
* LWORK >= max( 1, MN + max( MN, NRHS ) ).\n\
* For optimal performance,\n\
* LWORK >= max( 1, MN + max( MN, NRHS )*NB ).\n\
* where MN = min(M,N) and NB is the optimum block size.\n\
*\n\
* If LWORK = -1, then a workspace query is assumed; the routine\n\
* only calculates the optimal size of the WORK array, returns\n\
* this value as the first entry of the WORK array, and no error\n\
* message related to LWORK is issued by XERBLA.\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 = i, the i-th diagonal element of the\n\
* triangular factor of A is zero, so that A does not have\n\
* full rank; the least squares solution could not be\n\
* computed.\n\
*\n\n\
* =====================================================================\n\
*\n"
|