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_dpbsvx (f07hb)

Purpose

nag_lapack_dpbsvx (f07hb) uses the Cholesky factorization
A = UTU   or   A = LLT
A=UTU   or   A=LLT
to compute the solution to a real system of linear equations
AX = B ,
AX=B ,
where AA is an nn by nn symmetric positive definite band matrix of bandwidth (2kd + 1) ( 2 kd + 1 )  and XX and BB are nn by rr matrices. Error bounds on the solution and a condition estimate are also provided.

Syntax

[ab, afb, equed, s, b, x, rcond, ferr, berr, info] = f07hb(fact, uplo, kd, ab, afb, equed, s, b, 'n', n, 'nrhs_p', nrhs_p)
[ab, afb, equed, s, b, x, rcond, ferr, berr, info] = nag_lapack_dpbsvx(fact, uplo, kd, ab, afb, equed, s, b, 'n', n, 'nrhs_p', nrhs_p)

Description

nag_lapack_dpbsvx (f07hb) performs the following steps:
  1. If fact = 'E'fact='E', real diagonal scaling factors, DS DS , are computed to equilibrate the system:
    (DSADS) (DS1X) = DS B .
    ( DS A DS ) ( DS-1 X ) = DS B .
    Whether or not the system will be equilibrated depends on the scaling of the matrix AA, but if equilibration is used, AA is overwritten by DS A DS DS A DS  and BB by DS B DS B.
  2. If fact = 'N'fact='N' or 'E''E', the Cholesky decomposition is used to factor the matrix AA (after equilibration if fact = 'E'fact='E') as A = UTUA=UTU if uplo = 'U'uplo='U' or A = LLTA=LLT if uplo = 'L'uplo='L', where UU is an upper triangular matrix and LL is a lower triangular matrix.
  3. If the leading ii by ii principal minor of AA is not positive definite, then the function returns with info = iinfo=i. Otherwise, the factored form of AA is used to estimate the condition number of the matrix AA. If the reciprocal of the condition number is less than machine precision, infon + 1infon+1 is returned as a warning, but the function still goes on to solve for XX and compute error bounds as described below.
  4. The system of equations is solved for XX using the factored form of AA.
  5. Iterative refinement is applied to improve the computed solution matrix and to calculate error bounds and backward error estimates for it.
  6. If equilibration was used, the matrix XX is premultiplied by DS DS  so that it solves the original system before equilibration.

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
Higham N J (2002) Accuracy and Stability of Numerical Algorithms (2nd Edition) SIAM, Philadelphia

Parameters

Compulsory Input Parameters

1:     fact – string (length ≥ 1)
Specifies whether or not the factorized form of the matrix AA is supplied on entry, and if not, whether the matrix AA should be equilibrated before it is factorized.
fact = 'F'fact='F'
afb contains the factorized form of AA. If equed = 'Y'equed='Y', the matrix AA has been equilibrated with scaling factors given by s. ab and afb will not be modified.
fact = 'N'fact='N'
The matrix AA will be copied to afb and factorized.
fact = 'E'fact='E'
The matrix AA will be equilibrated if necessary, then copied to afb and factorized.
Constraint: fact = 'F'fact='F', 'N''N' or 'E''E'.
2:     uplo – string (length ≥ 1)
If uplo = 'U'uplo='U', the upper triangle of AA is stored.
If uplo = 'L'uplo='L', the lower triangle of AA is stored.
Constraint: uplo = 'U'uplo='U' or 'L''L'.
3:     kd – int64int32nag_int scalar
kdkd, the number of superdiagonals of the matrix AA if uplo = 'U'uplo='U', or the number of subdiagonals if uplo = 'L'uplo='L'.
Constraint: kd0kd0.
4:     ab(ldab, : :) – double array
The first dimension of the array ab must be at least kd + 1kd+1
The second dimension of the array must be at least max (1,n)max(1,n)
The upper or lower triangle of the symmetric band matrix AA, except if fact = 'F'fact='F' and equed = 'Y'equed='Y', in which case ab must contain the equilibrated matrix DSADSDSADS.
The matrix is stored in rows 11 to kd + 1kd+1, more precisely,
  • if uplo = 'U'uplo='U', the elements of the upper triangle of AA within the band must be stored with element AijAij in ab(kd + 1 + ij,j)​ for ​max (1,jkd)ijabkd+1+i-jj​ for ​max(1,j-kd)ij;
  • if uplo = 'L'uplo='L', the elements of the lower triangle of AA within the band must be stored with element AijAij in ab(1 + ij,j)​ for ​jimin (n,j + kd).ab1+i-jj​ for ​jimin(n,j+kd).
5:     afb(ldafb, : :) – double array
The first dimension of the array afb must be at least kd + 1kd+1
The second dimension of the array must be at least max (1,n)max(1,n)
If fact = 'F'fact='F', afb contains the triangular factor UU or LL from the Cholesky factorization A = UTUA=UTU or A = LLTA=LLT of the band matrix AA, in the same storage format as AA. If equed = 'Y'equed='Y', afb is the factorized form of the equilibrated matrix AA.
6:     equed – string (length ≥ 1)
If fact = 'N'fact='N' or 'E''E', equed need not be set.
If fact = 'F'fact='F', equed must specify the form of the equilibration that was performed as follows:
  • if equed = 'N'equed='N', no equilibration;
  • if equed = 'Y'equed='Y', equilibration was performed, i.e., AA has been replaced by DSADSDSADS.
Constraint: if fact = 'F'fact='F', equed = 'N'equed='N' or 'Y''Y'.
7:     s( : :) – double array
Note: the dimension of the array s must be at least max (1,n)max(1,n).
If fact = 'N'fact='N' or 'E''E', s need not be set.
If fact = 'F'fact='F' and equed = 'Y'equed='Y', s must contain the scale factors, DSDS, for AA; each element of s must be positive.
8:     b(ldb, : :) – double array
The first dimension of the array b must be at least max (1,n)max(1,n)
The second dimension of the array must be at least max (1,nrhs)max(1,nrhs)
The nn by rr right-hand side matrix BB.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The first dimension of the array b The second dimension of the arrays ab, afb, s.
nn, the number of linear equations, i.e., the order of the matrix AA.
Constraint: n0n0.
2:     nrhs_p – int64int32nag_int scalar
Default: The second dimension of the array b.
rr, the number of right-hand sides, i.e., the number of columns of the matrix BB.
Constraint: nrhs0nrhs0.

Input Parameters Omitted from the MATLAB Interface

ldab ldafb ldb ldx work iwork

Output Parameters

1:     ab(ldab, : :) – double array
The first dimension of the array ab will be kd + 1kd+1
The second dimension of the array will be max (1,n)max(1,n)
ldabkd + 1ldabkd+1.
If fact = 'E'fact='E' and equed = 'Y'equed='Y', ab stores DSADSDSADS.
2:     afb(ldafb, : :) – double array
The first dimension of the array afb will be kd + 1kd+1
The second dimension of the array will be max (1,n)max(1,n)
ldafbkd + 1ldafbkd+1.
If fact = 'N'fact='N', afb returns the triangular factor UU or LL from the Cholesky factorization A = UTUA=UTU or A = LLTA=LLT.
If fact = 'E'fact='E', afb returns the triangular factor UU or LL from the Cholesky factorization A = UTUA=UTU or A = LLTA=LLT of the equilibrated matrix AA (see the description of ab for the form of the equilibrated matrix).
3:     equed – string (length ≥ 1)
If fact = 'F'fact='F', equed is unchanged from entry.
Otherwise, if no constraints are violated, equed specifies the form of the equilibration that was performed as specified above.
4:     s( : :) – double array
Note: the dimension of the array s must be at least max (1,n)max(1,n).
If fact = 'F'fact='F', s is unchanged from entry.
Otherwise, if no constraints are violated and equed = 'Y'equed='Y', s contains the scale factors, DSDS, for AA; each element of s is positive.
5:     b(ldb, : :) – double array
The first dimension of the array b will be max (1,n)max(1,n)
The second dimension of the array will be max (1,nrhs)max(1,nrhs)
ldbmax (1,n)ldbmax(1,n).
If equed = 'N'equed='N', b is not modified.
If equed = 'Y'equed='Y', b stores DSBDSB.
6:     x(ldx, : :) – double array
The first dimension of the array x will be max (1,n)max(1,n)
The second dimension of the array will be max (1,nrhs)max(1,nrhs)
ldxmax (1,n)ldxmax(1,n).
If INFO = 0INFO=0 or n + 1n+1, the nn by rr solution matrix XX to the original system of equations. Note that the arrays AA and BB are modified on exit if equed = 'Y'equed='Y', and the solution to the equilibrated system is DS1XDS-1X.
7:     rcond – double scalar
If no constraints are violated, an estimate of the reciprocal condition number of the matrix AA (after equilibration if that is performed), computed as rcond = 1.0 / (A1A11)rcond=1.0/(A1 A-11 ).
8:     ferr(nrhs_p) – double array
If INFO = 0INFO=0 or n + 1n+1, an estimate of the forward error bound for each computed solution vector, such that jxj / xjferr(j)x^j-xj/xjferrj where jx^j is the jjth column of the computed solution returned in the array x and xjxj is the corresponding column of the exact solution XX. The estimate is as reliable as the estimate for rcond, and is almost always a slight overestimate of the true error.
9:     berr(nrhs_p) – double array
If INFO = 0INFO=0 or n + 1n+1, an estimate of the component-wise relative backward error of each computed solution vector jx^j (i.e., the smallest relative change in any element of AA or BB that makes jx^j an exact solution).
10:   info – int64int32nag_int scalar
info = 0info=0 unless the function detects an error (see Section [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.

  info = iinfo=-i
If info = iinfo=-i, parameter ii had an illegal value on entry. The parameters are numbered as follows:
1: fact, 2: uplo, 3: n, 4: kd, 5: nrhs_p, 6: ab, 7: ldab, 8: afb, 9: ldafb, 10: equed, 11: s, 12: b, 13: ldb, 14: x, 15: ldx, 16: rcond, 17: ferr, 18: berr, 19: work, 20: iwork, 21: 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.
  INFO > 0andINFONINFO>0andINFON
If info = iinfo=i and inin, the leading minor of order ii of AA is not positive definite, so the factorization could not be completed, and the solution has not been computed. rcond = 0.0rcond=0.0 is returned.
W INFO = N + 1INFO=N+1
The triangular matrix UU (or LL) is nonsingular, but rcond is less than machine precision, meaning that the matrix is singular to working precision. Nevertheless, the solution and error bounds are computed because there are a number of situations where the computed solution can be more accurate than the value of rcond would suggest.

Accuracy

For each right-hand side vector bb, the computed solution xx is the exact solution of a perturbed system of equations (A + E) x = b (A+E) x = b, where c(n)c(n) is a modest linear function of nn, and εε is the machine precision. See Section 10.1 of Higham (2002) for further details.
If x^ is the true solution, then the computed solution xx satisfies a forward error bound of the form
( x )/( ) wc cond(A,,b)
x-x^ x^ wc cond(A,x^,b)
where cond(A,,b) = |A1|(|A||| + |b|) / cond(A) = |A1||A|κ (A) cond(A,x^,b) = |A-1| ( |A| |x^| + |b| ) / x^ cond(A) = |A-1| |A| κ (A). If x^  is the j j th column of X X , then wc wc  is returned in berr(j) berrj  and a bound on x / x - x^ / x^  is returned in ferr(j) ferrj . See Section 4.4 of Anderson et al. (1999) for further details.

Further Comments

When nk nk , the factorization of A A  requires approximately n (k + 1)2 n (k+1) 2  floating point operations, where k k  is the number of superdiagonals.
For each right-hand side, computation of the backward error involves a minimum of 8nk 8nk  floating point operations. Each step of iterative refinement involves an additional 12nk 12nk  operations. At most five steps of iterative refinement are performed, but usually only one or two steps are required. Estimating the forward error involves solving a number of systems of equations of the form Ax = b Ax=b ; the number is usually 44 or 55 and never more than 1111. Each solution involves approximately 4nk 4nk  operations.
The complex analogue of this function is nag_lapack_zpbsvx (f07hp).

Example

function nag_lapack_dpbsvx_example
fact = 'Equilibration';
uplo = 'U';
kd = int64(1);
ab = [0, 2.68, -2.39, -2.22;
     5.49, 5.63, 2.6, 5.17];
afb = zeros(2, 4);
equed = ' ';
s = zeros(4, 1);
b = [22.09, 5.1;
     9.31, 30.81;
     -5.24, -25.82;
     11.83, 22.9];
[abOut, afbOut, equedOut, sOut, bOut, x, rcond, ferr, berr, info] = ...
    nag_lapack_dpbsvx(fact, uplo, kd, ab, afb, equed, s, b)
 

abOut =

         0    2.6800   -2.3900   -2.2200
    5.4900    5.6300    2.6000    5.1700


afbOut =

         0    1.1438   -1.1497   -1.9635
    2.3431    2.0789    1.1306    1.1465


equedOut =

N


sOut =

    0.4268
    0.4214
    0.6202
    0.4398


bOut =

   22.0900    5.1000
    9.3100   30.8100
   -5.2400  -25.8200
   11.8300   22.9000


x =

    5.0000   -2.0000
   -2.0000    6.0000
   -3.0000   -1.0000
    1.0000    4.0000


rcond =

    0.0135


ferr =

   1.0e-13 *

    0.1996
    0.2833


berr =

   1.0e-15 *

    0.0864
    0.1105


info =

                    0


function f07hb_example
fact = 'Equilibration';
uplo = 'U';
kd = int64(1);
ab = [0, 2.68, -2.39, -2.22;
     5.49, 5.63, 2.6, 5.17];
afb = zeros(2, 4);
equed = ' ';
s = zeros(4, 1);
b = [22.09, 5.1;
     9.31, 30.81;
     -5.24, -25.82;
     11.83, 22.9];
[abOut, afbOut, equedOut, sOut, bOut, x, rcond, ferr, berr, info] = ...
    f07hb(fact, uplo, kd, ab, afb, equed, s, b)
 

abOut =

         0    2.6800   -2.3900   -2.2200
    5.4900    5.6300    2.6000    5.1700


afbOut =

         0    1.1438   -1.1497   -1.9635
    2.3431    2.0789    1.1306    1.1465


equedOut =

N


sOut =

    0.4268
    0.4214
    0.6202
    0.4398


bOut =

   22.0900    5.1000
    9.3100   30.8100
   -5.2400  -25.8200
   11.8300   22.9000


x =

    5.0000   -2.0000
   -2.0000    6.0000
   -3.0000   -1.0000
    1.0000    4.0000


rcond =

    0.0135


ferr =

   1.0e-13 *

    0.1996
    0.2833


berr =

   1.0e-15 *

    0.0864
    0.1105


info =

                    0



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–2013