p?gels
p?gels
Solves overdetermined or underdetermined linear systems involving a matrix of full rank.
Syntax
void
psgels
(
char
*trans
,
MKL_INT
*m
,
MKL_INT
*n
,
MKL_INT
*nrhs
,
float
*a
,
MKL_INT
*ia
,
MKL_INT
*ja
,
MKL_INT
*desca
,
float
*b
,
MKL_INT
*ib
,
MKL_INT
*jb
,
MKL_INT
*descb
,
float
*work
,
MKL_INT
*lwork
,
MKL_INT
*info
);
void
pdgels
(
char
*trans
,
MKL_INT
*m
,
MKL_INT
*n
,
MKL_INT
*nrhs
,
double
*a
,
MKL_INT
*ia
,
MKL_INT
*ja
,
MKL_INT
*desca
,
double
*b
,
MKL_INT
*ib
,
MKL_INT
*jb
,
MKL_INT
*descb
,
double
*work
,
MKL_INT
*lwork
,
MKL_INT
*info
);
void
pcgels
(
char
*trans
,
MKL_INT
*m
,
MKL_INT
*n
,
MKL_INT
*nrhs
,
MKL_Complex8
*a
,
MKL_INT
*ia
,
MKL_INT
*ja
,
MKL_INT
*desca
,
MKL_Complex8
*b
,
MKL_INT
*ib
,
MKL_INT
*jb
,
MKL_INT
*descb
,
MKL_Complex8
*work
,
MKL_INT
*lwork
,
MKL_INT
*info
);
void
pzgels
(
char
*trans
,
MKL_INT
*m
,
MKL_INT
*n
,
MKL_INT
*nrhs
,
MKL_Complex16
*a
,
MKL_INT
*ia
,
MKL_INT
*ja
,
MKL_INT
*desca
,
MKL_Complex16
*b
,
MKL_INT
*ib
,
MKL_INT
*jb
,
MKL_INT
*descb
,
MKL_Complex16
*work
,
MKL_INT
*lwork
,
MKL_INT
*info
);
Include Files
- mkl_scalapack.h
Description
The
p?gels
function
solves overdetermined or underdetermined real/ complex linear systems involving an m
-by-n
matrix sub(
, or its transpose/ conjugate-transpose, using a A
) = A
(ia
:ia
+m
-1,ja
:ja
+n
-1)QTQ
or LQ
factorization of sub(A
). It is assumed that sub(A
) has full rank.The following options are provided:
- Ifandtrans='N': find the least squares solution of an overdetermined system, that is, solve the least squares problemm≥nminimize ||sub(B) - sub(A)*X||
- Ifandtrans='N': find the minimum norm solution of an underdetermined systemm<nsub(.A)*X= sub(B)
- Ifandtrans='T': find the minimum norm solution of an undetermined systemm≥nsub(.A)T*X= sub(B)
- Ifandtrans='T': find the least squares solution of an overdetermined system, that is, solve the least squares problemm<nminimize ||sub(,B) - sub(A)*TX||wheresub(whenB) denotesB(ib:ib+m-1,jb:jb+nrhs-1)andtrans='N'otherwise. Several right hand side vectorsB(ib:ib+n-1,jb:jb+nrhs-1)band solution vectorsxcan be handled in a single call; when, the solution vectors are stored as the columns of thetrans='N'n-by-nrhsright hand side matrix sub(B) and them-by-nrhsright hand side matrix sub(B) otherwise.
Input Parameters
- trans
- (global) Must be'N', or'T'.If, the linear system involves matrix sub(trans='N'A);If, the linear system involves the transposed matrixtrans='T'A(for real flavors only).T
- m
- (global) The number of rows in the distributed matrix sub (A)(.m≥0)
- n
- (global) The number of columns in the distributed matrix sub (A)(.n≥0)
- nrhs
- (global) The number of right-hand sides; the number of columns in the distributed submatrices sub(B) andX.(.nrhs≥0)
- a
- (local)Pointer into the local memory to an array of size. On entry, contains thelld_a*LOCc(ja+n-1)m-by-nmatrixA.
- ia,ja
- (global) The row and column indices in the global matrixAindicating the first row and the first column of the submatrixA, respectively.
- desca
- (global and local) array of sizedlen_. The array descriptor for the distributed matrixA.
- b
- (local)Pointer into the local memory to an array of local size. On entry, this array contains the local pieces of the distributed matrixlld_b*LOCc(jb+nrhs-1)Bof right-hand side vectors, stored columnwise; sub(B) ism-by-nrhsif, andtrans='N'n-by-nrhsotherwise.
- ib,jb
- (global) The row and column indices in the global matrixBindicating the first row and the first column of the submatrixB, respectively.
- descb
- (global and local) array of sizedlen_. The array descriptor for the distributed matrixB.
- work
- (local)Workspace array with sizelwork.
- lwork
- (local or global) .The size of the arrayworklworkis local input and must be at least, where iflwork≥ltau+max(lwf,lws), thenm>n,ltau=numroc(ja+min(m,n)-1,nb_a,MYCOL,csrc_a,NPCOL)lwf=nb_a*(mpa0 +nqa0 +nb_a)lws=max((nb_a*(nb_a-1))/2, (nrhsqb0 +mpb0)*nb_a) +nb_a*nb_aelse,ltau=numroc(ia+min(m,n)-1,mb_a,MYROW,rsrc_a,NPROW)lwf=mb_a* (mpa0 +nqa0 +mb_a)lws=max((mb_a*(mb_a-1))/2, (npb0 +max(nqa0 +numroc(numroc(n+iroffb,mb_a, 0, 0,NPROW),mb_a, 0, 0,lcmp),nrhsqb0))*mb_a) +mb_a*mb_aend if,where,lcmp=lcm/NPROWwithlcm=ilcm(NPROW,NPCOL),iroffa=mod(ia-1,mb_a),icoffa=mod(ja-1,nb_a),iarow=indxg2p(ia,mb_a,MYROW,rsrc_a,NPROW)iacol=indxg2p(ja,nb_a,MYROW,rsrc_a,NPROW),mpa0 =numroc(m+iroffa,mb_a,MYROW,iarow,NPROW),nqa0 =numroc(n+icoffa,nb_a,MYCOL,iacol,NPCOL),iroffb=mod(ib-1,mb_b),icoffb=mod(jb-1,nb_b),ibrow=indxg2p(ib,mb_b,MYROW,rsrc_b,NPROW),ibcol=indxg2p(jb,nb_b,MYCOL,csrc_b,NPCOL),mpb0 =numroc(m+iroffb,mb_b,MYROW,icrow,NPROW),nqb0 =numroc(n+icoffb,nb_b,MYCOL,ibcol,NPCOL)mod(is the integer remainder ofx,y).x/yilcm,indxg2pandnumrocare ScaLAPACK tool functions;MYROW,MYCOL,NPROW, andNPCOLcan be determined by calling thefunctionblacs_gridinfo.If, thenlwork= -1lworkis global input and a workspace query is assumed; thefunctiononly calculates the minimum and optimal size for all work arrays. Each of these values is returned in the first entry of the corresponding work array, and no error message is issued bypxerbla.
Output Parameters
- a
- b
- On exit, sub(B) is overwritten by the solution vectors, stored columnwise: ifandtrans='N', rows 1 tom≥nnof sub(B) contain the least squares solution vectors; the residual sum of squares for the solution in each column is given by the sum of squares of elementston+1min that column;Ifandtrans='N', rows 1 tom<nnof sub(B) contain the minimum norm solution vectors;Ifandtrans='T', rows 1 tom≥nmof sub(B) contain the minimum norm solution vectors; ifandtrans='T', rows 1 tom<nmof sub(B) contain the least squares solution vectors; the residual sum of squares for the solution in each column is given by the sum of squares of elementstom+1nin that column.
- work[0]
- On exit,work[0]contains the minimum value oflworkrequired for optimum performance.
- info
- (global)= 0: the execution is successful.< 0: if thei-th argument is an array and thej-entry had an illegal value, then, if theinfo= - (i* 100+j)i-th argument is a scalar and had an illegal value, then.info= -i