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_dgtsvx (f07cb)

Purpose

nag_lapack_dgtsvx (f07cb) uses the LULU factorization to compute the solution to a real system of linear equations
AX = B   or   ATX = B ,
AX=B   or   ATX=B ,
where AA is a tridiagonal matrix of order nn and XX and BB are nn by rr matrices. Error bounds on the solution and a condition estimate are also provided.

Syntax

[dlf, df, duf, du2, ipiv, x, rcond, ferr, berr, info] = f07cb(fact, trans, dl, d, du, dlf, df, duf, du2, ipiv, b, 'n', n, 'nrhs_p', nrhs_p)
[dlf, df, duf, du2, ipiv, x, rcond, ferr, berr, info] = nag_lapack_dgtsvx(fact, trans, dl, d, du, dlf, df, duf, du2, ipiv, b, 'n', n, 'nrhs_p', nrhs_p)

Description

nag_lapack_dgtsvx (f07cb) performs the following steps:
  1. If fact = 'N'fact='N', the LULU decomposition is used to factor the matrix AA as A = LUA=LU, where LL is a product of permutation and unit lower bidiagonal matrices and UU is upper triangular with nonzeros in only the main diagonal and first two superdiagonals.
  2. If some uii = 0uii=0, so that UU is exactly singular, 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.
  3. The system of equations is solved for XX using the factored form of AA.
  4. Iterative refinement is applied to improve the computed solution matrix and to calculate error bounds and backward error estimates for it.

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 has been supplied.
fact = 'F'fact='F'
dlf, df, duf, du2 and ipiv contain the factorized form of the matrix AA. dlf, df, duf, du2 and ipiv will not be modified.
fact = 'N'fact='N'
The matrix AA will be copied to dlf, df and duf and factorized.
Constraint: fact = 'F'fact='F' or 'N''N'.
2:     trans – string (length ≥ 1)
Specifies the form of the system of equations.
trans = 'N'trans='N'
AX = BAX=B (No transpose).
trans = 'T'trans='T' or 'C''C'
ATX = BATX=B (Transpose).
Constraint: trans = 'N'trans='N', 'T''T' or 'C''C'.
3:     dl( : :) – double array
Note: the dimension of the array dl must be at least max (1,n1)max(1,n-1).
The (n1)(n-1) subdiagonal elements of AA.
4:     d( : :) – double array
Note: the dimension of the array d must be at least max (1,n)max(1,n).
The nn diagonal elements of AA.
5:     du( : :) – double array
Note: the dimension of the array du must be at least max (1,n1)max(1,n-1).
The (n1)(n-1) superdiagonal elements of AA.
6:     dlf( : :) – double array
Note: the dimension of the array dlf must be at least max (1,n1)max(1,n-1).
If fact = 'F'fact='F', dlf contains the (n1)(n-1) multipliers that define the matrix LL from the LULU factorization of AA.
7:     df( : :) – double array
Note: the dimension of the array df must be at least max (1,n)max(1,n).
If fact = 'F'fact='F', df contains the nn diagonal elements of the upper triangular matrix UU from the LULU factorization of AA.
8:     duf( : :) – double array
Note: the dimension of the array duf must be at least max (1,n1)max(1,n-1).
If fact = 'F'fact='F', duf contains the (n1)(n-1) elements of the first superdiagonal of UU.
9:     du2( : :) – double array
Note: the dimension of the array du2 must be at least max (1,n2)max(1,n-2).
If fact = 'F'fact='F', du2 contains the (n2n-2) elements of the second superdiagonal of UU.
10:   ipiv( : :) – int64int32nag_int array
Note: the dimension of the array ipiv must be at least max (1,n)max(1,n).
If fact = 'F'fact='F', ipiv contains the pivot indices from the LULU factorization of AA.
11:   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 dimension of the arrays d, df, ipiv.
nn, 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

ldb ldx work iwork

Output Parameters

1:     dlf( : :) – double array
Note: the dimension of the array dlf must be at least max (1,n1)max(1,n-1).
If fact = 'N'fact='N', dlf contains the (n1)(n-1) multipliers that define the matrix LL from the LULU factorization of AA.
2:     df( : :) – double array
Note: the dimension of the array df must be at least max (1,n)max(1,n).
If fact = 'N'fact='N', df contains the nn diagonal elements of the upper triangular matrix UU from the LULU factorization of AA.
3:     duf( : :) – double array
Note: the dimension of the array duf must be at least max (1,n1)max(1,n-1).
If fact = 'N'fact='N', duf contains the (n1)(n-1) elements of the first superdiagonal of UU.
4:     du2( : :) – double array
Note: the dimension of the array du2 must be at least max (1,n2)max(1,n-2).
If fact = 'N'fact='N', du2 contains the (n2n-2) elements of the second superdiagonal of UU.
5:     ipiv( : :) – int64int32nag_int array
Note: the dimension of the array ipiv must be at least max (1,n)max(1,n).
If fact = 'N'fact='N', ipiv contains the pivot indices from the LULU factorization of AA; row ii of the matrix was interchanged with row ipiv(i)ipivi. ipiv(i)ipivi will always be either ii or i + 1i+1; ipiv(i) = iipivi=i indicates a row interchange was not required.
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.
7:     rcond – double scalar
The estimate of the reciprocal condition number of the matrix AA. If rcond = 0.0rcond=0.0, the matrix may be exactly singular. This condition is indicated by INFO > 0andINFOnINFO>0andINFOn. Otherwise, if rcond is less than the machine precision, the matrix is singular to working precision. This condition is indicated by infon + 1infon+1.
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: trans, 3: n, 4: nrhs_p, 5: dl, 6: d, 7: du, 8: dlf, 9: df, 10: duf, 11: du2, 12: ipiv, 13: b, 14: ldb, 15: x, 16: ldx, 17: rcond, 18: ferr, 19: berr, 20: work, 21: iwork, 22: 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.
W INFO > 0andINFONINFO>0andINFON
If info = iinfo=i, u(i,i)u(i,i) is exactly zero. The factorization has not been completed unless i = ni=n, but the factor UU is exactly singular, so the solution and error bounds could not be computed. rcond = 0.0rcond=0.0 is returned.
W INFO = N + 1INFO=N+1
The triangular matrix UU 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 x^ is the exact solution of a perturbed system of equations (A + E) = b(A+E)x^=b, where
|E| c (n) ε |L| |U| ,
|E| c (n) ε |L| |U| ,
c(n)c(n) is a modest linear function of nn, and εε is the machine precision. See Section 9.3 of Higham (2002) for further details.
If xx is the true solution, then the computed solution x^ 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

The total number of floating point operations required to solve the equations AX = B AX=B  is proportional to nr nr .
The condition number estimation typically requires between four and five solves and never more than eleven solves, following the factorization. The solution is then refined, and the errors estimated, using iterative refinement.
In practice the condition number estimator is very reliable, but it can underestimate the true condition number; see Section 15.3 of Higham (2002) for further details.
The complex analogue of this function is nag_lapack_zgtsvx (f07cp).

Example

function nag_lapack_dgtsvx_example
fact = 'No factors';
trans = 'No transpose';
dl = [3.4;
     3.6;
     7;
     -6];
d = [3;
     2.3;
     -5;
     -0.9;
     7.1];
du = [2.1;
     -1;
     1.9;
     8];
dlf = zeros(4, 1);
df  = zeros(5, 1);
duf = zeros(4, 1);
du2 = zeros(3, 1);
ipiv = [int64(8209208);8;-1233199012;-1233198944;24641422];
b = [2.7, 6.6;
     -0.5, 10.8;
     2.6, -3.2;
     0.6, -11.2;
     2.7, 19.1];
[dlfOut, dfOut, dufOut, du2Out, ipivOut, x, rcond, ferr, berr, info] = ...
    nag_lapack_dgtsvx(fact, trans, dl, d, du, dlf, df, duf, du2, ipiv, b)
 

dlfOut =

    0.8824
    0.0196
    0.1401
   -0.0148


dfOut =

    3.4000
    3.6000
    7.0000
   -6.0000
   -1.0154


dufOut =

    2.3000
   -5.0000
   -0.9000
    7.1000


du2Out =

   -1.0000
    1.9000
    8.0000


ipivOut =

                    2
                    3
                    4
                    5
                    5


x =

   -4.0000    5.0000
    7.0000   -4.0000
    3.0000   -3.0000
   -4.0000   -2.0000
   -3.0000    1.0000


rcond =

    0.0108


ferr =

   1.0e-13 *

    0.0940
    0.1413


berr =

   1.0e-16 *

    0.7221
    0.5921


info =

                    0


function f07cb_example
fact = 'No factors';
trans = 'No transpose';
dl = [3.4;
     3.6;
     7;
     -6];
d = [3;
     2.3;
     -5;
     -0.9;
     7.1];
du = [2.1;
     -1;
     1.9;
     8];
dlf = zeros(4, 1);
df  = zeros(5, 1);
duf = zeros(4, 1);
du2 = zeros(3, 1);
ipiv = [int64(8209208);8;-1233199012;-1233198944;24641422];
b = [2.7, 6.6;
     -0.5, 10.8;
     2.6, -3.2;
     0.6, -11.2;
     2.7, 19.1];
[dlfOut, dfOut, dufOut, du2Out, ipivOut, x, rcond, ferr, berr, info] = ...
    f07cb(fact, trans, dl, d, du, dlf, df, duf, du2, ipiv, b)
 

dlfOut =

    0.8824
    0.0196
    0.1401
   -0.0148


dfOut =

    3.4000
    3.6000
    7.0000
   -6.0000
   -1.0154


dufOut =

    2.3000
   -5.0000
   -0.9000
    7.1000


du2Out =

   -1.0000
    1.9000
    8.0000


ipivOut =

                    2
                    3
                    4
                    5
                    5


x =

   -4.0000    5.0000
    7.0000   -4.0000
    3.0000   -3.0000
   -4.0000   -2.0000
   -3.0000    1.0000


rcond =

    0.0108


ferr =

   1.0e-13 *

    0.0940
    0.1413


berr =

   1.0e-16 *

    0.7221
    0.5921


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