hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_lapack_dpbsv (f07ha)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_lapack_dpbsv (f07ha) computes the solution to a real system of linear equations
AX=B ,  
where A is an n by n symmetric positive definite band matrix of bandwidth 2 kd + 1  and X and B are n by r matrices.

Syntax

[ab, b, info] = f07ha(uplo, kd, ab, b, 'n', n, 'nrhs_p', nrhs_p)
[ab, b, info] = nag_lapack_dpbsv(uplo, kd, ab, b, 'n', n, 'nrhs_p', nrhs_p)

Description

nag_lapack_dpbsv (f07ha) uses the Cholesky decomposition to factor A as A=UTU if uplo='U' or A=LLT if uplo='L', where U is an upper triangular band matrix, and L is a lower triangular band matrix, with the same number of superdiagonals or subdiagonals as A. The factored form of A is then used to solve the system of equations AX=B.

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:     uplo – string (length ≥ 1)
If uplo='U', the upper triangle of A is stored.
If uplo='L', the lower triangle of A is stored.
Constraint: uplo='U' or 'L'.
2:     kd int64int32nag_int scalar
kd, the number of superdiagonals of the matrix A if uplo='U', or the number of subdiagonals if uplo='L'.
Constraint: kd0.
3:     abldab: – double array
The first dimension of the array ab must be at least kd+1.
The second dimension of the array ab must be at least max1,n.
The upper or lower triangle of the symmetric band matrix A.
The matrix is stored in rows 1 to kd+1, more precisely,
  • if uplo='U', the elements of the upper triangle of A within the band must be stored with element Aij in abkd+1+i-jj​ for ​max1,j-kdij;
  • if uplo='L', the elements of the lower triangle of A within the band must be stored with element Aij in ab1+i-jj​ for ​jiminn,j+kd.
4:     bldb: – double array
The first dimension of the array b must be at least max1,n.
The second dimension of the array b must be at least max1,nrhs_p.
The n by r right-hand side matrix B.

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the first dimension of the array b and the second dimension of the array ab.
n, the number of linear equations, i.e., the order of the matrix A.
Constraint: n0.
2:     nrhs_p int64int32nag_int scalar
Default: the second dimension of the array b.
r, the number of right-hand sides, i.e., the number of columns of the matrix B.
Constraint: nrhs_p0.

Output Parameters

1:     abldab: – double array
The first dimension of the array ab will be kd+1.
The second dimension of the array ab will be max1,n.
If info=0, the triangular factor U or L from the Cholesky factorization A=UTU or A=LLT of the band matrix A, in the same storage format as A.
2:     bldb: – double array
The first dimension of the array b will be max1,n.
The second dimension of the array b will be max1,nrhs_p.
If info=0, the n by r solution matrix X.
3:     info int64int32nag_int scalar
info=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

   info<0
If info=-i, argument i had an illegal value. An explanatory message is output, and execution of the program is terminated.
   info>0
The leading minor of order _ of A is not positive definite, so the factorization could not be completed, and the solution has not been computed.

Accuracy

The computed solution for a single right-hand side, x^ , satisfies an equation of the form
A+E x^=b ,  
where
E1 = Oε A1  
and ε  is the machine precision. An approximate error bound for the computed solution is given by
x^-x1 x1 κA E1 A1 ,  
where κA = A-11 A1 , the condition number of A  with respect to the solution of the linear equations. See Section 4.4 of Anderson et al. (1999) for further details.
nag_lapack_dpbsvx (f07hb) is a comprehensive LAPACK driver that returns forward and backward error bounds and an estimate of the condition number. Alternatively, nag_linsys_real_posdef_band_solve (f04bf) solves Ax=b  and returns a forward error bound and condition estimate. nag_linsys_real_posdef_band_solve (f04bf) calls nag_lapack_dpbsv (f07ha) to solve the equations.

Further Comments

When nk , the total number of floating-point operations is approximately nk+12+4nkr , where k  is the number of superdiagonals and r  is the number of right-hand sides.
The complex analogue of this function is nag_lapack_zpbsv (f07hn).

Example

This example solves the equations
Ax=b ,  
where A  is the symmetric positive definite band matrix
A = 5.49 2.68 0.00 0.00 2.68 5.63 -2.39 0.00 0.00 -2.39 2.60 -2.22 0.00 0.00 -2.22 5.17   and   b = 22.09 9.31 -5.24 11.83 .  
Details of the Cholesky factorization of A  are also output.
function f07ha_example


fprintf('f07ha example results\n\n');

% Symmetric A (one lower/upper off-diagonal) in banded form 
uplo = 'U';
kd = int64(1);
m  = int64(4);
ab = [0,    2.68, -2.39, -2.22;
      5.49, 5.63,  2.6,   5.17];

% RHS
b = [22.09;
      9.31;
     -5.24;
     11.83];

% Solve Ax = b
[abf, x, info] = f07ha( ...
                        uplo, kd, ab, b);

disp('Solution');
disp(x');

kl = int64(0);
[ifail] = x04ce( ...
                 m, m, kl, kd, abf, 'Cholesky factor U');


f07ha example results

Solution
    5.0000   -2.0000   -3.0000    1.0000

 Cholesky factor U
             1          2          3          4
 1      2.3431     1.1438
 2                 2.0789    -1.1497
 3                            1.1306    -1.9635
 4                                       1.1465

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015