when ${\mathbf{uplo}}=\text{'L'}$. Here $L$ is a unit lower triangular matrix, $P$ is a permutation matrix, $D$ is a symmetric block diagonal matrix (with blocks of order $1$ or $2$) with minimum eigenvalue $\delta $, and $E$ is a perturbation matrix of small norm chosen so that such a factorization can be found. Note that $E$ is not computed explicitly.
If ${\mathbf{uplo}}=\text{'U'}$, we compute the factorization ${P}^{\mathrm{T}}(A+E)P=UD{U}^{\mathrm{T}}$, where $U$ is a unit upper triangular matrix.
If the matrix $A$ is symmetric positive definite, the algorithm ensures that $E=0$. The routine f01mef can be used to compute the matrix $A+E$.
4References
Ashcraft C,
Grimes R G, and
Lewis J G
(1998)
Accurate symmetric indefinite linear equation solvers
SIAM J. Matrix Anal. Appl.20
513–561
Cheng S H and Higham N J (1998) A modified Cholesky algorithm based on a symmetric indefinite factorization SIAM J. Matrix Anal. Appl. 19(4) 1097–1110
5Arguments
1: $\mathbf{uplo}$ – Character(1)Input
On entry: specifies whether the upper or lower triangular part of $A$ is stored and how $A$ is to be factorized.
${\mathbf{uplo}}=\text{'U'}$
The upper triangular part of $A$ is stored and we compute ${P}^{\mathrm{T}}(A+E)P=UD{U}^{\mathrm{T}}$.
${\mathbf{uplo}}=\text{'L'}$
The lower triangular part of $A$ is stored and we compute ${P}^{\mathrm{T}}(A+E)P=LD{L}^{\mathrm{T}}$.
Constraint:
${\mathbf{uplo}}=\text{'U'}$ or $\text{'L'}$.
2: $\mathbf{n}$ – IntegerInput
On entry: $n$, the order of the matrix $A$.
Constraint:
${\mathbf{n}}>0$.
3: $\mathbf{a}({\mathbf{lda}},*)$ – Real (Kind=nag_wp) arrayInput/Output
Note: the second dimension of the array a
must be at least
$\mathrm{max}\phantom{\rule{0.125em}{0ex}}(1,{\mathbf{n}})$.
On entry: the $n\times n$ symmetric matrix $A$.
If ${\mathbf{uplo}}=\text{'U'}$, the upper triangular part of $A$ must be stored and the elements of the array below the diagonal are not referenced.
If ${\mathbf{uplo}}=\text{'L'}$, the lower triangular part of $A$ must be stored and the elements of the array above the diagonal are not referenced.
If ${\mathbf{uplo}}=\text{'U'}$, the strictly upper triangular part of $A$ is overwritten and the elements of the array below the diagonal are not set.
If ${\mathbf{uplo}}=\text{'L'}$, the strictly lower triangular part of $A$ is overwritten and the elements of the array above the diagonal are not set.
The main diagonal elements of $A$ are overwritten by the main diagonal elements of matrix $D$.
On entry: the first dimension of the array a as declared in the (sub)program from which f01mdf is called.
Constraint:
${\mathbf{lda}}\ge {\mathbf{n}}$.
5: $\mathbf{offdiag}\left({\mathbf{n}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: the offdiagonals of the symmetric matrix $D$ are returned in ${\mathbf{offdiag}}\left(1\right),{\mathbf{offdiag}}\left(2\right),\dots ,{\mathbf{offdiag}}\left(n-1\right)$, for ${\mathbf{uplo}}=\text{'L'}$ and in ${\mathbf{offdiag}}\left(2\right),{\mathbf{offdiag}}\left(3\right),\dots ,{\mathbf{offdiag}}\left(n\right)$, for ${\mathbf{uplo}}=\text{'U'}$. See Section 9 for further details.
On exit: gives the permutation information of the factorization. The entries of ipiv are either positive, indicating a $1\times 1$ pivot block, or pairs of negative entries, indicating a $2\times 2$ pivot block.
${\mathbf{ipiv}}\left(i\right)=k>0$
The $i$th and $k$th rows and columns of $A$ were interchanged and ${d}_{ii}$ is a $1\times 1$ block.
${\mathbf{ipiv}}\left(i\right)=-k<0$ and ${\mathbf{ipiv}}\left(i+1\right)=-\ell <0$
The $i$th and $k$th rows and columns, and the $i+1$st and $\ell $th rows and columns, were interchanged and $D$ has the $2\times 2$ block:
If ${\mathbf{uplo}}=\text{'U'}$, ${d}_{i+1,i}$ is stored in ${\mathbf{offdiag}}\left(i+1\right)$. The interchanges were made in the order $i={\mathbf{n}},{\mathbf{n}}-1,\dots ,2$.
If ${\mathbf{uplo}}=\text{'L'}$, ${d}_{i+1,i}$ is stored in ${\mathbf{offdiag}}\left(i\right)$. The interchanges were made in the order $i=1,2,\dots ,{\mathbf{n}}-1$.
7: $\mathbf{delta}$ – Real (Kind=nag_wp)Input
On entry: the value of $\delta $.
Constraint:
${\mathbf{delta}}\ge 0.0$.
8: $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{uplo}}=\u27e8\mathit{\text{value}}\u27e9$. Constraint: ${\mathbf{uplo}}=\text{'U'}$ or $\text{'L'}$.
${\mathbf{ifail}}=2$
On entry, ${\mathbf{n}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{n}}>0$.
${\mathbf{ifail}}=3$
On entry, ${\mathbf{lda}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{n}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{lda}}\ge {\mathbf{n}}$.
${\mathbf{ifail}}=4$
On entry, ${\mathbf{delta}}=\u27e8\mathit{\text{value}}\u27e9$. Constraint: ${\mathbf{delta}}\ge 0.0$.
${\mathbf{ifail}}=5$
An intermediate eigenproblem could not be solved. This should not occur. Please contact NAG with details of your call.
${\mathbf{ifail}}=-99$
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
7Accuracy
If ${\mathbf{uplo}}=\text{'L'}$, the computed factors $L$ and $D$ are the exact factors not of ${P}^{\mathrm{T}}(A+E)P$ but of $P(A+E+F){P}^{\mathrm{T}}$, where
$c\left(n\right)$ is a modest linear function of $n$, and $\epsilon $ is the machine precision.
If ${\mathbf{uplo}}=\text{'U'}$, a similar statement holds for the computed factors $U$ and $D$.
8Parallelism and Performance
f01mdf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f01mdf 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 routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9Further Comments
The elements of the main diagonal of $D$ overwrite the corresponding elements of the main diagonal of $A$; the $n-1$ elements of the subdiagonal (and superdiagonal, by symmetry) elements of $D$ are stored in the array offdiag. If ${\mathbf{uplo}}=\text{'L'}$, then these are stored in ${\mathbf{offdiag}}\left(1\right),\dots ,{\mathbf{offdiag}}\left(n-1\right)$ that is ${d}_{i+1,i}$, for $i=1,\dots ,n-1$ is stored in ${\mathbf{offdiag}}\left(i\right)$; otherwise, they are stored in ${\mathbf{offdiag}}\left(2\right),\dots ,{\mathbf{offdiag}}\left(n\right)$, with ${d}_{i+1,i}$ stored in ${\mathbf{offdiag}}(i+1)$.
The unit diagonal elements of $U$ or $L$ are not stored. The remaining elements of $U$ or $L$ are stored explicitly in either the strictly upper or strictly lower triangular part of the array a, respectively.
The total number of floating-point operations is approximately $\frac{1}{3}{n}^{3}$. The searching overhead for rook pivoting used by the algorithm is between $\mathit{O}\left({n}^{2}\right)$ and $\mathit{O}\left({n}^{3}\right)$ comparisons. Experimnetal evidence suggests $\mathit{O}\left({n}^{2}\right)$ comparisons are usual, see Ashcraft et al. (1998).
All of the entries of the triangular matrix $L$ or $U$ are bounded above (by approximately $2.78$), and, therefore, the norm of the matrix itself is also bounded.
The exact size of the perturbation matrix $E$ cannot be predicted a priori. However, the algorithm attempts to ensure that it is not much greater than the minimum perturbation $\Delta A$ such that $A+\Delta A$ has the minimum eigenvalue $\delta $. In particular, it should be zero when $A$ is positive definite and $\delta =0$. If ${\mathbf{uplo}}=\text{'L'}$, then in general it can be shown that
where ${\lambda}_{\text{max}}$ and ${\lambda}_{\text{min}}$ denote the largest and smallest eigenvalues of the matrix in question. A similar result holds if ${\mathbf{uplo}}=\text{'U'}$.
10Example
This example computes the modified Cholesky factorization $A+E=PLD{L}^{\mathrm{T}}{P}^{\mathrm{T}}$, for the indefinite the matrix $A$, where