PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_zgesdd (f08kr)
Purpose
nag_lapack_zgesdd (f08kr) computes the singular value decomposition (SVD) of a complex by matrix , optionally computing the left and/or right singular vectors, by using a divide-and-conquer method.
Syntax
Description
The SVD is written as
where
is an
by
matrix which is zero except for its
diagonal elements,
is an
by
unitary matrix, and
is an
by
unitary matrix. The diagonal elements of
are the singular values of
; they are real and non-negative, and are returned in descending order. The first
columns of
and
are the left and right singular vectors of
.
Note that the function returns , not .
References
Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999)
LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia
http://www.netlib.org/lapack/lug
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Parameters
Compulsory Input Parameters
- 1:
– string (length ≥ 1)
-
Specifies options for computing all or part of the matrix
.
- All columns of and all rows of are returned in the arrays u and vt.
- The first columns of and the first rows of are returned in the arrays u and vt.
- If , the first columns of are overwritten on the array a and all rows of are returned in the array vt. Otherwise, all columns of are returned in the array u and the first rows of are overwritten in the array vt.
- No columns of or rows of are computed.
Constraint:
, , or .
- 2:
– complex array
-
The first dimension of the array
a must be at least
.
The second dimension of the array
a must be at least
.
The by matrix .
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
a.
, the number of rows of the matrix .
Constraint:
.
- 2:
– int64int32nag_int scalar
-
Default:
the second dimension of the array
a.
, the number of columns of the matrix .
Constraint:
.
Output Parameters
- 1:
– complex array
-
The first dimension of the array
a will be
.
The second dimension of the array
a will be
.
If
,
a is overwritten with the first
columns of
(the left singular vectors, stored column-wise) if
;
a is overwritten with the first
rows of
(the right singular vectors, stored row-wise) otherwise.
If
, the contents of
a are destroyed.
- 2:
– double array
-
The singular values of , sorted so that .
- 3:
– complex array
-
The first dimension,
, of the array
u will be
- if or or and , ;
- otherwise .
The second dimension of the array
u will be
if
or
and
,
if
and
otherwise.
If
or
and
,
u contains the
by
unitary matrix
.
If
,
u contains the first
columns of
(the left singular vectors, stored column-wise).
If
and
, or
,
u is not referenced.
- 4:
– complex array
-
The first dimension,
, of the array
vt will be
- if or and , ;
- if , ;
- otherwise .
The second dimension of the array
vt will be
if
or
or
and
and
otherwise.
If
or
and
,
vt contains the
by
unitary matrix
.
If
,
vt contains the first
rows of
(the right singular vectors, stored row-wise).
If
and
, or
,
vt is not referenced.
- 5:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
-
If , parameter had an illegal value on entry. The parameters are numbered as follows:
1:
jobz, 2:
m, 3:
n, 4:
a, 5:
lda, 6:
s, 7:
u, 8:
ldu, 9:
vt, 10:
ldvt, 11:
work, 12:
lwork, 13:
rwork, 14:
iwork, 15:
info.
It is possible that
info refers to a parameter that is omitted from the MATLAB interface. This usually indicates that an error in one of the other input parameters has caused an incorrect value to be inferred.
-
-
nag_lapack_zgesdd (f08kr) did not converge, the updating process failed.
Accuracy
The computed singular value decomposition is nearly the exact singular value decomposition for a nearby matrix
, where
and
is the
machine precision. In addition, the computed singular vectors are nearly orthogonal to working precision. See Section 4.9 of
Anderson et al. (1999) for further details.
Further Comments
The total number of floating-point operations is approximately proportional to when and otherwise.
The singular values are returned in descending order.
The real analogue of this function is
nag_lapack_dgesdd (f08kd).
Example
This example finds the singular values and left and right singular vectors of the
by
matrix
together with approximate error bounds for the computed singular values and vectors.
The example program for
nag_lapack_zgesvd (f08kp) illustrates finding a singular value decomposition for the case
.
Open in the MATLAB editor:
f08kr_example
function f08kr_example
fprintf('f08kr example results\n\n');
a = [ 0.96 + 0.81i, -0.98 - 1.98i, 0.62 + 0.46i, ...
-0.37 - 0.38i, 0.83 - 0.51i, 1.08 + 0.28i;
-0.03 - 0.96i, -1.20 - 0.19i, 1.01 - 0.02i, ...
0.19 + 0.54i, 0.20 - 0.01i, 0.20 + 0.12i;
-0.91 - 2.06i, -0.66 - 0.42i, 0.63 + 0.17i, ...
-0.98 + 0.36i, -0.17 + 0.46i, -0.07 - 1.23i;
-0.05 - 0.41i, -0.81 - 0.56i, -1.11 - 0.60i, ...
0.22 + 0.20i, 1.47 - 1.59i, 0.26 - 0.26i];
m = int64(size(a,1));
n = int64(size(a,2));
b = complex(ones(m,1));
jobz = 'Singular vector parts of U and VT';
[~, s, u, vt, info] = f08kr( ...
jobz, a);
disp('Singular values of A');
disp(s');
y = u'*b;
y = y./s;
x = vt'*y;
disp('Minimum-norm solution:');
disp(x);
disp('Norm of Solution:');
disp(norm(x));
disp('Norm of Residual:');
fprintf('%11.1e\n',norm(b - a*x));
f08kr example results
Singular values of A
3.9994 3.0003 1.9944 0.9995
Minimum-norm solution:
-0.4024 + 0.3777i
-0.2272 + 0.3626i
0.1704 - 0.1532i
0.2125 + 0.0781i
0.2041 + 0.2236i
0.2766 - 0.1517i
Norm of Solution:
0.8846
Norm of Residual:
1.1e-15
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015