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

NAME

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

ARGUMENTS

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

FURTHER DETAILS

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