PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_ztzrzf (f08bv)
Purpose
nag_lapack_ztzrzf (f08bv) reduces the by () complex upper trapezoidal matrix to upper triangular form by means of unitary transformations.
Syntax
Description
The
by
(
) complex upper trapezoidal matrix
given by
where
is an
by
upper triangular matrix and
is an
by
matrix, is factorized as
where
is also an
by
upper triangular matrix and
is an
by
unitary matrix.
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
Parameters
Compulsory Input Parameters
- 1:
– 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 leading
by
upper trapezoidal part of the array
a must contain the matrix to be factorized.
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
.
The leading
by
upper triangular part of
a contains the upper triangular matrix
, and elements
to
n of the first
rows of
a, with the array
tau, represent the unitary matrix
as a product of
elementary reflectors (see
Representation of orthogonal or unitary matrices in the F08 Chapter Introduction).
- 2:
– complex array
-
The dimension of the array
tau will be
The scalar factors of the elementary reflectors.
- 3:
– 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:
m, 2:
n, 3:
a, 4:
lda, 5:
tau, 6:
work, 7:
lwork, 8:
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.
Accuracy
The computed factorization is the exact factorization of a nearby matrix
, where
and
is the
machine precision.
Further Comments
The total number of floating-point operations is approximately .
The real analogue of this function is
nag_lapack_dtzrzf (f08bh).
Example
This example solves the linear least squares problems
for the minimum norm solutions
and
, where
is the
th column of the matrix
,
and
The solution is obtained by first obtaining a factorization with column pivoting of the matrix , and then the factorization of the leading by part of is computed, where is the estimated rank of . A tolerance of is used to estimate the rank of from the upper triangular factor, .
Note that the block size (NB) of assumed in this example is not realistic for such a small problem, but should be suitable for large problems.
Open in the MATLAB editor:
f08bv_example
function f08bv_example
fprintf('f08bv example results\n\n');
m = 5;
n = 4;
a = [ 0.47 - 0.34i, -0.40 + 0.54i, 0.60 + 0.01i, 0.80 - 1.02i;
-0.32 - 0.23i, -0.05 + 0.2i, -0.26 - 0.44i, -0.43 + 0.17i;
0.35 - 0.60i, -0.52 - 0.34i, 0.87 - 0.11i, -0.34 - 0.09i;
0.89 + 0.71i, -0.45 - 0.45i, -0.02 - 0.57i, 1.14 - 0.78i;
-0.19 + 0.06i, 0.11 - 0.85i, 1.44 + 0.80i, 0.07 + 1.14i];
b = [ -1.08 - 2.59i, 2.22 + 2.35i;
-2.61 - 1.49i, 1.62 - 1.48i;
3.13 - 3.61i, 1.65 + 3.43i;
7.33 - 8.01i, -0.98 + 3.08i;
9.12 + 7.63i, -2.84 + 2.78i];
[qr, jpvt, tau, info] = f08bt( ...
a, zeros(n,1,'int64'));
[c, info] = f08au( ...
'Left', 'Conjugate Transpose', qr, tau, b);
tol = 0.01;
k = find(abs(diag(qr)) <= tol*abs(qr(1,1)));
if numel(k) == 0
k = numel(diag(qr));
else
k = k(1)-1;
end
fprintf('\nTolerance used to estimate the rank of a\n %11.2e\n', tol);
fprintf('Estimated rank of a\n %d\n', k);
[rz, taurz, info] = f08bv( ...
qr(1:k,:));
y = zeros(n, 2);
y(1:k, :) = inv(triu(rz(1:k,1:k)))*c(1:k,:);
[w, info] = f08bx( ...
'Left', 'ConjTrans', int64(n-k), rz, taurz, y);
x = zeros(n, 2);
for i=1:n
x(jpvt(i), :) = w(i, :);
end
fprintf('\nLeast-squares solution(s)\n');
disp(x);
rnorm = [norm(c(k+1:m,1)), norm(c(k+1:m,2))];
fprintf('Square root(s) of the residual sum(s) of squares\n');
disp(rnorm);
f08bv example results
Tolerance used to estimate the rank of a
1.00e-02
Estimated rank of a
3
Least-squares solution(s)
1.1669 - 3.3224i -0.5023 + 1.8323i
1.3486 + 5.5027i -1.4418 - 1.6465i
4.1764 + 2.3435i 0.2908 + 1.4900i
0.6467 + 0.0107i -0.2453 + 0.3951i
Square root(s) of the residual sum(s) of squares
0.2513 0.0810
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015