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_zhpsv (f07pn)

Purpose

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

Syntax

[ap, ipiv, b, info] = f07pn(uplo, ap, b, 'n', n, 'nrhs_p', nrhs_p)
[ap, ipiv, b, info] = nag_lapack_zhpsv(uplo, ap, b, 'n', n, 'nrhs_p', nrhs_p)

Description

nag_lapack_zhpsv (f07pn) uses the diagonal pivoting method to factor AA as A = UDUHA=UDUH if uplo = 'U'uplo='U' or A = LDLHA=LDLH if uplo = 'L'uplo='L', where UU (or LL) is a product of permutation and unit upper (lower) triangular matrices, DD is Hermitian 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( : :) – complex 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 Hermitian 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, : :) – complex 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)
Note: to solve the equations Ax = bAx=b, where bb is a single right-hand side, b may be supplied as a one-dimensional array with length ldb = max (1,n)ldb=max(1,n).
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( : :) – complex 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 = UDUHA=UDUH or A = LDLHA=LDLH as computed by nag_lapack_zhptrf (f07pr), 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, : :) – complex 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)
Note: to solve the equations Ax = bAx=b, where bb is a single right-hand side, b may be supplied as a one-dimensional array with length ldb = max (1,n)ldb=max(1,n).
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_zhpsvx (f07pp) is a comprehensive LAPACK driver that returns forward and backward error bounds and an estimate of the condition number. Alternatively, nag_linsys_complex_herm_packed_solve (f04cj) solves AX = B AX=B  and returns a forward error bound and condition estimate. nag_linsys_complex_herm_packed_solve (f04cj) calls nag_lapack_zhpsv (f07pn) to solve the equations.

Further Comments

The total number of floating point operations is approximately (4/3) n3 + 8n2r 43 n3 + 8n2r , where r r  is the number of right-hand sides.
The real analogue of this function is nag_lapack_dspsv (f07pa). The complex symmetric analogue of this function is nag_lapack_zspsv (f07qn).

Example

function nag_lapack_zhpsv_example
uplo = 'U';
ap = [-1.84;
      0.11 - 0.11i;
      -4.63 + 0i;
      -1.78 - 1.18i;
      -1.84 + 0.03i;
      -8.87 + 0i;
      3.91 - 1.5i;
      2.21 + 0.21i;
      1.58 - 0.9i;
      -1.36 + 0i];
b = [ 2.98 - 10.18i;
      -9.58 + 3.88i;
      -0.77 - 16.05i;
      7.79 + 5.48i];
[apOut, ipiv, bOut, info] = nag_lapack_zhpsv(uplo, ap, b)
 

apOut =

  -7.1028 + 0.0000i
   0.2997 + 0.1578i
  -5.4176 + 0.0000i
   0.3397 + 0.0303i
   0.5637 + 0.2850i
  -1.8400 + 0.0000i
  -0.1518 + 0.3743i
   0.3100 + 0.0433i
   3.9100 - 1.5000i
  -1.3600 + 0.0000i


ipiv =

                    1
                    2
                   -1
                   -1


bOut =

   2.0000 + 1.0000i
   3.0000 - 2.0000i
  -1.0000 + 2.0000i
   1.0000 - 1.0000i


info =

                    0


function f07pn_example
uplo = 'U';
ap = [-1.84;
      0.11 - 0.11i;
      -4.63 + 0i;
      -1.78 - 1.18i;
      -1.84 + 0.03i;
      -8.87 + 0i;
      3.91 - 1.5i;
      2.21 + 0.21i;
      1.58 - 0.9i;
      -1.36 + 0i];
b = [ 2.98 - 10.18i;
      -9.58 + 3.88i;
      -0.77 - 16.05i;
      7.79 + 5.48i];
[apOut, ipiv, bOut, info] = f07pn(uplo, ap, b)
 

apOut =

  -7.1028 + 0.0000i
   0.2997 + 0.1578i
  -5.4176 + 0.0000i
   0.3397 + 0.0303i
   0.5637 + 0.2850i
  -1.8400 + 0.0000i
  -0.1518 + 0.3743i
   0.3100 + 0.0433i
   3.9100 - 1.5000i
  -1.3600 + 0.0000i


ipiv =

                    1
                    2
                   -1
                   -1


bOut =

   2.0000 + 1.0000i
   3.0000 - 2.0000i
  -1.0000 + 2.0000i
   1.0000 - 1.0000i


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