1SGESVD(1) LAPACK driver routine (version 3.1) SGESVD(1)
2
3
4
6 SGESVD - the singular value decomposition (SVD) of a real M-by-N matrix
7 A, optionally computing the left and/or right singular vectors
8
10 SUBROUTINE SGESVD( JOBU, JOBVT, M, N, A, LDA, S, U, LDU, VT, LDVT,
11 WORK, LWORK, INFO )
12
13 CHARACTER JOBU, JOBVT
14
15 INTEGER INFO, LDA, LDU, LDVT, LWORK, M, N
16
17 REAL A( LDA, * ), S( * ), U( LDU, * ), VT( LDVT, * ),
18 WORK( * )
19
21 SGESVD computes the singular value decomposition (SVD) of a real M-by-N
22 matrix A, optionally computing the left and/or right singular vectors.
23 The SVD is written
24
25 A = U * SIGMA * transpose(V)
26
27 where SIGMA is an M-by-N matrix which is zero except for its min(m,n)
28 diagonal elements, U is an M-by-M orthogonal matrix, and V is an N-by-N
29 orthogonal matrix. The diagonal elements of SIGMA are the singular
30 values of A; they are real and non-negative, and are returned in
31 descending order. The first min(m,n) columns of U and V are the left
32 and right singular vectors of A.
33
34 Note that the routine returns V**T, not V.
35
36
38 JOBU (input) CHARACTER*1
39 Specifies options for computing all or part of the matrix U:
40 = 'A': all M columns of U are returned in array U:
41 = 'S': the first min(m,n) columns of U (the left singular vec‐
42 tors) are returned in the array U; = 'O': the first min(m,n)
43 columns of U (the left singular vectors) are overwritten on the
44 array A; = 'N': no columns of U (no left singular vectors) are
45 computed.
46
47 JOBVT (input) CHARACTER*1
48 Specifies options for computing all or part of the matrix V**T:
49 = 'A': all N rows of V**T are returned in the array VT;
50 = 'S': the first min(m,n) rows of V**T (the right singular
51 vectors) are returned in the array VT; = 'O': the first
52 min(m,n) rows of V**T (the right singular vectors) are over‐
53 written on the array A; = 'N': no rows of V**T (no right sin‐
54 gular vectors) are computed.
55
56 JOBVT and JOBU cannot both be 'O'.
57
58 M (input) INTEGER
59 The number of rows of the input matrix A. M >= 0.
60
61 N (input) INTEGER
62 The number of columns of the input matrix A. N >= 0.
63
64 A (input/output) REAL array, dimension (LDA,N)
65 On entry, the M-by-N matrix A. On exit, if JOBU = 'O', A is
66 overwritten with the first min(m,n) columns of U (the left sin‐
67 gular vectors, stored columnwise); if JOBVT = 'O', A is over‐
68 written with the first min(m,n) rows of V**T (the right singu‐
69 lar vectors, stored rowwise); if JOBU .ne. 'O' and JOBVT .ne.
70 'O', the contents of A are destroyed.
71
72 LDA (input) INTEGER
73 The leading dimension of the array A. LDA >= max(1,M).
74
75 S (output) REAL array, dimension (min(M,N))
76 The singular values of A, sorted so that S(i) >= S(i+1).
77
78 U (output) REAL array, dimension (LDU,UCOL)
79 (LDU,M) if JOBU = 'A' or (LDU,min(M,N)) if JOBU = 'S'. If JOBU
80 = 'A', U contains the M-by-M orthogonal matrix U; if JOBU =
81 'S', U contains the first min(m,n) columns of U (the left sin‐
82 gular vectors, stored columnwise); if JOBU = 'N' or 'O', U is
83 not referenced.
84
85 LDU (input) INTEGER
86 The leading dimension of the array U. LDU >= 1; if JOBU = 'S'
87 or 'A', LDU >= M.
88
89 VT (output) REAL array, dimension (LDVT,N)
90 If JOBVT = 'A', VT contains the N-by-N orthogonal matrix V**T;
91 if JOBVT = 'S', VT contains the first min(m,n) rows of V**T
92 (the right singular vectors, stored rowwise); if JOBVT = 'N' or
93 'O', VT is not referenced.
94
95 LDVT (input) INTEGER
96 The leading dimension of the array VT. LDVT >= 1; if JOBVT =
97 'A', LDVT >= N; if JOBVT = 'S', LDVT >= min(M,N).
98
99 WORK (workspace/output) REAL array, dimension (MAX(1,LWORK))
100 On exit, if INFO = 0, WORK(1) returns the optimal LWORK; if
101 INFO > 0, WORK(2:MIN(M,N)) contains the unconverged superdiago‐
102 nal elements of an upper bidiagonal matrix B whose diagonal is
103 in S (not necessarily sorted). B satisfies A = U * B * VT, so
104 it has the same singular values as A, and singular vectors
105 related by U and VT.
106
107 LWORK (input) INTEGER
108 The dimension of the array WORK. LWORK >=
109 MAX(1,3*MIN(M,N)+MAX(M,N),5*MIN(M,N)). For good performance,
110 LWORK should generally be larger.
111
112 If LWORK = -1, then a workspace query is assumed; the routine
113 only calculates the optimal size of the WORK array, returns
114 this value as the first entry of the WORK array, and no error
115 message related to LWORK is issued by XERBLA.
116
117 INFO (output) INTEGER
118 = 0: successful exit.
119 < 0: if INFO = -i, the i-th argument had an illegal value.
120 > 0: if SBDSQR did not converge, INFO specifies how many
121 superdiagonals of an intermediate bidiagonal form B did not
122 converge to zero. See the description of WORK above for
123 details.
124
125
126
127 LAPACK driver routine (version 3.N1o)vember 2006 SGESVD(1)