NAG FL Interface
f01mdf (real_​modified_​cholesky)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

f01mdf computes the Cheng–Higham modified Cholesky factorization of a real symmetric matrix.

2 Specification

Fortran Interface
Subroutine f01mdf ( uplo, n, a, lda, offdiag, ipiv, delta, ifail)
Integer, Intent (In) :: n, lda
Integer, Intent (Inout) :: ipiv(n), ifail
Real (Kind=nag_wp), Intent (In) :: delta
Real (Kind=nag_wp), Intent (Inout) :: a(lda,*)
Real (Kind=nag_wp), Intent (Out) :: offdiag(n)
Character (1), Intent (In) :: uplo
C Header Interface
#include <nag.h>
void  f01mdf_ (const char *uplo, const Integer *n, double a[], const Integer *lda, double offdiag[], Integer ipiv[], const double *delta, Integer *ifail, const Charlen length_uplo)
The routine may be called by the names f01mdf or nagf_matop_real_modified_cholesky.

3 Description

Given a symmetric, possibly indefinite matrix A, f01mdf finds the Cheng–Higham modified Cholesky factorization
PT(A+E)P=LDLT ,  
when uplo='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 δ, 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 uplo='U', we compute the factorization PT(A+E)P=UDUT, 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.

4 References

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

5 Arguments

1: 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.
uplo='U'
The upper triangular part of A is stored and we compute PT(A+E)P=UDUT.
uplo='L'
The lower triangular part of A is stored and we compute PT(A+E)P=LDLT.
Constraint: uplo='U' or 'L'.
2: n Integer Input
On entry: n, the order of the matrix A.
Constraint: n>0.
3: a(lda,*) Real (Kind=nag_wp) array Input/Output
Note: the second dimension of the array a must be at least max(1,n).
On entry: the n×n symmetric matrix A.
  • If uplo='U', the upper triangular part of A must be stored and the elements of the array below the diagonal are not referenced.
  • If uplo='L', the lower triangular part of A must be stored and the elements of the array above the diagonal are not referenced.
On exit: a is overwritten.
  • If uplo='U', the strictly upper triangular part of A is overwritten and the elements of the array below the diagonal are not set.
  • If uplo='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.
See Section 9 for further details.
4: lda Integer Input
On entry: the first dimension of the array a as declared in the (sub)program from which f01mdf is called.
Constraint: ldan.
5: offdiag(n) Real (Kind=nag_wp) array Output
On exit: the offdiagonals of the symmetric matrix D are returned in offdiag(1), offdiag(2),, offdiag(n-1) , for uplo='L' and in offdiag(2), offdiag(3),, offdiag(n), for uplo='U'. See Section 9 for further details.
6: ipiv(n) Integer array Output
On exit: gives the permutation information of the factorization. The entries of ipiv are either positive, indicating a 1×1 pivot block, or pairs of negative entries, indicating a 2×2 pivot block.
ipiv(i)=k>0
The ith and kth rows and columns of A were interchanged and dii is a 1×1 block.
ipiv(i)=-k<0 and ipiv(i+1)=-<0
The ith and kth rows and columns, and the i+1st and th rows and columns, were interchanged and D has the 2×2 block:
( dii di+1,i di+1,i di+1,i+1 )  
  • If uplo='U', di+1,i is stored in offdiag(i+1). The interchanges were made in the order i=n,n-1,,2.
  • If uplo='L', di+1,i is stored in offdiag(i). The interchanges were made in the order i=1,2,,n-1.
7: delta Real (Kind=nag_wp) Input
On entry: the value of δ.
Constraint: delta0.0.
8: ifail Integer Input/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 -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry 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:
ifail=1
On entry, uplo=value.
Constraint: uplo='U' or 'L'.
ifail=2
On entry, n=value.
Constraint: n>0.
ifail=3
On entry, lda=value and n=value.
Constraint: ldan.
ifail=4
On entry, delta=value.
Constraint: delta0.0.
ifail=5
An intermediate eigenproblem could not be solved. This should not occur. Please contact NAG with details of your call.
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.
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.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

If uplo='L', the computed factors L and D are the exact factors not of PT(A+E)P but of P(A+E+F)PT, where
F2 c(n) ε A+E2 c(n) ε L2 D2 LT2 ,  
c(n) is a modest linear function of n, and ε is the machine precision.
If uplo='U', a similar statement holds for the computed factors U and D.

8 Parallelism 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.

9 Further 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 uplo='L', then these are stored in offdiag(1),,offdiag(n-1) that is di+1,i, for i=1,,n-1 is stored in offdiag(i); otherwise, they are stored in offdiag(2),,offdiag(n), with di+1,i stored in 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 13n3. The searching overhead for rook pivoting used by the algorithm is between O(n2) and O(n3) comparisons. Experimnetal evidence suggests O(n2) 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 ΔA such that A+ΔA has the minimum eigenvalue δ. In particular, it should be zero when A is positive definite and δ=0. If uplo='L', then in general it can be shown that
E2 λmax(LLT) (δ- λmin(A) λmin(LLT) ) ,  
where λmax and λmin denote the largest and smallest eigenvalues of the matrix in question. A similar result holds if uplo='U'.

10 Example

This example computes the modified Cholesky factorization A+E=PLDLTPT, for the indefinite the matrix A, where
A= ( 0.9649 0.1419 0.0357 0.3922 0.0462 0.1419 0.4218 0.8491 0.6555 0.0971 0.0357 0.8491 0.9340 0.1712 0.8235 0.3922 0.6555 0.1712 0.7060 0.6948 0.0462 0.0971 0.8235 0.6948 0.3171 ) .  
The output is then passed to f01mef to explicitly form the matrix A+E and the norm of E is computed.

10.1 Program Text

Program Text (f01mdfe.f90)

10.2 Program Data

Program Data (f01mdfe.d)

10.3 Program Results

Program Results (f01mdfe.r)