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