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