PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_zgeqpf (f08bs)
Purpose
nag_lapack_zgeqpf (f08bs) computes the factorization, with column pivoting, of a complex by matrix.
Syntax
Description
nag_lapack_zgeqpf (f08bs) 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
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
-
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:
rwork, 9:
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_zgeqpf (f08bs) 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_zgeqpf (f08bs).
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_zgeqpf (f08bs) 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_dgeqpf (f08be).
Example
This example solves the linear least squares problems
where
and
are the columns of the matrix
,
and
Here
is approximately rank-deficient, and hence it is preferable to use
nag_lapack_zgeqpf (f08bs) rather than
nag_lapack_zgeqrf (f08as).
Open in the MATLAB editor:
f08bs_example
function f08bs_example
fprintf('f08bs 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 = [-0.85 - 1.63i, 2.49 + 4.01i;
-2.16 + 3.52i, -0.14 + 7.98i;
4.57 - 5.71i, 8.36 - 0.28i;
6.38 - 7.40i, -3.55 + 1.29i;
8.41 + 9.39i, -6.72 + 5.03i];
[m,n] = size(a);
jpvt = zeros(n,1,'int64');
[a, jpvt, tau, info] = f08bs( ...
a, jpvt);
tol = 0.01;
k = find(abs(diag(a)) <= tol*abs(a(1,1)));
if numel(k) == 0
k = numel(diag(a));
else
k = k(1)-1;
end
[c, info] = f08au( ...
'Left', 'Conjugate Transpose', a, tau, b);
c(1:k, :) = inv(triu(a(1:k,1:k)))*c(1:k,:);
c(k+1:4, :) = 0;
x = zeros(4, 2);
for i=1:4
x(jpvt(i), :) = c(i, :);
end
fprintf('\nLeast-squares solution\n');
disp(x);
f08bs example results
Least-squares solution
0.0000 + 0.0000i 0.0000 + 0.0000i
2.6925 + 8.0446i -2.0563 - 2.9759i
2.7602 + 2.5455i 1.0588 + 1.4635i
2.7383 + 0.5123i -1.4150 + 0.2982i
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015