1DGELSD(1) LAPACK driver routine (version 3.1) DGELSD(1)
2
3
4
6 DGELSD - the minimum-norm solution to a real linear least squares prob‐
7 lem
8
10 SUBROUTINE DGELSD( M, N, NRHS, A, LDA, B, LDB, S, RCOND, RANK, WORK,
11 LWORK, IWORK, INFO )
12
13 INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS, RANK
14
15 DOUBLE PRECISION RCOND
16
17 INTEGER IWORK( * )
18
19 DOUBLE PRECISION A( LDA, * ), B( LDB, * ), S( * ), WORK( *
20 )
21
23 DGELSD computes the minimum-norm solution to a real linear least
24 squares problem:
25 minimize 2-norm(| b - A*x |)
26 using the singular value decomposition (SVD) of A. A is an M-by-N
27 matrix which may be rank-deficient.
28
29 Several right hand side vectors b and solution vectors x can be handled
30 in a single call; they are stored as the columns of the M-by-NRHS right
31 hand side matrix B and the N-by-NRHS solution matrix X.
32
33 The problem is solved in three steps:
34 (1) Reduce the coefficient matrix A to bidiagonal form with
35 Householder transformations, reducing the original problem
36 into a "bidiagonal least squares problem" (BLS)
37 (2) Solve the BLS using a divide and conquer approach.
38 (3) Apply back all the Householder tranformations to solve
39 the original least squares problem.
40
41 The effective rank of A is determined by treating as zero those singu‐
42 lar values which are less than RCOND times the largest singular value.
43
44 The divide and conquer algorithm makes very mild assumptions about
45 floating point arithmetic. It will work on machines with a guard digit
46 in add/subtract, or on those binary machines without guard digits which
47 subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or Cray-2. It could
48 conceivably fail on hexadecimal or decimal machines without guard dig‐
49 its, but we know of none.
50
51
53 M (input) INTEGER
54 The number of rows of A. M >= 0.
55
56 N (input) INTEGER
57 The number of columns of A. N >= 0.
58
59 NRHS (input) INTEGER
60 The number of right hand sides, i.e., the number of columns of
61 the matrices B and X. NRHS >= 0.
62
63 A (input) DOUBLE PRECISION array, dimension (LDA,N)
64 On entry, the M-by-N matrix A. On exit, A has been destroyed.
65
66 LDA (input) INTEGER
67 The leading dimension of the array A. LDA >= max(1,M).
68
69 B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
70 On entry, the M-by-NRHS right hand side matrix B. On exit, B
71 is overwritten by the N-by-NRHS solution matrix X. If m >= n
72 and RANK = n, the residual sum-of-squares for the solution in
73 the i-th column is given by the sum of squares of elements
74 n+1:m in that column.
75
76 LDB (input) INTEGER
77 The leading dimension of the array B. LDB >= max(1,max(M,N)).
78
79 S (output) DOUBLE PRECISION array, dimension (min(M,N))
80 The singular values of A in decreasing order. The condition
81 number of A in the 2-norm = S(1)/S(min(m,n)).
82
83 RCOND (input) DOUBLE PRECISION
84 RCOND is used to determine the effective rank of A. Singular
85 values S(i) <= RCOND*S(1) are treated as zero. If RCOND < 0,
86 machine precision is used instead.
87
88 RANK (output) INTEGER
89 The effective rank of A, i.e., the number of singular values
90 which are greater than RCOND*S(1).
91
92 WORK (workspace/output) DOUBLE PRECISION array, dimension
93 (MAX(1,LWORK))
94 On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
95
96 LWORK (input) INTEGER
97 The dimension of the array WORK. LWORK must be at least 1. The
98 exact minimum amount of workspace needed depends on M, N and
99 NRHS. As long as LWORK is at least 12*N + 2*N*SMLSIZ + 8*N*NLVL
100 + N*NRHS + (SMLSIZ+1)**2, if M is greater than or equal to N or
101 12*M + 2*M*SMLSIZ + 8*M*NLVL + M*NRHS + (SMLSIZ+1)**2, if M is
102 less than N, the code will execute correctly. SMLSIZ is
103 returned by ILAENV and is equal to the maximum size of the sub‐
104 problems at the bottom of the computation tree (usually about
105 25), and NLVL = MAX( 0, INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) +
106 1 ) For good performance, LWORK should generally be larger.
107
108 If LWORK = -1, then a workspace query is assumed; the routine
109 only calculates the optimal size of the WORK array, returns
110 this value as the first entry of the WORK array, and no error
111 message related to LWORK is issued by XERBLA.
112
113 IWORK (workspace) INTEGER array, dimension (MAX(1,LIWORK))
114 LIWORK >= 3 * MINMN * NLVL + 11 * MINMN, where MINMN = MIN( M,N
115 ).
116
117 INFO (output) INTEGER
118 = 0: successful exit
119 < 0: if INFO = -i, the i-th argument had an illegal value.
120 > 0: the algorithm for computing the SVD failed to converge;
121 if INFO = i, i off-diagonal elements of an intermediate bidiag‐
122 onal form did not converge to zero.
123
125 Based on contributions by
126 Ming Gu and Ren-Cang Li, Computer Science Division, University of
127 California at Berkeley, USA
128 Osni Marques, LBNL/NERSC, USA
129
130
131
132
133 LAPACK driver routine (version 3.N1o)vember 2006 DGELSD(1)