PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_zgbsv (f07bn)
Purpose
nag_lapack_zgbsv (f07bn) computes the solution to a complex system of linear equations
where
is an
by
band matrix, with
subdiagonals and
superdiagonals, and
and
are
by
matrices.
Syntax
[
ab,
ipiv,
b,
info] = f07bn(
kl,
ku,
ab,
b, 'n',
n, 'nrhs_p',
nrhs_p)
[
ab,
ipiv,
b,
info] = nag_lapack_zgbsv(
kl,
ku,
ab,
b, 'n',
n, 'nrhs_p',
nrhs_p)
Description
nag_lapack_zgbsv (f07bn) uses the decomposition with partial pivoting and row interchanges to factor as , where is a permutation matrix, is a product of permutation and unit lower triangular matrices with subdiagonals, and is upper triangular with superdiagonals. The factored form of is then used to solve the system of equations .
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:
– int64int32nag_int scalar
-
, the number of subdiagonals within the band of the matrix .
Constraint:
.
- 2:
– int64int32nag_int scalar
-
, the number of superdiagonals within the band of the matrix .
Constraint:
.
- 3:
– complex array
-
The first dimension of the array
ab must be at least
.
The second dimension of the array
ab must be at least
.
The
by
coefficient matrix
.
The matrix is stored in rows
to
; the first
rows need not be set, more precisely, the element
must be stored in
See
Further Comments for further details.
- 4:
– complex 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 right-hand side matrix .
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
b.
, the number of linear equations, i.e., the order of the matrix .
Constraint:
.
- 2:
– int64int32nag_int scalar
-
Default:
the second dimension of the array
b.
, the number of right-hand sides, i.e., the number of columns of the matrix .
Constraint:
.
Output Parameters
- 1:
– complex array
-
The first dimension of the array
ab will be
.
The second dimension of the array
ab will be
.
If
,
ab stores details of the factorization.
The upper triangular band matrix , with superdiagonals, is stored in rows to of the array, and the multipliers used to form the matrix are stored in rows to .
- 2:
– int64int32nag_int array
-
If no constraints are violated, the pivot indices that define the permutation matrix ; at the th step row of the matrix was interchanged with row . indicates a row interchange was not required.
- 3:
– complex array
-
The first dimension of the array
b will be
.
The second dimension of the array
b will be
.
If , the by solution matrix .
- 4:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
If , argument had an illegal value. An explanatory message is output, and execution of the program is terminated.
- W
-
Element of the diagonal is exactly zero.
The factorization has been completed, but the factor is exactly singular, so the solution could not be computed.
Accuracy
The computed solution for a single right-hand side,
, satisfies an equation of the form
where
and
is the
machine precision. An approximate error bound for the computed solution is given by
where
, the condition number of
with respect to the solution of the linear equations. See Section 4.4 of
Anderson et al. (1999) for further details.
Following the use of
nag_lapack_zgbsv (f07bn),
nag_lapack_zgbcon (f07bu) can be used to estimate the condition number of
and
nag_lapack_zgbrfs (f07bv) can be used to obtain approximate error bounds. Alternatives to
nag_lapack_zgbsv (f07bn), which return condition and error estimates directly are
nag_linsys_complex_band_solve (f04cb) and
nag_lapack_zgbsvx (f07bp).
Further Comments
The band storage scheme for the array
ab is illustrated by the following example, when
,
, and
. Storage of the band matrix
in the array
ab:
Array elements marked need not be set and are not referenced by the function. Array elements marked need not be set, but are defined on exit from the function and contain the elements , and .
The total number of floating-point operations required to solve the equations depends upon the pivoting required, but if then it is approximately bounded by for the factorization and for the solution following the factorization.
The real analogue of this function is
nag_lapack_dgbsv (f07ba).
Example
This example solves the equations
where
is the band matrix
and
Details of the
factorization of
are also output.
Open in the MATLAB editor:
f07bn_example
function f07bn_example
fprintf('f07bn example results\n\n');
m = int64(4);
kl = int64(1);
ku = int64(2);
ab = [ 0 + 0i, 0 + 0i, 0 + 0i, 0 + 0i;
0 + 0i, 0 + 0i, 0.97 - 2.84i, 0.59 - 0.48i;
0 + 0i, -2.05 - 0.85i, -3.99 + 4.01i, 3.33 - 1.04i;
-1.65 + 2.26i, -1.48 - 1.75i, -1.06 + 1.94i, -0.46 - 1.72i;
0 + 6.3i, -0.77 + 2.83i, 4.48 - 1.09i, 0 + 0i];
b = [ -1.06 + 21.5i;
-22.72 - 53.9i;
28.24 - 38.6i;
-34.56 + 16.73i];
[abf, ipiv, x, info] = f07bn( ...
kl, ku, ab, b);
disp('Solution');
disp(x');
mtitle = 'Details of factorization';
[ifail] = x04de( ...
m, m, kl, kl+ku, abf, mtitle);
fprintf('\n');
disp('Pivot indices');
disp(double(ipiv'));
f07bn example results
Solution
-3.0000 - 2.0000i 1.0000 + 7.0000i -5.0000 - 4.0000i 6.0000 + 8.0000i
Details of factorization
1 2 3 4
1 0.0000 -1.4800 -3.9900 0.5900
6.3000 -1.7500 4.0100 -0.4800
2 0.3587 -0.7700 -1.0600 3.3300
0.2619 2.8300 1.9400 -1.0400
3 0.2314 4.9303 -1.7692
0.6358 -3.0086 -1.8587
4 0.7604 0.4338
0.2429 0.1233
Pivot indices
2 3 3 4
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015