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_dspsv (f07pa)

Purpose

nag_lapack_dspsv (f07pa) computes the solution to a real system of linear equations
AX = B ,
AX=B ,
where AA is an nn by nn symmetric matrix stored in packed format and XX and BB are nn by rr matrices.

Syntax

[ap, ipiv, b, info] = f07pa(uplo, ap, b, 'n', n, 'nrhs_p', nrhs_p)
[ap, ipiv, b, info] = nag_lapack_dspsv(uplo, ap, b, 'n', n, 'nrhs_p', nrhs_p)

Description

nag_lapack_dspsv (f07pa) uses the diagonal pivoting method to factor AA as A = UDUTA=UDUT if uplo = 'U'uplo='U' or A = LDLTA=LDLT if uplo = 'L'uplo='L', where UU (or LL) is a product of permutation and unit upper (lower) triangular matrices, DD is symmetric and block diagonal with 11 by 11 and 22 by 22 diagonal blocks. The factored form of AA is then used to solve the system of equations AX = BAX=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
Higham N J (2002) Accuracy and Stability of Numerical Algorithms (2nd Edition) SIAM, Philadelphia

Parameters

Compulsory Input Parameters

1:     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'.
2:     ap( : :) – double array
Note: the dimension of the array ap must be at least max (1,n × (n + 1) / 2)max(1,n×(n+1)/2).
The nn by nn symmetric matrix AA, packed by columns.
More precisely,
  • if uplo = 'U'uplo='U', the upper triangle of AA must be stored with element AijAij in ap(i + j(j1) / 2)api+j(j-1)/2 for ijij;
  • if uplo = 'L'uplo='L', the lower triangle of AA must be stored with element AijAij in ap(i + (2nj)(j1) / 2)api+(2n-j)(j-1)/2 for ijij.
3:     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.
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

ldb

Output Parameters

1:     ap( : :) – double array
Note: the dimension of the array ap must be at least max (1,n × (n + 1) / 2)max(1,n×(n+1)/2).
The block diagonal matrix DD and the multipliers used to obtain the factor UU or LL from the factorization A = UDUTA=UDUT or A = LDLTA=LDLT as computed by nag_lapack_dsptrf (f07pd), stored as a packed triangular matrix in the same storage format as AA.
2:     ipiv(n) – int64int32nag_int array
Details of the interchanges and the block structure of DD. More precisely,
  • if ipiv(i) = k > 0ipivi=k>0, diidii is a 11 by 11 pivot block and the iith row and column of AA were interchanged with the kkth row and column;
  • if uplo = 'U'uplo='U' and ipiv(i1) = ipiv(i) = l < 0ipivi-1=ipivi=-l<0,
    (di1,i1di,i1)
    di,i1dii
    di-1,i-1d-i,i-1 d-i,i-1dii is a 22 by 22 pivot block and the (i1)(i-1)th row and column of AA were interchanged with the llth row and column;
  • if uplo = 'L'uplo='L' and ipiv(i) = ipiv(i + 1) = m < 0ipivi=ipivi+1=-m<0,
    (diidi + 1,i)
    di + 1,idi + 1,i + 1
    diidi+1,idi+1,idi+1,i+1 is a 22 by 22 pivot block and the (i + 1)(i+1)th row and column of AA were interchanged with the mmth row and column.
3:     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 INFO = 0INFO=0, the nn by rr solution matrix XX.
4:     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: uplo, 2: n, 3: nrhs_p, 4: ap, 5: ipiv, 6: b, 7: ldb, 8: 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 > 0INFO>0
If info = iinfo=i, diidii is exactly zero. The factorization has been completed, but the block diagonal matrix DD is exactly singular, so the solution could not be computed.

Accuracy

The computed solution for a single right-hand side, x^ , satisfies an equation of the form
(A + E) = b ,
(A+E) x^=b ,
where
E1 = O(ε) A1
E1 = O(ε) A1
and ε ε  is the machine precision. An approximate error bound for the computed solution is given by
(x1)/(x1) κ(A) (E1)/(A1) ,
x^-x1 x1 κ(A) E1 A1 ,
where κ(A) = A11 A1 κ(A) = A-11 A1 , the condition number of A A  with respect to the solution of the linear equations. See Section 4.4 of Anderson et al. (1999) and Chapter 11 of Higham (2002) for further details.
nag_lapack_dspsvx (f07pb) is a comprehensive LAPACK driver that returns forward and backward error bounds and an estimate of the condition number. Alternatively, nag_linsys_real_symm_packed_solve (f04bj) solves AX = B AX=B  and returns a forward error bound and condition estimate. nag_linsys_real_symm_packed_solve (f04bj) calls nag_lapack_dspsv (f07pa) to solve the equations.

Further Comments

The total number of floating point operations is approximately (1/3) n3 + 2n2r 13 n3 + 2n2r , where r r  is the number of right-hand sides.
The complex analogues of nag_lapack_dspsv (f07pa) are nag_lapack_zhpsv (f07pn) for Hermitian matrices, and nag_lapack_zspsv (f07qn) for symmetric matrices.

Example

function nag_lapack_dspsv_example
uplo = 'U';
ap = [-1.81;
     2.06;
     1.15;
     0.63;
     1.87;
     -0.21;
     -1.15;
     4.2;
     3.87;
     2.07];
b = [0.96;
     6.07;
     8.38;
     9.5];
[apOut, ipiv, bOut, info] = nag_lapack_dspsv(uplo, ap, b)
 

apOut =

    0.4074
    0.3031
   -2.5907
   -0.5960
    0.8115
    1.1500
    0.6537
    0.2230
    4.2000
    2.0700


ipiv =

                    1
                    2
                   -2
                   -2


bOut =

   -5.0000
   -2.0000
    1.0000
    4.0000


info =

                    0


function f07pa_example
uplo = 'U';
ap = [-1.81;
     2.06;
     1.15;
     0.63;
     1.87;
     -0.21;
     -1.15;
     4.2;
     3.87;
     2.07];
b = [0.96;
     6.07;
     8.38;
     9.5];
[apOut, ipiv, bOut, info] = f07pa(uplo, ap, b)
 

apOut =

    0.4074
    0.3031
   -2.5907
   -0.5960
    0.8115
    1.1500
    0.6537
    0.2230
    4.2000
    2.0700


ipiv =

                    1
                    2
                   -2
                   -2


bOut =

   -5.0000
   -2.0000
    1.0000
    4.0000


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