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