gelss#

Functions

void sgelss(
    const INT           m,
    const INT           n,
    const INT           nrhs,
          f32* restrict A,
    const INT           lda,
          f32* restrict B,
    const INT           ldb,
          f32* restrict S,
    const f32           rcond,
          INT*          rank,
          f32* restrict work,
    const INT           lwork,
          INT*          info
);
void sgelss(const INT m, const INT n, const INT nrhs, f32 *restrict A, const INT lda, f32 *restrict B, const INT ldb, f32 *restrict S, const f32 rcond, INT *rank, f32 *restrict work, const INT lwork, INT *info)#

SGELSS computes the minimum norm solution to a real linear least squares problem:

Minimize 2-norm(| b - A*x |).
using the singular value decomposition (SVD) 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 effective rank of A is determined by treating as zero those singular values which are less than RCOND times the largest singular value.

Parameters

in
m

The number of rows of the matrix A. m >= 0.

in
n

The number of columns of the matrix A. n >= 0.

in
nrhs

The number of right hand sides. nrhs >= 0.

inout
A

Double precision array, dimension (lda, n). On entry, the M-by-N matrix A. On exit, the first min(m,n) rows of A are overwritten with its right singular vectors, stored rowwise.

in
lda

The leading dimension of A. lda >= max(1, m).

inout
B

Double precision array, dimension (ldb, nrhs). On entry, the M-by-NRHS right hand side matrix B. On exit, B is overwritten by the N-by-NRHS solution matrix X. If m >= n and RANK = n, the residual sum-of-squares for the solution in the i-th column is given by the sum of squares of elements n+1:m in that column.

in
ldb

The leading dimension of B. ldb >= max(1, max(m, n)).

out
S

Double precision array, dimension (min(m, n)). The singular values of A in decreasing order. The condition number of A in the 2-norm = S(1)/S(min(m,n)).

in
rcond

RCOND is used to determine the effective rank of A. Singular values S(i) <= RCOND*S(1) are treated as zero. If RCOND < 0, machine precision is used instead.

out
rank

The effective rank of A, i.e., the number of singular values which are greater than RCOND*S(1).

out
work

Double precision array, dimension (max(1, lwork)). On exit, if info = 0, work[0] returns the optimal lwork.

in
lwork

The dimension of work. lwork >= 1, and also: lwork >= 3*min(m,n) + max(2*min(m,n), max(m,n), nrhs). For good performance, lwork should generally be larger. If lwork = -1, a workspace query is assumed.

out
info

  • = 0: successful exit

  • < 0: if info = -i, the i-th argument had an illegal value

  • > 0: the algorithm for computing the SVD failed to converge; if info = i, i off-diagonal elements of an intermediate bidiagonal form did not converge to zero.

Functions

void dgelss(
    const INT           m,
    const INT           n,
    const INT           nrhs,
          f64* restrict A,
    const INT           lda,
          f64* restrict B,
    const INT           ldb,
          f64* restrict S,
    const f64           rcond,
          INT*          rank,
          f64* restrict work,
    const INT           lwork,
          INT*          info
);
void dgelss(const INT m, const INT n, const INT nrhs, f64 *restrict A, const INT lda, f64 *restrict B, const INT ldb, f64 *restrict S, const f64 rcond, INT *rank, f64 *restrict work, const INT lwork, INT *info)#

DGELSS computes the minimum norm solution to a real linear least squares problem:

Minimize 2-norm(| b - A*x |).
using the singular value decomposition (SVD) 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 effective rank of A is determined by treating as zero those singular values which are less than RCOND times the largest singular value.

Parameters

in
m

The number of rows of the matrix A. m >= 0.

in
n

The number of columns of the matrix A. n >= 0.

in
nrhs

The number of right hand sides. nrhs >= 0.

inout
A

Double precision array, dimension (lda, n). On entry, the M-by-N matrix A. On exit, the first min(m,n) rows of A are overwritten with its right singular vectors, stored rowwise.

in
lda

The leading dimension of A. lda >= max(1, m).

inout
B

Double precision array, dimension (ldb, nrhs). On entry, the M-by-NRHS right hand side matrix B. On exit, B is overwritten by the N-by-NRHS solution matrix X. If m >= n and RANK = n, the residual sum-of-squares for the solution in the i-th column is given by the sum of squares of elements n+1:m in that column.

in
ldb

The leading dimension of B. ldb >= max(1, max(m, n)).

out
S

Double precision array, dimension (min(m, n)). The singular values of A in decreasing order. The condition number of A in the 2-norm = S(1)/S(min(m,n)).

in
rcond

RCOND is used to determine the effective rank of A. Singular values S(i) <= RCOND*S(1) are treated as zero. If RCOND < 0, machine precision is used instead.

out
rank

The effective rank of A, i.e., the number of singular values which are greater than RCOND*S(1).

out
work

Double precision array, dimension (max(1, lwork)). On exit, if info = 0, work[0] returns the optimal lwork.

in
lwork

The dimension of work. lwork >= 1, and also: lwork >= 3*min(m,n) + max(2*min(m,n), max(m,n), nrhs). For good performance, lwork should generally be larger. If lwork = -1, a workspace query is assumed.

out
info

  • = 0: successful exit

  • < 0: if info = -i, the i-th argument had an illegal value

  • > 0: the algorithm for computing the SVD failed to converge; if info = i, i off-diagonal elements of an intermediate bidiagonal form did not converge to zero.

Functions

void cgelss(
    const INT           m,
    const INT           n,
    const INT           nrhs,
          c64* restrict A,
    const INT           lda,
          c64* restrict B,
    const INT           ldb,
          f32* restrict S,
    const f32           rcond,
          INT*          rank,
          c64* restrict work,
    const INT           lwork,
          f32* restrict rwork,
          INT*          info
);
void cgelss(const INT m, const INT n, const INT nrhs, c64 *restrict A, const INT lda, c64 *restrict B, const INT ldb, f32 *restrict S, const f32 rcond, INT *rank, c64 *restrict work, const INT lwork, f32 *restrict rwork, INT *info)#

CGELSS computes the minimum norm solution to a complex linear least squares problem:

Minimize 2-norm(| b - A*x |).
using the singular value decomposition (SVD) 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 effective rank of A is determined by treating as zero those singular values which are less than RCOND times the largest singular value.

Parameters

in
m

The number of rows of the matrix A. m >= 0.

in
n

The number of columns of the matrix A. n >= 0.

in
nrhs

The number of right hand sides. nrhs >= 0.

inout
A

Complex*16 array, dimension (lda, n). On entry, the M-by-N matrix A. On exit, the first min(m,n) rows of A are overwritten with its right singular vectors, stored rowwise.

in
lda

The leading dimension of A. lda >= max(1, m).

inout
B

Complex*16 array, dimension (ldb, nrhs). On entry, the M-by-NRHS right hand side matrix B. On exit, B is overwritten by the N-by-NRHS solution matrix X.

in
ldb

The leading dimension of B. ldb >= max(1, max(m, n)).

out
S

Single precision array, dimension (min(m, n)). The singular values of A in decreasing order.

in
rcond

RCOND is used to determine the effective rank of A. Singular values S(i) <= RCOND*S(1) are treated as zero. If RCOND < 0, machine precision is used instead.

out
rank

The effective rank of A.

out
work

Complex*16 array, dimension (max(1, lwork)). On exit, if info = 0, work[0] returns the optimal lwork.

in
lwork

The dimension of work. lwork >= 1, and also: lwork >= 2*min(m,n) + max(m,n,nrhs). If lwork = -1, a workspace query is assumed.

out
rwork

Single precision array, dimension (5*min(m,n)).

out
info

  • = 0: successful exit

  • < 0: if info = -i, the i-th argument had an illegal value

  • > 0: the algorithm for computing the SVD failed to converge; if info = i, i off-diagonal elements of an intermediate bidiagonal form did not converge to zero.

Functions

void zgelss(
    const INT            m,
    const INT            n,
    const INT            nrhs,
          c128* restrict A,
    const INT            lda,
          c128* restrict B,
    const INT            ldb,
          f64*  restrict S,
    const f64            rcond,
          INT*           rank,
          c128* restrict work,
    const INT            lwork,
          f64*  restrict rwork,
          INT*           info
);
void zgelss(const INT m, const INT n, const INT nrhs, c128 *restrict A, const INT lda, c128 *restrict B, const INT ldb, f64 *restrict S, const f64 rcond, INT *rank, c128 *restrict work, const INT lwork, f64 *restrict rwork, INT *info)#

ZGELSS computes the minimum norm solution to a complex linear least squares problem:

Minimize 2-norm(| b - A*x |).
using the singular value decomposition (SVD) 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 effective rank of A is determined by treating as zero those singular values which are less than RCOND times the largest singular value.

Parameters

in
m

The number of rows of the matrix A. m >= 0.

in
n

The number of columns of the matrix A. n >= 0.

in
nrhs

The number of right hand sides. nrhs >= 0.

inout
A

Complex*16 array, dimension (lda, n). On entry, the M-by-N matrix A. On exit, the first min(m,n) rows of A are overwritten with its right singular vectors, stored rowwise.

in
lda

The leading dimension of A. lda >= max(1, m).

inout
B

Complex*16 array, dimension (ldb, nrhs). On entry, the M-by-NRHS right hand side matrix B. On exit, B is overwritten by the N-by-NRHS solution matrix X.

in
ldb

The leading dimension of B. ldb >= max(1, max(m, n)).

out
S

Double precision array, dimension (min(m, n)). The singular values of A in decreasing order.

in
rcond

RCOND is used to determine the effective rank of A. Singular values S(i) <= RCOND*S(1) are treated as zero. If RCOND < 0, machine precision is used instead.

out
rank

The effective rank of A.

out
work

Complex*16 array, dimension (max(1, lwork)). On exit, if info = 0, work[0] returns the optimal lwork.

in
lwork

The dimension of work. lwork >= 1, and also: lwork >= 2*min(m,n) + max(m,n,nrhs). If lwork = -1, a workspace query is assumed.

out
rwork

Double precision array, dimension (5*min(m,n)).

out
info

  • = 0: successful exit

  • < 0: if info = -i, the i-th argument had an illegal value

  • > 0: the algorithm for computing the SVD failed to converge; if info = i, i off-diagonal elements of an intermediate bidiagonal form did not converge to zero.