Computes the minimum-norm solution to a linear least squares problem using the singular value decomposition of A.
FORTRAN 77:
call sgelss(m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, info)
call dgelss(m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, info)
call cgelss(m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, rwork, info)
call zgelss(m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, rwork, info)
Fortran 95:
call gelss(a, b [,rank] [,s] [,rcond] [,info])
C:
lapack_int LAPACKE_sgelss( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, float* a, lapack_int lda, float* b, lapack_int ldb, float* s, float rcond, lapack_int* rank );
lapack_int LAPACKE_dgelss( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, double* a, lapack_int lda, double* b, lapack_int ldb, double* s, double rcond, lapack_int* rank );
lapack_int LAPACKE_cgelss( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float* s, float rcond, lapack_int* rank );
lapack_int LAPACKE_zgelss( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, double* s, double rcond, lapack_int* rank );
The FORTRAN 77 interfaces are specified in the mkl_lapack.fi and mkl_lapack.h include files, the Fortran 95 interfaces are specified in the lapack.f90 include file, and the C interfaces are specified in the mkl_lapacke.h include file.
The routine computes the minimum norm solution to a real linear least squares problem:
minimize ||b - A*x||2
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.
The data types are given for the Fortran interface. A <datatype> placeholder, if present, is used for the C interface data types in the C interface section above. See C Interface Conventions for the C interface principal conventions and type definitions.
INTEGER. The number of rows of the matrix A (m ≥ 0).
INTEGER. The number of columns of the matrix A
(n ≥ 0).
INTEGER. The number of right-hand sides; the number of columns in B
(nrhs ≥ 0).
REAL for sgelss
DOUBLE PRECISION for dgelss
COMPLEX for cgelss
DOUBLE COMPLEX for zgelss.
Arrays:
a(lda,*) contains the m-by-n matrix A.
The second dimension of a must be at least max(1, n).
b(ldb,*) contains the m-by-nrhs right hand side matrix B.
The second dimension of b must be at least max(1, nrhs).
work is a workspace array, its dimension max(1, lwork).
INTEGER. The leading dimension of a; at least max(1, m).
INTEGER. The leading dimension of b; must be at least max(1, m, n).
REAL for single-precision flavors
DOUBLE PRECISION for double-precision flavors.
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.
INTEGER. The size of the work array; lwork≥ 1.
If lwork = -1, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued by xerbla.
See Application Notes for the suggested value of lwork.
REAL for cgelss
DOUBLE PRECISION for zgelss.
Workspace array used in complex flavors only. DIMENSION at least max(1, 5*min(m, n)).
On exit, the first min(m, n) rows of A are overwritten with its right singular vectors, stored row-wise.
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 modulus of elements n+1:m in that column.
REAL for single precision flavors
DOUBLE PRECISION for double precision flavors.
Array, DIMENSION at least max(1, min(m, n)). The singular values of A in decreasing order. The condition number of A in the 2-norm is
k2(A) = s(1)/ s(min(m, n)) .
INTEGER. The effective rank of A, that is, the number of singular values which are greater than rcond *s(1).
If info = 0, on exit, work(1) contains the minimum value of lwork required for optimum performance. Use this lwork for subsequent runs.
INTEGER.
If info = 0, the execution is successful.
If info = -i, the i-th parameter had an illegal value.
If info = i, then the algorithm for computing the SVD failed to converge; i indicates the number of off-diagonal elements of an intermediate bidiagonal form which did not converge to zero.
Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or restorable arguments, see Fortran 95 Interface Conventions.
Specific details for the routine gelss interface are the following:
Holds the matrix A of size (m,n).
Holds the matrix of size max(m,n)-by-nrhs. On entry, contains the m-by-nrhs right hand side matrix B, On exit, overwritten by the n-by-nrhs solution matrix X.
Holds the vector of length min(m,n).
Default value for this element is rcond = 100*EPSILON(1.0_WP).
For real flavors:
lwork ≥ 3*min(m, n)+ max( 2*min(m, n), max(m, n), nrhs)
For complex flavors:
lwork ≥ 2*min(m, n)+ max(m, n, nrhs)
For good performance, lwork should generally be larger.
If you are in doubt how much workspace to supply, use a generous value of lwork for the first run or set lwork = -1.
If you choose the first option and set any of admissible lwork sizes, which is no less than the minimal value described, the routine completes the task, though probably not so fast as with a recommended workspace, and provides the recommended workspace in the first element of the corresponding array work on exit. Use this value (work(1)) for subsequent runs.
If you set lwork = -1, the routine returns immediately and provides the recommended workspace in the first element of the corresponding array (work). This operation is called a workspace query.
Note that if you set lwork to less than the minimal required value and not -1, the routine returns immediately with an error exit and does not provide any information on the recommended workspace.
Copyright © 1994 - 2011, Intel Corporation. All rights reserved.