1SGELSD(1)             LAPACK driver routine (version 3.1)            SGELSD(1)
2
3
4

NAME

6       SGELSD - the minimum-norm solution to a real linear least squares prob‐
7       lem
8

SYNOPSIS

10       SUBROUTINE SGELSD( 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           REAL           RCOND
16
17           INTEGER        IWORK( * )
18
19           REAL           A( LDA, * ), B( LDB, * ), S( * ), WORK( * )
20

PURPOSE

22       SGELSD  computes  the  minimum-norm  solution  to  a  real linear least
23       squares problem:
24           minimize 2-norm(| b - A*x |)
25       using the singular value decomposition (SVD)  of  A.  A  is  an  M-by-N
26       matrix 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 problem is solved in three steps:
33       (1) Reduce the coefficient matrix A to bidiagonal form with
34           Householder transformations, reducing the original problem
35           into a "bidiagonal least squares problem" (BLS)
36       (2) Solve the BLS using a divide and conquer approach.
37       (3) Apply back all the Householder tranformations to solve
38           the original least squares problem.
39
40       The  effective rank of A is determined by treating as zero those singu‐
41       lar values which are less than RCOND times the largest singular value.
42
43       The divide and conquer algorithm  makes  very  mild  assumptions  about
44       floating  point arithmetic. It will work on machines with a guard digit
45       in add/subtract, or on those binary machines without guard digits which
46       subtract  like the Cray X-MP, Cray Y-MP, Cray C-90, or Cray-2. It could
47       conceivably fail on hexadecimal or decimal machines without guard  dig‐
48       its, but we know of none.
49
50

ARGUMENTS

52       M       (input) INTEGER
53               The number of rows of A. M >= 0.
54
55       N       (input) INTEGER
56               The number of columns of A. N >= 0.
57
58       NRHS    (input) INTEGER
59               The  number of right hand sides, i.e., the number of columns of
60               the matrices B and X. NRHS >= 0.
61
62       A       (input) REAL array, dimension (LDA,N)
63               On entry, the M-by-N matrix A.  On exit, A has been destroyed.
64
65       LDA     (input) INTEGER
66               The leading dimension of the array A.  LDA >= max(1,M).
67
68       B       (input/output) REAL array, dimension (LDB,NRHS)
69               On entry, the M-by-NRHS right hand side matrix B.  On  exit,  B
70               is  overwritten  by the N-by-NRHS solution matrix X.  If m >= n
71               and RANK = n, the residual sum-of-squares for the  solution  in
72               the  i-th  column  is  given  by the sum of squares of elements
73               n+1:m in that column.
74
75       LDB     (input) INTEGER
76               The leading dimension of the array B. LDB >= max(1,max(M,N)).
77
78       S       (output) REAL array, dimension (min(M,N))
79               The singular values of A in decreasing  order.   The  condition
80               number of A in the 2-norm = S(1)/S(min(m,n)).
81
82       RCOND   (input) REAL
83               RCOND  is  used to determine the effective rank of A.  Singular
84               values S(i) <= RCOND*S(1) are treated as zero.  If RCOND  <  0,
85               machine precision is used instead.
86
87       RANK    (output) INTEGER
88               The  effective  rank  of A, i.e., the number of singular values
89               which are greater than RCOND*S(1).
90
91       WORK    (workspace/output) REAL array, dimension (MAX(1,LWORK))
92               On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
93
94       LWORK   (input) INTEGER
95               The dimension of the array WORK. LWORK must be at least 1.  The
96               exact  minimum  amount  of workspace needed depends on M, N and
97               NRHS. As long as LWORK is at least 12*N + 2*N*SMLSIZ + 8*N*NLVL
98               + N*NRHS + (SMLSIZ+1)**2, if M is greater than or equal to N or
99               12*M + 2*M*SMLSIZ + 8*M*NLVL + M*NRHS + (SMLSIZ+1)**2, if M  is
100               less  than  N,  the  code  will  execute  correctly.  SMLSIZ is
101               returned by ILAENV and is equal to the maximum size of the sub‐
102               problems  at  the bottom of the computation tree (usually about
103               25), and NLVL = MAX( 0, INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) +
104               1 ) For good performance, LWORK should generally be larger.
105
106               If  LWORK  = -1, then a workspace query is assumed; the routine
107               only calculates the optimal size of the array WORK and the min‐
108               imum  size  of the array IWORK, and returns these values as the
109               first entries of the WORK and IWORK arrays, and no  error  mes‐
110               sage related to LWORK is issued by XERBLA.
111
112       IWORK   (workspace) INTEGER array, dimension (MAX(1,LIWORK))
113               LIWORK  >=  max(1, 3*MINMN*NLVL + 11*MINMN), where MINMN = MIN(
114               M,N ).  On exit, if INFO =  0,  IWORK(1)  returns  the  minimum
115               LIWORK.
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

FURTHER DETAILS

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                       SGELSD(1)
Impressum