PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_zgeqp3 (f08bt)
Purpose
nag_lapack_zgeqp3 (f08bt) computes the factorization, with column pivoting, of a complex by matrix.
Syntax
Description
nag_lapack_zgeqp3 (f08bt) forms the factorization, with column pivoting, of an arbitrary rectangular complex by matrix.
If
, the factorization is given by:
where
is an
by
upper triangular matrix (with real diagonal elements),
is an
by
unitary matrix and
is an
by
permutation matrix. It is sometimes more convenient to write the factorization as
which reduces to
where
consists of the first
columns of
, and
the remaining
columns.
If
,
is trapezoidal, and the factorization can be written
where
is upper triangular and
is rectangular.
The matrix
is not formed explicitly but is represented as a product of
elementary reflectors (see the
F08 Chapter Introduction for details). Functions are provided to work with
in this representation (see
Further Comments).
Note also that for any
, the information returned in the first
columns of the array
a represents a
factorization of the first
columns of the permuted matrix
.
The function allows specified columns of to be moved to the leading columns of at the start of the factorization and fixed there. The remaining columns are free to be interchanged so that at the th stage the pivot column is chosen to be the column which maximizes the -norm of elements to over columns to .
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:
– 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 .
- 2:
– int64int32nag_int array
-
The dimension of the array
jpvt
must be at least
If , then the th column of is moved to the beginning of before the decomposition is computed and is fixed in place during the computation. Otherwise, the th column of is a free column (i.e., one which may be interchanged during the computation with any other free column).
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
, the elements below the diagonal store details of the unitary matrix
and the upper triangle stores the corresponding elements of the
by
upper triangular matrix
.
If , the strictly lower triangular part stores details of the unitary matrix and the remaining elements store the corresponding elements of the by upper trapezoidal matrix .
The diagonal elements of are real.
- 2:
– int64int32nag_int array
-
The dimension of the array
jpvt will be
Details of the permutation matrix . More precisely, if , then the th column of is moved to become the th column of ; in other words, the columns of are the columns of in the order .
- 3:
– complex array
-
The dimension of the array
tau will be
Further details of the unitary matrix .
- 4:
– 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:
jpvt, 6:
tau, 7:
work, 8:
lwork, 9:
rwork, 10:
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 real floating-point operations is approximately if or if .
To form the unitary matrix
nag_lapack_zgeqp3 (f08bt) may be followed by a call to
nag_lapack_zungqr (f08at):
[a, info] = f08at(a(:,1:m), tau);
but note that the second dimension of the array
a must be at least
m, which may be larger than was required by
nag_lapack_zgeqp3 (f08bt).
When
, it is often only the first
columns of
that are required, and they may be formed by the call:
[a, info] = f08at(a, tau);
To apply
to an arbitrary complex rectangular matrix
,
nag_lapack_zgeqp3 (f08bt) may be followed by a call to
nag_lapack_zunmqr (f08au). For example,
[c, info] = f08au('Left','Conjugate Transpose', a(:,min(m,n)), tau, c);
forms
, where
is
by
.
To compute a
factorization without column pivoting, use
nag_lapack_zgeqrf (f08as).
The real analogue of this function is
nag_lapack_dgeqp3 (f08bf).
Example
This example solves the linear least squares problems
for the basic solutions
and
, where
and
and
is the
th column of the matrix
. The solution is obtained by first obtaining a
factorization with column pivoting of the matrix
. 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:
f08bt_example
function f08bt_example
fprintf('f08bt example results\n\n');
a = [ 0.47 - 0.34i, -0.40 + 0.54i, 0.60 + 0.01i, 0.80 - 1.02i;
-0.32 - 0.23i, -0.05 + 0.20i, -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];
[m,n] = size(a);
nrhs = size(b,2);
jpvt = zeros(n,1,'int64');
[qr, jpvt, tau, info] = f08bt( ...
a, jpvt);
[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);
c1 = zeros(m, nrhs);
c1(1:k, :) = inv(triu(qr(1:k,1:k)))*c(1:k,:);
for j = 1:nrhs
rnorm(j) = norm(c(k+1:m,j));
end
x = zeros(n, nrhs);
for i=1:n
x(jpvt(i), :) = c1(i, :);
end
fprintf('\nLeast-squares solution(s)\n');
disp(x);
fprintf('Square root(s) of the residual sum(s) of squares\n');
disp(rnorm);
f08bt example results
Tolerance used to estimate the rank of a
1.00e-02
Estimated rank of a
3
Least-squares solution(s)
0.0000 + 0.0000i 0.0000 + 0.0000i
2.7020 + 8.0911i -2.2682 - 2.9884i
2.8888 + 2.5012i 0.9779 + 1.3565i
2.7100 + 0.4791i -1.3734 + 0.2212i
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