1SGELSS(1) LAPACK driver routine (version 3.1) SGELSS(1)
2
3
4
6 SGELSS - the minimum norm solution to a real linear least squares prob‐
7 lem
8
10 SUBROUTINE SGELSS( M, N, NRHS, A, LDA, B, LDB, S, RCOND, RANK, WORK,
11 LWORK, INFO )
12
13 INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS, RANK
14
15 REAL RCOND
16
17 REAL A( LDA, * ), B( LDB, * ), S( * ), WORK( * )
18
20 SGELSS computes the minimum norm solution to a real linear least
21 squares problem:
22
23 Minimize 2-norm(| b - A*x |).
24
25 using the singular value decomposition (SVD) of A. A is an M-by-N
26 matrix which may be rank-deficient.
27
28 Several right hand side vectors b and solution vectors x can be handled
29 in a single call; they are stored as the columns of the M-by-NRHS right
30 hand side matrix B and the N-by-NRHS solution matrix X.
31
32 The effective rank of A is determined by treating as zero those singu‐
33 lar values which are less than RCOND times the largest singular value.
34
35
37 M (input) INTEGER
38 The number of rows of the matrix A. M >= 0.
39
40 N (input) INTEGER
41 The number of columns of the matrix A. N >= 0.
42
43 NRHS (input) INTEGER
44 The number of right hand sides, i.e., the number of columns of
45 the matrices B and X. NRHS >= 0.
46
47 A (input/output) REAL array, dimension (LDA,N)
48 On entry, the M-by-N matrix A. On exit, the first min(m,n)
49 rows of A are overwritten with its right singular vectors,
50 stored rowwise.
51
52 LDA (input) INTEGER
53 The leading dimension of the array A. LDA >= max(1,M).
54
55 B (input/output) REAL array, dimension (LDB,NRHS)
56 On entry, the M-by-NRHS right hand side matrix B. On exit, B
57 is overwritten by the N-by-NRHS solution matrix X. If m >= n
58 and RANK = n, the residual sum-of-squares for the solution in
59 the i-th column is given by the sum of squares of elements
60 n+1:m in that column.
61
62 LDB (input) INTEGER
63 The leading dimension of the array B. LDB >= max(1,max(M,N)).
64
65 S (output) REAL array, dimension (min(M,N))
66 The singular values of A in decreasing order. The condition
67 number of A in the 2-norm = S(1)/S(min(m,n)).
68
69 RCOND (input) REAL
70 RCOND is used to determine the effective rank of A. Singular
71 values S(i) <= RCOND*S(1) are treated as zero. If RCOND < 0,
72 machine precision is used instead.
73
74 RANK (output) INTEGER
75 The effective rank of A, i.e., the number of singular values
76 which are greater than RCOND*S(1).
77
78 WORK (workspace/output) REAL array, dimension (MAX(1,LWORK))
79 On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
80
81 LWORK (input) INTEGER
82 The dimension of the array WORK. LWORK >= 1, and also: LWORK >=
83 3*min(M,N) + max( 2*min(M,N), max(M,N), NRHS ) For good perfor‐
84 mance, LWORK should generally be larger.
85
86 If LWORK = -1, then a workspace query is assumed; the routine
87 only calculates the optimal size of the WORK array, returns
88 this value as the first entry of the WORK array, and no error
89 message related to LWORK is issued by XERBLA.
90
91 INFO (output) INTEGER
92 = 0: successful exit
93 < 0: if INFO = -i, the i-th argument had an illegal value.
94 > 0: the algorithm for computing the SVD failed to converge;
95 if INFO = i, i off-diagonal elements of an intermediate bidiag‐
96 onal form did not converge to zero.
97
98
99
100 LAPACK driver routine (version 3.N1o)vember 2006 SGELSS(1)