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