PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_dgbsv (f07ba)
Purpose
nag_lapack_dgbsv (f07ba) computes the solution to a real system of linear equations
where
is an
by
band matrix, with
subdiagonals and
superdiagonals, and
and
are
by
matrices.
Syntax
[
ab,
ipiv,
b,
info] = f07ba(
kl,
ku,
ab,
b, 'n',
n, 'nrhs_p',
nrhs_p)
[
ab,
ipiv,
b,
info] = nag_lapack_dgbsv(
kl,
ku,
ab,
b, 'n',
n, 'nrhs_p',
nrhs_p)
Description
nag_lapack_dgbsv (f07ba) 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:
– double 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:
– 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 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:
– double 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:
– double 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_dgbsv (f07ba),
nag_lapack_dgbcon (f07bg) can be used to estimate the condition number of
and
nag_lapack_dgbrfs (f07bh) can be used to obtain approximate error bounds. Alternatives to
nag_lapack_dgbsv (f07ba), which return condition and error estimates directly are
nag_linsys_real_band_solve (f04bb) and
nag_lapack_dgbsvx (f07bb).
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 complex analogue of this function is
nag_lapack_zgbsv (f07bn).
Example
This example solves the equations
where
is the band matrix
Details of the
factorization of
are also output.
Open in the MATLAB editor:
f07ba_example
function f07ba_example
fprintf('f07ba example results\n\n');
kl = int64(1);
ku = int64(2);
ab = [ 0, 0, 0, 0;
0, 0, -3.66, -2.13;
0, 2.54, -2.73, 4.07;
-0.23, 2.46, 2.46, -3.82;
-6.98, 2.56, -4.78, 0];
b = [ 4.42;
27.13;
-6.14;
10.50];
[LU, ipiv, x, info] = f07ba( ...
kl, ku, ab, b);
disp('Solution');
disp(x');
mtitle = 'Details of factorization';
n = int64(size(b,1));
[ifail] = x04ce( ...
n, n, kl, kl+ku, LU, mtitle);
fprintf('\n');
disp('Pivot indices');
disp(double(ipiv'));
f07ba example results
Solution
-2.0000 3.0000 1.0000 -4.0000
Details of factorization
1 2 3 4
1 -6.9800 2.4600 -2.7300 -2.1300
2 0.0330 2.5600 2.4600 4.0700
3 0.9605 -5.9329 -3.8391
4 0.8057 -0.7269
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