1SGESDD(1) LAPACK driver routine (version 3.1) SGESDD(1)
2
3
4
6 SGESDD - the singular value decomposition (SVD) of a real M-by-N matrix
7 A, optionally computing the left and right singular vectors
8
10 SUBROUTINE SGESDD( JOBZ, M, N, A, LDA, S, U, LDU, VT, LDVT, WORK,
11 LWORK, IWORK, INFO )
12
13 CHARACTER JOBZ
14
15 INTEGER INFO, LDA, LDU, LDVT, LWORK, M, N
16
17 INTEGER IWORK( * )
18
19 REAL A( LDA, * ), S( * ), U( LDU, * ), VT( LDVT, * ),
20 WORK( * )
21
23 SGESDD computes the singular value decomposition (SVD) of a real M-by-N
24 matrix A, optionally computing the left and right singular vectors. If
25 singular vectors are desired, it uses a divide-and-conquer algorithm.
26
27 The SVD is written
28
29 A = U * SIGMA * transpose(V)
30
31 where SIGMA is an M-by-N matrix which is zero except for its min(m,n)
32 diagonal elements, U is an M-by-M orthogonal matrix, and V is an N-by-N
33 orthogonal matrix. The diagonal elements of SIGMA are the singular
34 values of A; they are real and non-negative, and are returned in
35 descending order. The first min(m,n) columns of U and V are the left
36 and right singular vectors of A.
37
38 Note that the routine returns VT = V**T, not V.
39
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
47
49 JOBZ (input) CHARACTER*1
50 Specifies options for computing all or part of the matrix U:
51 = 'A': all M columns of U and all N rows of V**T are returned
52 in the arrays U and VT; = 'S': the first min(M,N) columns of U
53 and the first min(M,N) rows of V**T are returned in the arrays
54 U and VT; = 'O': If M >= N, the first N columns of U are over‐
55 written on the array A and all rows of V**T are returned in the
56 array VT; otherwise, all columns of U are returned in the array
57 U and the first M rows of V**T are overwritten in the array A;
58 = 'N': no columns of U or rows of V**T are computed.
59
60 M (input) INTEGER
61 The number of rows of the input matrix A. M >= 0.
62
63 N (input) INTEGER
64 The number of columns of the input matrix A. N >= 0.
65
66 A (input/output) REAL array, dimension (LDA,N)
67 On entry, the M-by-N matrix A. On exit, if JOBZ = 'O', A is
68 overwritten with the first N columns of U (the left singular
69 vectors, stored columnwise) if M >= N; A is overwritten with
70 the first M rows of V**T (the right singular vectors, stored
71 rowwise) otherwise. if JOBZ .ne. 'O', the contents of A are
72 destroyed.
73
74 LDA (input) INTEGER
75 The leading dimension of the array A. LDA >= max(1,M).
76
77 S (output) REAL array, dimension (min(M,N))
78 The singular values of A, sorted so that S(i) >= S(i+1).
79
80 U (output) REAL array, dimension (LDU,UCOL)
81 UCOL = M if JOBZ = 'A' or JOBZ = 'O' and M < N; UCOL = min(M,N)
82 if JOBZ = 'S'. If JOBZ = 'A' or JOBZ = 'O' and M < N, U con‐
83 tains the M-by-M orthogonal matrix U; if JOBZ = 'S', U contains
84 the first min(M,N) columns of U (the left singular vectors,
85 stored columnwise); if JOBZ = 'O' and M >= N, or JOBZ = 'N', U
86 is not referenced.
87
88 LDU (input) INTEGER
89 The leading dimension of the array U. LDU >= 1; if JOBZ = 'S'
90 or 'A' or JOBZ = 'O' and M < N, LDU >= M.
91
92 VT (output) REAL array, dimension (LDVT,N)
93 If JOBZ = 'A' or JOBZ = 'O' and M >= N, VT contains the N-by-N
94 orthogonal matrix V**T; if JOBZ = 'S', VT contains the first
95 min(M,N) rows of V**T (the right singular vectors, stored row‐
96 wise); if JOBZ = 'O' and M < N, or JOBZ = 'N', VT is not refer‐
97 enced.
98
99 LDVT (input) INTEGER
100 The leading dimension of the array VT. LDVT >= 1; if JOBZ =
101 'A' or JOBZ = 'O' and M >= N, LDVT >= N; if JOBZ = 'S', LDVT >=
102 min(M,N).
103
104 WORK (workspace/output) REAL array, dimension (MAX(1,LWORK))
105 On exit, if INFO = 0, WORK(1) returns the optimal LWORK;
106
107 LWORK (input) INTEGER
108 The dimension of the array WORK. LWORK >= 1. If JOBZ = 'N',
109 LWORK >= 3*min(M,N) + max(max(M,N),6*min(M,N)). If JOBZ = 'O',
110 LWORK >= 3*min(M,N)*min(M,N) +
111 max(max(M,N),5*min(M,N)*min(M,N)+4*min(M,N)). If JOBZ = 'S' or
112 'A' LWORK >= 3*min(M,N)*min(M,N) +
113 max(max(M,N),4*min(M,N)*min(M,N)+4*min(M,N)). For good perfor‐
114 mance, LWORK should generally be larger. If LWORK = -1 but
115 other input arguments are legal, WORK(1) returns the optimal
116 LWORK.
117
118 IWORK (workspace) INTEGER array, dimension (8*min(M,N))
119
120 INFO (output) INTEGER
121 = 0: successful exit.
122 < 0: if INFO = -i, the i-th argument had an illegal value.
123 > 0: SBDSDC did not converge, updating process failed.
124
126 Based on contributions by
127 Ming Gu and Huan Ren, Computer Science Division, University of
128 California at Berkeley, USA
129
130
131
132
133 LAPACK driver routine (version 3.N1o)vember 2006 SGESDD(1)