1SGELSY(1) LAPACK driver routine (version 3.1) SGELSY(1)
2
3
4
6 SGELSY - the minimum-norm solution to a real linear least squares prob‐
7 lem
8
10 SUBROUTINE SGELSY( M, N, NRHS, A, LDA, B, LDB, JPVT, RCOND, RANK, WORK,
11 LWORK, INFO )
12
13 INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS, RANK
14
15 REAL RCOND
16
17 INTEGER JPVT( * )
18
19 REAL A( LDA, * ), B( LDB, * ), WORK( * )
20
22 SGELSY computes the minimum-norm solution to a real linear least
23 squares problem:
24 minimize || A * X - B ||
25 using a complete orthogonal factorization of A. A is an M-by-N matrix
26 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 routine first computes a QR factorization with column pivoting:
33 A * P = Q * [ R11 R12 ]
34 [ 0 R22 ]
35 with R11 defined as the largest leading submatrix whose estimated con‐
36 dition number is less than 1/RCOND. The order of R11, RANK, is the
37 effective rank of A.
38
39 Then, R22 is considered to be negligible, and R12 is annihilated by
40 orthogonal transformations from the right, arriving at the complete
41 orthogonal factorization:
42 A * P = Q * [ T11 0 ] * Z
43 [ 0 0 ]
44 The minimum-norm solution is then
45 X = P * Z' [ inv(T11)*Q1'*B ]
46 [ 0 ]
47 where Q1 consists of the first RANK columns of Q.
48
49 This routine is basically identical to the original xGELSX except three
50 differences:
51 o The call to the subroutine xGEQPF has been substituted by the
52 the call to the subroutine xGEQP3. This subroutine is a Blas-3
53 version of the QR factorization with column pivoting.
54 o Matrix B (the right hand side) is updated with Blas-3.
55 o The permutation of matrix B (the right hand side) is faster and
56 more simple.
57
58
60 M (input) INTEGER
61 The number of rows of the matrix A. M >= 0.
62
63 N (input) INTEGER
64 The number of columns of the matrix A. N >= 0.
65
66 NRHS (input) INTEGER
67 The number of right hand sides, i.e., the number of columns of
68 matrices B and X. NRHS >= 0.
69
70 A (input/output) REAL array, dimension (LDA,N)
71 On entry, the M-by-N matrix A. On exit, A has been overwritten
72 by details of its complete orthogonal factorization.
73
74 LDA (input) INTEGER
75 The leading dimension of the array A. LDA >= max(1,M).
76
77 B (input/output) REAL array, dimension (LDB,NRHS)
78 On entry, the M-by-NRHS right hand side matrix B. On exit, the
79 N-by-NRHS solution matrix X.
80
81 LDB (input) INTEGER
82 The leading dimension of the array B. LDB >= max(1,M,N).
83
84 JPVT (input/output) INTEGER array, dimension (N)
85 On entry, if JPVT(i) .ne. 0, the i-th column of A is permuted
86 to the front of AP, otherwise column i is a free column. On
87 exit, if JPVT(i) = k, then the i-th column of AP was the k-th
88 column of A.
89
90 RCOND (input) REAL
91 RCOND is used to determine the effective rank of A, which is
92 defined as the order of the largest leading triangular subma‐
93 trix R11 in the QR factorization with pivoting of A, whose
94 estimated condition number < 1/RCOND.
95
96 RANK (output) INTEGER
97 The effective rank of A, i.e., the order of the submatrix R11.
98 This is the same as the order of the submatrix T11 in the com‐
99 plete orthogonal factorization of A.
100
101 WORK (workspace/output) REAL array, dimension (MAX(1,LWORK))
102 On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
103
104 LWORK (input) INTEGER
105 The dimension of the array WORK. The unblocked strategy
106 requires that: LWORK >= MAX( MN+3*N+1, 2*MN+NRHS ), where MN =
107 min( M, N ). The block algorithm requires that: LWORK >= MAX(
108 MN+2*N+NB*(N+1), 2*MN+NB*NRHS ), where NB is an upper bound on
109 the blocksize returned by ILAENV for the routines SGEQP3,
110 STZRZF, STZRQF, SORMQR, and SORMRZ.
111
112 If LWORK = -1, then a workspace query is assumed; the routine
113 only calculates the optimal size of the WORK array, returns
114 this value as the first entry of the WORK array, and no error
115 message related to LWORK is issued by XERBLA.
116
117 INFO (output) INTEGER
118 = 0: successful exit
119 < 0: If INFO = -i, the i-th argument had an illegal value.
120
122 Based on contributions by
123 A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
124 E. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain
125 G. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain
126
127
128
129
130 LAPACK driver routine (version 3.N1o)vember 2006 SGELSY(1)