PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_dggsvd (f08va)
Purpose
nag_lapack_dggsvd (f08va) computes the generalized singular value decomposition (GSVD) of an by real matrix and a by real matrix .
Syntax
[
k,
l,
a,
b,
alpha,
beta,
u,
v,
q,
iwork,
info] = f08va(
jobu,
jobv,
jobq,
a,
b, 'm',
m, 'n',
n, 'p',
p)
[
k,
l,
a,
b,
alpha,
beta,
u,
v,
q,
iwork,
info] = nag_lapack_dggsvd(
jobu,
jobv,
jobq,
a,
b, 'm',
m, 'n',
n, 'p',
p)
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 23: |
iwork was made an output parameter |
Description
The generalized singular value decomposition is given by
where
,
and
are orthogonal matrices. Let
be the effective numerical rank of the matrix
, then
is a
by
nonsingular upper triangular matrix,
and
are
by
and
by
‘diagonal’ matrices structured as follows:
if
,
where
and
is stored as a submatrix of
with elements
stored as
on exit.
If
,
where
and
is stored as a submatrix of
with
stored as
, and
is stored as a submatrix of
with
stored as
.
The function computes , , and, optionally, the orthogonal transformation matrices , and .
In particular, if
is an
by
nonsingular matrix, then the GSVD of
and
implicitly gives the SVD of
:
If
has orthonormal columns, then the GSVD of
and
is also equal to the CS decomposition of
and
. Furthermore, the GSVD can be used to derive the solution of the eigenvalue problem:
In some literature, the GSVD of
and
is presented in the form
where
and
are orthogonal and
is nonsingular, and
and
are ‘diagonal’. The former GSVD form can be converted to the latter form by taking the nonsingular matrix
as
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)
-
If
, the orthogonal matrix
is computed.
If , is not computed.
Constraint:
or .
- 2:
– string (length ≥ 1)
-
If
, the orthogonal matrix
is computed.
If , is not computed.
Constraint:
or .
- 3:
– string (length ≥ 1)
-
If
, the orthogonal matrix
is computed.
If , is not computed.
Constraint:
or .
- 4:
– double 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 .
- 5:
– double array
-
The first dimension of the array
b must be at least
.
The second dimension of the array
b 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 matrices and .
Constraint:
.
- 3:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
b.
, the number of rows of the matrix .
Constraint:
.
Output Parameters
- 1:
– int64int32nag_int scalar
- 2:
– int64int32nag_int scalar
-
k and
l specify the dimension of the subblocks
and
as described in
Description;
is the effective numerical rank of
.
- 3:
– double array
-
The first dimension of the array
a will be
.
The second dimension of the array
a will be
.
Contains the triangular matrix
, or part of
. See
Description for details.
- 4:
– double array
-
The first dimension of the array
b will be
.
The second dimension of the array
b will be
.
Contains the triangular matrix
if
. See
Description for details.
- 5:
– double array
-
See the description of
beta.
- 6:
– double array
-
alpha and
beta contain the generalized singular value pairs of
and
,
and
;
- ,
- ,
and if
,
- ,
- ,
or if
,
- ,
- ,
- ,
- , and
- ,
- .
The notation above refers to consecutive elements
, for .
- 7:
– double array
-
The first dimension,
, of the array
u will be
- if , ;
- otherwise .
The second dimension of the array
u will be
if
and
otherwise.
If
,
u contains the
by
orthogonal matrix
.
If
,
u is not referenced.
- 8:
– double array
-
The first dimension,
, of the array
v will be
- if , ;
- otherwise .
The second dimension of the array
v will be
if
and
otherwise.
If
,
v contains the
by
orthogonal matrix
.
If
,
v is not referenced.
- 9:
– double array
-
The first dimension,
, of the array
q will be
- if , ;
- otherwise .
The second dimension of the array
q will be
if
and
otherwise.
If
,
q contains the
by
orthogonal matrix
.
If
,
q is not referenced.
- 10:
– int64int32nag_int array
-
Stores the sorting information. More precisely, the following loop will sort
alpha for i=k+1:min(m,k+l)
% swap alpha(i) and alpha(iwork(i))
end
such that
.
- 11:
– 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:
jobu, 2:
jobv, 3:
jobq, 4:
m, 5:
n, 6:
p, 7:
k, 8:
l, 9:
a, 10:
lda, 11:
b, 12:
ldb, 13:
alpha, 14:
beta, 15:
u, 16:
ldu, 17:
v, 18:
ldv, 19:
q, 20:
ldq, 21:
work, 22:
iwork, 23:
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.
-
-
If , the Jacobi-type procedure failed to converge.
Accuracy
The computed generalized singular value decomposition is nearly the exact generalized singular value decomposition for nearby matrices
and
, where
and
is the
machine precision. See Section 4.12 of
Anderson et al. (1999) for further details.
Further Comments
The complex analogue of this function is
nag_lapack_zggsvd (f08vn).
Example
This example finds the generalized singular value decomposition
where
together with estimates for the condition number of
and the error bound for the computed generalized singular values.
The example program assumes that , and would need slight modification if this is not the case.
Open in the MATLAB editor:
f08va_example
function f08va_example
fprintf('f08va example results\n\n');
m = 4;
n = 3;
p = 2;
a = [ 1, 2, 3;
3, 2, 1;
4, 5, 6;
7, 8, 8];
b = [-2, -3, 3;
4, 6, 5];
jobu = 'U';
jobv = 'V';
jobq = 'Q';
[k, l, DR, b, alpha, beta, U, V, Q, iwork, info] = ...
f08va( ...
jobu, jobv, jobq, a, b);
irank = k + l;
fprintf('\nInfinite generalized singular values = %5d\n', k);
fprintf(' Finite generalized singular values = %5d\n', l);
fprintf(' Numerical rank of (a'' b'')'' = %5d\n', irank);
fprintf('\nFinite generalized singular values\n');
w = alpha(k+1:irank)./beta(k+1:irank);
disp(transpose(w));
fprintf('Orthogonal matrix U\n');
disp(U);
fprintf('Orthogonal matrix V\n');
disp(V);
fprintf('Orthogonal matrix Q\n');
disp(Q);
fprintf('Non singular upper triangular matrix R\n');
R = DR(1:n,n-(irank-1):n);
disp(R);
[rcond, info] = f07tg( ...
'Inf-norm','Upper','Non-unit', R);
fprintf('Condition number for R:\n%11.1e\n', 1/rcond);
if (irank==n)
serrbd = x02aj/rcond;
fprintf('\nError bound for the generalized singular values\n%11.1e\n', ...
serrbd);
else
fprintf('\n(A'' B'')'' is not of full rank\n');
end
f08va example results
Infinite generalized singular values = 1
Finite generalized singular values = 2
Numerical rank of (a' b')' = 3
Finite generalized singular values
1.3151 0.0802
Orthogonal matrix U
-0.1348 0.5252 -0.2092 0.8137
0.6742 -0.5221 -0.3889 0.3487
0.2697 0.5276 -0.6578 -0.4650
0.6742 0.4161 0.6101 0.0000
Orthogonal matrix V
0.3554 -0.9347
0.9347 0.3554
Orthogonal matrix Q
-0.8321 -0.0946 -0.5466
0.5547 -0.1419 -0.8199
0 -0.9853 0.1706
Non singular upper triangular matrix R
-2.0569 -9.0121 -9.3705
0 -10.8822 -7.2688
0 0 -6.0405
Condition number for R:
2.4e+01
Error bound for the generalized singular values
2.6e-15
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015