nag_lapack_dorgbr (f08kf) generates one of the real orthogonal matrices
or
which were determined by
nag_lapack_dgebrd (f08ke) when reducing a real matrix to bidiagonal form.
nag_lapack_dorgbr (f08kf) is intended to be used after a call to
nag_lapack_dgebrd (f08ke), which reduces a real rectangular matrix
to bidiagonal form
by an orthogonal transformation:
.
nag_lapack_dgebrd (f08ke) represents the matrices
and
as products of elementary reflectors.
The various possibilities are specified by the arguments
vect,
m,
n and
k. The appropriate values to cover the most likely cases are as follows (assuming that
was an
by
matrix):
1. |
To form the full by matrix :
[a, info] = f08kf('Q', n, a, tau);
(note that the array a must have at least columns).
|
2. |
If , to form the leading columns of :
[a, info] = f08kf('Q', n, a, tau);
|
3. |
To form the full by matrix :
[a, info] = f08kf('P', m, a, tau);
(note that the array a must have at least rows).
|
4. |
If , to form the leading rows of :
[a, info] = f08kf('P', m, a, tau);
|
The computed matrix
differs from an exactly orthogonal matrix by a matrix
such that
where
is the
machine precision. A similar statement holds for the computed matrix
.
The total number of floating-point operations for the cases listed in
Description are approximately as follows:
1. |
To form the whole of :
- if ,
- if ;
|
2. |
To form the leading columns of when :
|
3. |
To form the whole of :
- if ,
- if ;
|
4. |
To form the leading rows of when :
|
The complex analogue of this function is
nag_lapack_zungbr (f08kt).
For this function two examples are presented, both of which involve computing the singular value decomposition of a matrix
, where
in the first example and
in the second.
must first be reduced to tridiagonal form by
nag_lapack_dgebrd (f08ke). The program then calls
nag_lapack_dorgbr (f08kf) twice to form
and
, and passes these matrices to
nag_lapack_dbdsqr (f08me), which computes the singular value decomposition of
.
function f08kf_example
fprintf('f08kf example results\n\n');
ex1;
ex2;
function ex1
m = int64(6);
n = int64(4);
a = [-0.57 -1.28 -0.39 0.25;
-1.93 1.08 -0.31 -2.14;
2.30 0.24 0.40 -0.35;
-1.93 0.64 -0.66 0.08;
0.15 0.30 0.15 -2.13;
-0.02 1.03 -1.43 0.50];
[B, d, e, tauq, taup, info] = ...
f08ke(a);
vect = 'P';
[PT, info] = f08kf( ...
vect, m, B, taup, 'm', n, 'n', n);
vect = 'Q';
[Q, info] = f08kf( ...
vect, n, B, tauq, 'm', m, 'n', n);
c = [];
uplo = 'Upper';
[s, ~, VT, U, c, info] = f08me( ...
uplo, d, e, PT, Q, c);
disp('Example 1: singular values');
disp(s(1:n)');
disp('Example 1: right singular vectors, by row');
disp(VT(1:n,:));
disp('Example 1: left singular vectors, by column');
disp(U);
function ex2
m = int64(4);
n = int64(6);
a = [-5.42 3.28 -3.68 0.27 2.06 0.46;
-1.65 -3.40 -3.20 -1.03 -4.06 -0.01;
-0.37 2.35 1.90 4.31 -1.76 1.13;
-3.15 -0.11 1.99 -2.70 0.26 4.50];
[B, d, e, tauq, taup, info] = ...
f08ke(a);
vect = 'P';
[PT, info] = f08kf( ...
vect, m, B, taup, 'm', m, 'n', n);
vect = 'Q';
[Q, info] = f08kf( ...
vect, n, B, tauq, 'm', m, 'n', m);
c = [];
uplo = 'Lower';
[s, ~, VT, U, c, info] = f08me( ...
uplo, d, e, PT, Q, c, 'n', m);
disp('Example 2: singular values');
disp(s(1:m)');
disp('Example 2: right singular vectors, by row');
disp(VT);
disp('Example 2: left singular vectors, by column');
disp(U(:,1:m));