?gelsy
?gelsy
Computes the minimum-norm solution to a linear least squares problem using a complete orthogonal factorization of A.
Syntax
lapack_int LAPACKE_sgelsy
(
int
matrix_layout
,
lapack_int
m
,
lapack_int
n
,
lapack_int
nrhs
,
float*
a
,
lapack_int
lda
,
float*
b
,
lapack_int
ldb
,
lapack_int*
jpvt
,
float
rcond
,
lapack_int*
rank
);
lapack_int LAPACKE_dgelsy
(
int
matrix_layout
,
lapack_int
m
,
lapack_int
n
,
lapack_int
nrhs
,
double*
a
,
lapack_int
lda
,
double*
b
,
lapack_int
ldb
,
lapack_int*
jpvt
,
double
rcond
,
lapack_int*
rank
);
lapack_int LAPACKE_cgelsy
(
int
matrix_layout
,
lapack_int
m
,
lapack_int
n
,
lapack_int
nrhs
,
lapack_complex_float*
a
,
lapack_int
lda
,
lapack_complex_float*
b
,
lapack_int
ldb
,
lapack_int*
jpvt
,
float
rcond
,
lapack_int*
rank
);
lapack_int LAPACKE_zgelsy
(
int
matrix_layout
,
lapack_int
m
,
lapack_int
n
,
lapack_int
nrhs
,
lapack_complex_double*
a
,
lapack_int
lda
,
lapack_complex_double*
b
,
lapack_int
ldb
,
lapack_int*
jpvt
,
double
rcond
,
lapack_int*
rank
);
Include Files
- mkl.h
Description
The
?gelsy
routine computes the minimum-norm solution to a real/complex linear least squares problem:minimize ||
b
- A
*x
||2
using a complete orthogonal factorization of
A
. A
is an m
-by-n
matrix which may be rank-deficient. Several right hand side vectors b
and solution vectors x
can be handled in a single call; they are stored as the columns of the m
-by-nrhs
right hand side matrix B
and the n
-by-nrhs
solution matrix X
.The routine first computes a
QR
factorization with column pivoting:
with
R
11
defined as the largest leading submatrix whose estimated condition number is less than 1/rcond
. The order of R
11
, rank
, is the effective rank of A
. Then, R
22
is considered to be negligible, and R
12
is annihilated by orthogonal/unitary transformations from the right, arriving at the complete orthogonal factorization:
The minimum-norm solution is then


where
Q
1
consists of the first rank
columns of Q
. The
?gelsy
routine is identical to the original deprecated ?gelsx
routine except for the following differences:- The call to the subroutine?geqpfhas been substituted by the call to the subroutine?geqp3, which is a BLAS-3 version of theQRfactorization with column pivoting.
- The matrixB(the right hand side) is updated with BLAS-3.
- The permutation of the matrixB(the right hand side) is faster and more simple.
Input Parameters
- matrix_layout
- Specifies whether matrix storage layout is row major (LAPACK_ROW_MAJOR) or column major (LAPACK_COL_MAJOR).
- m
- The number of rows of the matrixA().m≥0
- n
- The number of columns of the matrixA().n≥0
- nrhs
- The number of right-hand sides; the number of columns inB().nrhs≥0
- a,b
- Arrays:a(size max(1,contains thelda*n) for column major layout and max(1,lda*m) for row major layout)m-by-nmatrixA.b(size max(1,contains theldb*nrhs) for column major layout and max(1,ldb*max(m,n)) for row major layout)m-by-nrhsright hand side matrixB.
- lda
- The leading dimension ofa; at least max(1,m)for column major layout and max(1,.n) for row major layout
- ldb
- The leading dimension ofb; must be at least max(1,m,n)for column major layout and at least max(1,.nrhs) for row major layout
- jpvt
- Array, size at least max(1,n).On entry, ifjpvt[i- 1]≠0, thei-th column ofAis permuted to the front ofAP, otherwise thei-th column ofAis a free column.
- rcond
- rcondis used to determine the effective rank ofA, which is defined as the order of the largest leading triangular submatrixR11in theQRfactorization with pivoting ofA, whose estimated condition number < 1/rcond.
Output Parameters
- a
- On exit, overwritten by the details of the complete orthogonal factorization ofA.
- b
- Overwritten by then-by-nrhssolution matrixX.
- jpvt
- On exit, ifjpvt[=i- 1]k, then thei-th column ofAPwas thek-th column ofA.
- rank
- The effective rank ofA, that is, the order of the submatrixR11. This is the same as the order of the submatrixT11in the complete orthogonal factorization ofA.
Return Values
This function returns a value
info
.If , the execution is successful.
info
=0If , the
info
= -i
i
-th parameter had an illegal value.