PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_dtpqrt (f08bb)
Purpose
nag_lapack_dtpqrt (f08bb) computes the factorization of a real by triangular-pentagonal matrix.
Syntax
[
a,
b,
t,
info] = f08bb(
l,
nb,
a,
b, 'm',
m, 'n',
n)
[
a,
b,
t,
info] = nag_lapack_dtpqrt(
l,
nb,
a,
b, 'm',
m, 'n',
n)
Description
nag_lapack_dtpqrt (f08bb) forms the
factorization of a real
by
triangular-pentagonal matrix
,
where
is an upper triangular
by
matrix and
is an
by
pentagonal matrix consisting of an
by
rectangular matrix
on top of an
by
upper trapezoidal matrix
:
The upper trapezoidal matrix consists of the first rows of an by upper triangular matrix, where . If , is by rectangular; if and , is upper triangular.
A recursive, explicitly blocked,
factorization (see
nag_lapack_dgeqrt (f08ab)) is performed on the matrix
. The upper triangular matrix
, details of the orthogonal matrix
, and further details (the block reflector factors) of
are returned.
Typically the matrix or contains the matrix from the factorization of a subproblem and nag_lapack_dtpqrt (f08bb) performs the update operation from the inclusion of matrix .
For example, consider the
factorization of an
by
matrix
with
:
,
, where
is
by
upper triangular and
is
by
rectangular (this can be performed by
nag_lapack_dgeqrt (f08ab)). Given an initial least-squares problem
where
and
are
by
matrices, we have
.
Now, adding an additional
rows to the original system gives the augmented least squares problem
where
is an
by
matrix formed by adding
rows on top of
and
is an
by
matrix formed by adding
rows on top of
.
nag_lapack_dtpqrt (f08bb) can then be used to perform the factorization of the pentagonal matrix ; the by matrix will be zero on input and contain on output.
In the case where is by , , is by upper triangular (forming ) on top of rows of zeros (forming first rows of ). Augmentation is then performed by adding rows to the bottom of with .
References
Elmroth E and Gustavson F (2000) Applying Recursion to Serial and Parallel Factorization Leads to Better Performance IBM Journal of Research and Development. (Volume 44) 4 605–624
Golub G H and Van Loan C F (2012) Matrix Computations (4th Edition) Johns Hopkins University Press, Baltimore
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int scalar
-
, the number of rows of the trapezoidal part of (i.e., ).
Constraint:
.
- 2:
– int64int32nag_int scalar
-
The explicitly chosen block-size to be used in the algorithm for computing the
factorization. See
Further Comments for details.
- 3:
– 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 upper triangular matrix .
- 4:
– 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 pentagonal matrix composed of an by rectangular matrix above an by upper trapezoidal matrix .
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
b.
, the number of rows of the matrix .
Constraint:
.
- 2:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
a and the second dimension of the arrays
a,
b. (An error is raised if these dimensions are not equal.)
, the number of columns of the matrix and the order of the upper triangular matrix .
Constraint:
.
Output Parameters
- 1:
– double array
-
The first dimension of the array
a will be
.
The second dimension of the array
a will be
.
The upper triangle stores the corresponding elements of the by upper triangular matrix .
- 2:
– double array
-
The first dimension of the array
b will be
.
The second dimension of the array
b will be
.
Details of the orthogonal matrix .
- 3:
– double array
-
The first dimension of the array
t will be
.
The second dimension of the array
t will be
.
Further details of the orthogonal matrix
. The number of blocks is
, where
and each block is of order
nb except for the last block, which is of order
. For each of the blocks, an upper triangular block reflector factor is computed:
. These are stored in the
by
matrix
as
.
- 4:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
-
If , argument had an illegal value. An explanatory message is output, and execution of the program is terminated.
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 if or if .
The block size,
nb, used by
nag_lapack_dtpqrt (f08bb) is supplied explicitly through the interface. For moderate and large sizes of matrix, the block size can have a marked effect on the efficiency of the algorithm with the optimal value being dependent on problem size and platform. A value of
is likely to achieve good efficiency and it is unlikely that an optimal value would exceed
.
To apply
to an arbitrary real rectangular matrix
,
nag_lapack_dtpqrt (f08bb) may be followed by a call to
nag_lapack_dtpmqrt (f08bc). For example,
[t, c, info] = f08bc('Left','Transpose', nb, a(:,1:min(m,n)), t, c);
forms
, where
is
by
.
To form the orthogonal matrix
explicitly set
, initialize
to the identity matrix and make a call to
nag_lapack_dtpmqrt (f08bc) as above.
Example
This example finds the basic solutions for the linear least squares problems
where
and
are the columns of the matrix
,
A
factorization is performed on the first
rows of
using
nag_lapack_dgeqrt (f08ab) after which the first
rows of
are updated by applying
using
nag_lapack_dgemqrt (f08ac). The remaining row is added by performing a
update using
nag_lapack_dtpqrt (f08bb);
is updated by applying the new
using
nag_lapack_dtpmqrt (f08bc); the solution is finally obtained by triangular solve using
from the updated
.
Open in the MATLAB editor:
f08bb_example
function f08bb_example
fprintf('f08bb example results\n\n');
m = int64(6);
n = int64(4);
p = int64(2);
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 = [-2.67, 0.41;
-0.55, -3.10;
3.34, -4.01;
-0.77, 2.76;
0.48, -6.17;
4.10, 0.21];
nb = n;
[QRn, Tn, info] = f08ab( ...
nb,a(1:n,:));
[c1, info] = f08ac( ...
'Left', 'Transpose', QRn, Tn, b(1:n,:));
[x, info] = f07te( ...
'Upper', 'No Transpose', 'Non-Unit', QRn, c1);
disp('Solution for n rows');
disp(x(1:n,:));
nb2 = m-n;
l = int64(0);
[R, Q, T, info] = f08bb( ...
l, nb2, QRn, a(n+1:m,:));
[c1,c2,info] = f08bc( ...
'Left','Transpose', l, Q, T, c1, b(n+1:m,:));
[x, info] = f07te( ...
'Upper', 'No transpose', 'Non-Unit', R, c1);
disp('Least squares solution');
disp(x(1:n,:));
for j=1:p
rnorm(j) = norm(c2(:,j));
end
fprintf('Square roots of the residual sums of squares\n');
fprintf('%12.2e', rnorm);
fprintf('\n');
f08bb example results
Solution for n rows
1.5179 -1.5850
1.8629 0.5531
-1.4608 1.3485
0.0398 2.9619
Least squares solution
1.5339 -1.5753
1.8707 0.5559
-1.5241 1.3119
0.0392 2.9585
Square roots of the residual sums of squares
2.22e-02 1.38e-02
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015