NAG CL Interfacef07gpc (zppsvx)

Settings help

CL Name Style:

1Purpose

f07gpc uses the Cholesky factorization
 $A=UHU or A=LLH$
to compute the solution to a complex system of linear equations
 $AX=B ,$
where $A$ is an $n×n$ Hermitian positive definite matrix stored in packed format and $X$ and $B$ are $n×r$ matrices. Error bounds on the solution and a condition estimate are also provided.

2Specification

 #include
 void f07gpc (Nag_OrderType order, Nag_FactoredFormType fact, Nag_UploType uplo, Integer n, Integer nrhs, Complex ap[], Complex afp[], Nag_EquilibrationType *equed, double s[], Complex b[], Integer pdb, Complex x[], Integer pdx, double *rcond, double ferr[], double berr[], NagError *fail)
The function may be called by the names: f07gpc, nag_lapacklin_zppsvx or nag_zppsvx.

3Description

f07gpc performs the following steps:
1. 1.If ${\mathbf{fact}}=\mathrm{Nag_EquilibrateAndFactor}$, real diagonal scaling factors, ${D}_{S}$, are computed to equilibrate the system:
 $(DSADS) (DS-1X) = DS B .$
Whether or not the system will be equilibrated depends on the scaling of the matrix $A$, but if equilibration is used, $A$ is overwritten by ${D}_{S}A{D}_{S}$ and $B×{D}_{S}B$.
2. 2.If ${\mathbf{fact}}=\mathrm{Nag_NotFactored}$ or $\mathrm{Nag_EquilibrateAndFactor}$, the Cholesky decomposition is used to factor the matrix $A$ (after equilibration if ${\mathbf{fact}}=\mathrm{Nag_EquilibrateAndFactor}$) as $A={U}^{\mathrm{H}}U$ if ${\mathbf{uplo}}=\mathrm{Nag_Upper}$ or $A=L{L}^{\mathrm{H}}$ if ${\mathbf{uplo}}=\mathrm{Nag_Lower}$, where $U$ is an upper triangular matrix and $L$ is a lower triangular matrix.
3. 3.If the leading $i×i$ principal minor of $A$ is not positive definite, then the function returns with ${\mathbf{fail}}\mathbf{.}\mathbf{errnum}=i$ and ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_MAT_NOT_POS_DEF. Otherwise, the factored form of $A$ is used to estimate the condition number of the matrix $A$. If the reciprocal of the condition number is less than machine precision, ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_SINGULAR_WP is returned as a warning, but the function still goes on to solve for $X$ and compute error bounds as described below.
4. 4.The system of equations is solved for $X$ using the factored form of $A$.
5. 5.Iterative refinement is applied to improve the computed solution matrix and to calculate error bounds and backward error estimates for it.
6. 6.If equilibration was used, the matrix $X$ is premultiplied by ${D}_{S}$ so that it solves the original system before equilibration.

4References

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 https://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

5Arguments

1: $\mathbf{order}$Nag_OrderType Input
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. See Section 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or $\mathrm{Nag_ColMajor}$.
2: $\mathbf{fact}$Nag_FactoredFormType Input
On entry: specifies whether or not the factorized form of the matrix $A$ is supplied on entry, and if not, whether the matrix $A$ should be equilibrated before it is factorized.
${\mathbf{fact}}=\mathrm{Nag_Factored}$
afp contains the factorized form of $A$. If ${\mathbf{equed}}=\mathrm{Nag_Equilibrated}$, the matrix $A$ has been equilibrated with scaling factors given by s. ap and afp will not be modified.
${\mathbf{fact}}=\mathrm{Nag_NotFactored}$
The matrix $A$ will be copied to afp and factorized.
${\mathbf{fact}}=\mathrm{Nag_EquilibrateAndFactor}$
The matrix $A$ will be equilibrated if necessary, then copied to afp and factorized.
Constraint: ${\mathbf{fact}}=\mathrm{Nag_Factored}$, $\mathrm{Nag_NotFactored}$ or $\mathrm{Nag_EquilibrateAndFactor}$.
3: $\mathbf{uplo}$Nag_UploType Input
On entry: if ${\mathbf{uplo}}=\mathrm{Nag_Upper}$, the upper triangle of $A$ is stored.
If ${\mathbf{uplo}}=\mathrm{Nag_Lower}$, the lower triangle of $A$ is stored.
Constraint: ${\mathbf{uplo}}=\mathrm{Nag_Upper}$ or $\mathrm{Nag_Lower}$.
4: $\mathbf{n}$Integer Input
On entry: $n$, the number of linear equations, i.e., the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
5: $\mathbf{nrhs}$Integer Input
On entry: $r$, the number of right-hand sides, i.e., the number of columns of the matrix $B$.
Constraint: ${\mathbf{nrhs}}\ge 0$.
6: $\mathbf{ap}\left[\mathit{dim}\right]$Complex Input/Output
Note: the dimension, dim, of the array ap must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×\left({\mathbf{n}}+1\right)/2\right)$.
On entry: if ${\mathbf{fact}}=\mathrm{Nag_Factored}$ and ${\mathbf{equed}}=\mathrm{Nag_Equilibrated}$, ap must contain the equilibrated matrix ${D}_{S}A{D}_{S}$; otherwise, ap must contain the $n×n$ Hermitian matrix $A$, packed by rows or columns.
The storage of elements ${A}_{ij}$ depends on the order and uplo arguments as follows:
if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Upper}$,
${A}_{ij}$ is stored in ${\mathbf{ap}}\left[\left(j-1\right)×j/2+i-1\right]$, for $i\le j$;
if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Lower}$,
${A}_{ij}$ is stored in ${\mathbf{ap}}\left[\left(2n-j\right)×\left(j-1\right)/2+i-1\right]$, for $i\ge j$;
if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Upper}$,
${A}_{ij}$ is stored in ${\mathbf{ap}}\left[\left(2n-i\right)×\left(i-1\right)/2+j-1\right]$, for $i\le j$;
if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ and ${\mathbf{uplo}}=\mathrm{Nag_Lower}$,
${A}_{ij}$ is stored in ${\mathbf{ap}}\left[\left(i-1\right)×i/2+j-1\right]$, for $i\ge j$.
On exit: if ${\mathbf{fact}}=\mathrm{Nag_Factored}$ or $\mathrm{Nag_NotFactored}$, or if ${\mathbf{fact}}=\mathrm{Nag_EquilibrateAndFactor}$ and ${\mathbf{equed}}=\mathrm{Nag_NoEquilibration}$, ap is not modified.
If ${\mathbf{fact}}=\mathrm{Nag_EquilibrateAndFactor}$ and ${\mathbf{equed}}=\mathrm{Nag_Equilibrated}$, ap is overwritten by ${D}_{S}A{D}_{S}$.
7: $\mathbf{afp}\left[\mathit{dim}\right]$Complex Input/Output
Note: the dimension, dim, of the array afp must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×\left({\mathbf{n}}+1\right)/2\right)$.
On entry: if ${\mathbf{fact}}=\mathrm{Nag_Factored}$, afp contains the triangular factor $U$ or $L$ from the Cholesky factorization $A={U}^{\mathrm{H}}U$ or $A=L{L}^{\mathrm{H}}$, in the same storage format as ap. If ${\mathbf{equed}}=\mathrm{Nag_Equilibrated}$, afp is the factorized form of the equilibrated matrix ${D}_{S}A{D}_{S}$.
On exit: if ${\mathbf{fact}}=\mathrm{Nag_NotFactored}$ or if ${\mathbf{fact}}=\mathrm{Nag_EquilibrateAndFactor}$ and ${\mathbf{equed}}=\mathrm{Nag_NoEquilibration}$, afp returns the triangular factor $U$ or $L$ from the Cholesky factorization $A={U}^{\mathrm{H}}U$ or $A=L{L}^{\mathrm{H}}$ of the original matrix $A$.
If ${\mathbf{fact}}=\mathrm{Nag_EquilibrateAndFactor}$ and ${\mathbf{equed}}=\mathrm{Nag_Equilibrated}$, afp returns the triangular factor $U$ or $L$ from the Cholesky factorization $A={U}^{\mathrm{H}}U$ or $A=L{L}^{\mathrm{H}}$ of the equilibrated matrix $A$ (see the description of ap for the form of the equilibrated matrix).
8: $\mathbf{equed}$Nag_EquilibrationType * Input/Output
On entry: if ${\mathbf{fact}}=\mathrm{Nag_NotFactored}$ or $\mathrm{Nag_EquilibrateAndFactor}$, equed need not be set.
If ${\mathbf{fact}}=\mathrm{Nag_Factored}$, equed must specify the form of the equilibration that was performed as follows:
• if ${\mathbf{equed}}=\mathrm{Nag_NoEquilibration}$, no equilibration;
• if ${\mathbf{equed}}=\mathrm{Nag_Equilibrated}$, equilibration was performed, i.e., $A$ has been replaced by ${D}_{S}A{D}_{S}$.
On exit: if ${\mathbf{fact}}=\mathrm{Nag_Factored}$, equed is unchanged from entry.
Otherwise, if no constraints are violated, equed specifies the form of the equilibration that was performed as specified above.
Constraint: if ${\mathbf{fact}}=\mathrm{Nag_Factored}$, ${\mathbf{equed}}=\mathrm{Nag_NoEquilibration}$ or $\mathrm{Nag_Equilibrated}$.
9: $\mathbf{s}\left[\mathit{dim}\right]$double Input/Output
Note: the dimension, dim, of the array s must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: if ${\mathbf{fact}}=\mathrm{Nag_NotFactored}$ or $\mathrm{Nag_EquilibrateAndFactor}$, s need not be set.
If ${\mathbf{fact}}=\mathrm{Nag_Factored}$ and ${\mathbf{equed}}=\mathrm{Nag_Equilibrated}$, s must contain the scale factors, ${D}_{S}$, for $A$; each element of s must be positive.
On exit: if ${\mathbf{fact}}=\mathrm{Nag_Factored}$, s is unchanged from entry.
Otherwise, if no constraints are violated and ${\mathbf{equed}}=\mathrm{Nag_Equilibrated}$, s contains the scale factors, ${D}_{S}$, for $A$; each element of s is positive.
10: $\mathbf{b}\left[\mathit{dim}\right]$Complex Input/Output
Note: the dimension, dim, of the array b must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdb}}×{\mathbf{nrhs}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdb}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $B$ is stored in
• ${\mathbf{b}}\left[\left(j-1\right)×{\mathbf{pdb}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{b}}\left[\left(i-1\right)×{\mathbf{pdb}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: the $n×r$ right-hand side matrix $B$.
On exit: if ${\mathbf{equed}}=\mathrm{Nag_NoEquilibration}$, b is not modified.
If ${\mathbf{equed}}=\mathrm{Nag_Equilibrated}$, b is overwritten by ${D}_{S}B$.
11: $\mathbf{pdb}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array b.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{nrhs}}\right)$.
12: $\mathbf{x}\left[\mathit{dim}\right]$Complex Output
Note: the dimension, dim, of the array x must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdx}}×{\mathbf{nrhs}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdx}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $X$ is stored in
• ${\mathbf{x}}\left[\left(j-1\right)×{\mathbf{pdx}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{x}}\left[\left(i-1\right)×{\mathbf{pdx}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: if ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR or NE_SINGULAR_WP, the $n×r$ solution matrix $X$ to the original system of equations. Note that the arrays $A$ and $B$ are modified on exit if ${\mathbf{equed}}=\mathrm{Nag_Equilibrated}$, and the solution to the equilibrated system is ${D}_{S}^{-1}X$.
13: $\mathbf{pdx}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array x.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdx}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdx}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{nrhs}}\right)$.
14: $\mathbf{rcond}$double * Output
On exit: if no constraints are violated, an estimate of the reciprocal condition number of the matrix $A$ (after equilibration if that is performed), computed as ${\mathbf{rcond}}=1.0/\left({‖A‖}_{1}{‖{A}^{-1}‖}_{1}\right)$.
15: $\mathbf{ferr}\left[{\mathbf{nrhs}}\right]$double Output
On exit: if ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR or NE_SINGULAR_WP, an estimate of the forward error bound for each computed solution vector, such that ${‖{\stackrel{^}{x}}_{j}-{x}_{j}‖}_{\infty }/{‖{x}_{j}‖}_{\infty }\le {\mathbf{ferr}}\left[j-1\right]$ where ${\stackrel{^}{x}}_{j}$ is the $j$th column of the computed solution returned in the array x and ${x}_{j}$ is the corresponding column of the exact solution $X$. The estimate is as reliable as the estimate for rcond, and is almost always a slight overestimate of the true error.
16: $\mathbf{berr}\left[{\mathbf{nrhs}}\right]$double Output
On exit: if ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR or NE_SINGULAR_WP, an estimate of the component-wise relative backward error of each computed solution vector ${\stackrel{^}{x}}_{j}$ (i.e., the smallest relative change in any element of $A$ or $B$ that makes ${\stackrel{^}{x}}_{j}$ an exact solution).
17: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INT
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}\ge 0$.
On entry, ${\mathbf{nrhs}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nrhs}}\ge 0$.
On entry, ${\mathbf{pdb}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdb}}>0$.
On entry, ${\mathbf{pdx}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdx}}>0$.
NE_INT_2
On entry, ${\mathbf{pdb}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry, ${\mathbf{pdb}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{nrhs}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{nrhs}}\right)$.
On entry, ${\mathbf{pdx}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdx}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry, ${\mathbf{pdx}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{nrhs}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdx}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{nrhs}}\right)$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_MAT_NOT_POS_DEF
The leading minor of order $⟨\mathit{\text{value}}⟩$ of $A$ is not positive definite, so the factorization could not be completed, and the solution has not been computed. ${\mathbf{rcond}}=0.0$ is returned.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_SINGULAR_WP
$U$ (or $L$) 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.

7Accuracy

For each right-hand side vector $b$, the computed solution $x$ is the exact solution of a perturbed system of equations $\left(A+E\right)x=b$, where
• if ${\mathbf{uplo}}=\mathrm{Nag_Upper}$, $|E|\le c\left(n\right)\epsilon |{U}^{\mathrm{H}}||U|$;
• if ${\mathbf{uplo}}=\mathrm{Nag_Lower}$, $|E|\le c\left(n\right)\epsilon |L||{L}^{\mathrm{H}}|$,
$c\left(n\right)$ is a modest linear function of $n$, and $\epsilon$ is the machine precision. See Section 10.1 of Higham (2002) for further details.
If $\stackrel{^}{x}$ is the true solution, then the computed solution $x$ satisfies a forward error bound of the form
 $‖x-x^‖∞ ‖x^‖∞ ≤ wc cond(A,x^,b) ,$
where $\mathrm{cond}\left(A,\stackrel{^}{x},b\right)={‖|{A}^{-1}|\left(|A||\stackrel{^}{x}|+|b|\right)‖}_{\infty }/{‖\stackrel{^}{x}‖}_{\infty }\le \mathrm{cond}\left(A\right)={‖|{A}^{-1}||A|‖}_{\infty }\le {\kappa }_{\infty }\left(A\right)$. If $\stackrel{^}{x}$ is the $j$th column of $X$, then ${w}_{c}$ is returned in ${\mathbf{berr}}\left[j-1\right]$ and a bound on ${‖x-\stackrel{^}{x}‖}_{\infty }/{‖\stackrel{^}{x}‖}_{\infty }$ is returned in ${\mathbf{ferr}}\left[j-1\right]$. See Section 4.4 of Anderson et al. (1999) for further details.

8Parallelism and Performance

f07gpc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f07gpc makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

The factorization of $A$ requires approximately $\frac{4}{3}{n}^{3}$ floating-point operations.
For each right-hand side, computation of the backward error involves a minimum of $16{n}^{2}$ floating-point operations. Each step of iterative refinement involves an additional $24{n}^{2}$ 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$; the number is usually $4$ or $5$ and never more than $11$. Each solution involves approximately $8{n}^{2}$ operations.
The real analogue of this function is f07gbc.

10Example

This example solves the equations
 $AX=B ,$
where $A$ is the Hermitian positive definite matrix
 $A = ( 3.23i+0.00 1.51-1.92i 1.90+0.84i 0.42+2.50i 1.51+1.92i 3.58i+0.00 -0.23+1.11i -1.18+1.37i 1.90-0.84i -0.23-1.11i 4.09i+0.00 2.33-0.14i 0.42-2.50i -1.18-1.37i 2.33+0.14i 4.29i+0.00 )$
and
 $B = ( 3.93-06.14i 1.48+06.58i 6.17+09.42i 4.65-04.75i -7.17-21.83i -4.91+02.29i 1.99-14.38i 7.64-10.79i ) .$
Error estimates for the solutions, information on equilibration and an estimate of the reciprocal of the condition number of the scaled matrix $A$ are also output.

10.1Program Text

Program Text (f07gpce.c)

10.2Program Data

Program Data (f07gpce.d)

10.3Program Results

Program Results (f07gpce.r)