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_zppsvx (f07gp)

Purpose

nag_lapack_zppsvx (f07gp) uses the Cholesky factorization
A = UHU   or   A = LLH
A=UHU   or   A=LLH
to compute the solution to a complex system of linear equations
AX = B ,
AX=B ,
where AA is an nn by nn Hermitian positive definite matrix stored in packed format and XX and BB are nn by rr matrices. Error bounds on the solution and a condition estimate are also provided.

Syntax

[ap, afp, equed, s, b, x, rcond, ferr, berr, info] = f07gp(fact, uplo, ap, afp, equed, s, b, 'n', n, 'nrhs_p', nrhs_p)
[ap, afp, equed, s, b, x, rcond, ferr, berr, info] = nag_lapack_zppsvx(fact, uplo, ap, afp, equed, s, b, 'n', n, 'nrhs_p', nrhs_p)

Description

nag_lapack_zppsvx (f07gp) 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 = UHUA=UHU if uplo = 'U'uplo='U' or A = LLHA=LLH 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'
afp contains the factorized form of AA. If equed = 'Y'equed='Y', the matrix AA has been equilibrated with scaling factors given by s. ap and afp will not be modified.
fact = 'N'fact='N'
The matrix AA will be copied to afp and factorized.
fact = 'E'fact='E'
The matrix AA will be equilibrated if necessary, then copied to afp 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:     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).
If fact = 'F'fact='F' and equed = 'Y'equed='Y', ap must contain the equilibrated matrix DSADSDSADS; otherwise, ap must contain 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.
4:     afp( : :) – complex array
Note: the dimension of the array afp must be at least max (1,n × (n + 1) / 2)max(1,n×(n+1)/2).
If fact = 'F'fact='F', afp contains the triangular factor UU or LL from the Cholesky factorization A = UHUA=UHU or A = LLHA=LLH, in the same storage format as ap. If equed = 'Y'equed='Y', afp is the factorized form of the equilibrated matrix DSADSDSADS.
5:     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'.
6:     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.
7:     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)
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 array 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

ldb ldx work rwork

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).
If fact = 'F'fact='F' or 'N''N', or if fact = 'E'fact='E' and equed = 'N'equed='N', ap is not modified.
If fact = 'E'fact='E' and equed = 'Y'equed='Y', ap stores DSADSDSADS.
2:     afp( : :) – complex array
Note: the dimension of the array afp must be at least max (1,n × (n + 1) / 2)max(1,n×(n+1)/2).
If fact = 'N'fact='N' or if fact = 'E'fact='E' and equed = 'N'equed='N', afp returns the triangular factor UU or LL from the Cholesky factorization A = UHUA=UHU or A = LLHA=LLH of the original matrix AA.
If fact = 'E'fact='E' and equed = 'Y'equed='Y', afp returns the triangular factor UU or LL from the Cholesky factorization A = UHUA=UHU or A = LLHA=LLH of the equilibrated matrix AA (see the description of ap 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, : :) – 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)
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, : :) – complex 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: nrhs_p, 5: ap, 6: afp, 7: equed, 8: s, 9: b, 10: ldb, 11: x, 12: ldx, 13: rcond, 14: ferr, 15: berr, 16: work, 17: rwork, 18: 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

The factorization of A A  requires approximately (4/3) n3 43 n3  floating point operations.
For each right-hand side, computation of the backward error involves a minimum of 16n2 16n2  floating point operations. Each step of iterative refinement involves an additional 24n2 24n2  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 8n2 8n2  operations.
The real analogue of this function is nag_lapack_dppsvx (f07gb).

Example

function nag_lapack_zppsvx_example
fact = 'Equilibration';
uplo = 'U';
ap = [3.23;
      1.51 - 1.92i;
      3.58 + 0i;
      1.9 + 0.84i;
      -0.23 + 1.11i;
      4.09 + 0i;
      0.42 + 2.5i;
      -1.18 + 1.37i;
      2.33 - 0.14i;
      4.29 + 0i];
afp = complex(zeros(10,1));
equed = ' ';
s = zeros(4,1);
b = [ 3.93 - 6.14i,  1.48 + 6.58i;
      6.17 + 9.42i,  4.65 - 4.75i;
      -7.17 - 21.83i,  -4.91 + 2.29i;
      1.99 - 14.38i,  7.64 - 10.79i];
[apOut, afpOut, equedOut, sOut, bOut, x, rcond, ferr, berr, info] = ...
    nag_lapack_zppsvx(fact, uplo, ap, afp, equed, s, b)
 

apOut =

   3.2300 + 0.0000i
   1.5100 - 1.9200i
   3.5800 + 0.0000i
   1.9000 + 0.8400i
  -0.2300 + 1.1100i
   4.0900 + 0.0000i
   0.4200 + 2.5000i
  -1.1800 + 1.3700i
   2.3300 - 0.1400i
   4.2900 + 0.0000i


afpOut =

   1.7972 + 0.0000i
   0.8402 - 1.0683i
   1.3164 + 0.0000i
   1.0572 + 0.4674i
  -0.4702 - 0.3131i
   1.5604 + 0.0000i
   0.2337 + 1.3910i
   0.0834 - 0.0368i
   0.9360 - 0.9900i
   0.6603 + 0.0000i


equedOut =

N


sOut =

    0.5564
    0.5285
    0.4945
    0.4828


bOut =

   3.9300 - 6.1400i   1.4800 + 6.5800i
   6.1700 + 9.4200i   4.6500 - 4.7500i
  -7.1700 -21.8300i  -4.9100 + 2.2900i
   1.9900 -14.3800i   7.6400 -10.7900i


x =

   1.0000 - 1.0000i  -1.0000 + 2.0000i
  -0.0000 + 3.0000i   3.0000 - 4.0000i
  -4.0000 - 5.0000i  -2.0000 + 3.0000i
   2.0000 + 1.0000i   4.0000 - 5.0000i


rcond =

    0.0066


ferr =

   1.0e-13 *

    0.6198
    0.7458


berr =

   1.0e-16 *

    0.8053
    0.9872


info =

                    0


function f07gp_example
fact = 'Equilibration';
uplo = 'U';
ap = [3.23;
      1.51 - 1.92i;
      3.58 + 0i;
      1.9 + 0.84i;
      -0.23 + 1.11i;
      4.09 + 0i;
      0.42 + 2.5i;
      -1.18 + 1.37i;
      2.33 - 0.14i;
      4.29 + 0i];
afp = complex(zeros(10,1));
equed = ' ';
s = zeros(4,1);
b = [ 3.93 - 6.14i,  1.48 + 6.58i;
      6.17 + 9.42i,  4.65 - 4.75i;
      -7.17 - 21.83i,  -4.91 + 2.29i;
      1.99 - 14.38i,  7.64 - 10.79i];
[apOut, afpOut, equedOut, sOut, bOut, x, rcond, ferr, berr, info] = ...
    f07gp(fact, uplo, ap, afp, equed, s, b)
 

apOut =

   3.2300 + 0.0000i
   1.5100 - 1.9200i
   3.5800 + 0.0000i
   1.9000 + 0.8400i
  -0.2300 + 1.1100i
   4.0900 + 0.0000i
   0.4200 + 2.5000i
  -1.1800 + 1.3700i
   2.3300 - 0.1400i
   4.2900 + 0.0000i


afpOut =

   1.7972 + 0.0000i
   0.8402 - 1.0683i
   1.3164 + 0.0000i
   1.0572 + 0.4674i
  -0.4702 - 0.3131i
   1.5604 + 0.0000i
   0.2337 + 1.3910i
   0.0834 - 0.0368i
   0.9360 - 0.9900i
   0.6603 + 0.0000i


equedOut =

N


sOut =

    0.5564
    0.5285
    0.4945
    0.4828


bOut =

   3.9300 - 6.1400i   1.4800 + 6.5800i
   6.1700 + 9.4200i   4.6500 - 4.7500i
  -7.1700 -21.8300i  -4.9100 + 2.2900i
   1.9900 -14.3800i   7.6400 -10.7900i


x =

   1.0000 - 1.0000i  -1.0000 + 2.0000i
  -0.0000 + 3.0000i   3.0000 - 4.0000i
  -4.0000 - 5.0000i  -2.0000 + 3.0000i
   2.0000 + 1.0000i   4.0000 - 5.0000i


rcond =

    0.0066


ferr =

   1.0e-13 *

    0.6198
    0.7458


berr =

   1.0e-16 *

    0.8053
    0.9872


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