NAG Library Function Document
nag_nearest_correlation_h_weight (g02ajc)
1 Purpose
nag_nearest_correlation_h_weight (g02ajc) computes the nearest correlation matrix, using element-wise weighting in the Frobenius norm and optionally with bounds on the eigenvalues, to a given square, input matrix.
2 Specification
#include <nag.h> |
#include <nagg02.h> |
void |
nag_nearest_correlation_h_weight (double g[],
Integer pdg,
Integer n,
double alpha,
double h[],
Integer pdh,
double errtol,
Integer maxit,
double x[],
Integer pdx,
Integer *iter,
double *norm,
NagError *fail) |
|
3 Description
nag_nearest_correlation_h_weight (g02ajc) finds the nearest correlation matrix, , to an approximate correlation matrix, , using element-wise weighting, this minimizes , where denotes the matrix with elements .
You can optionally specify a lower bound on the eigenvalues, , of the computed correlation matrix, forcing the matrix to be strictly positive definite, if .
Zero elements in
should be used when you wish to put no emphasis on the corresponding element of
. The algorithm scales
so that the maximum element is
. It is this scaled matrix that is used in computing the norm above and for the stopping criteria described in
Section 7.
Note that if the elements in vary by several orders of magnitude from one another the algorithm may fail to converge.
4 References
Borsdorf R and Higham N J (2010) A preconditioned (Newton) algorithm for the nearest correlation matrix IMA Journal of Numerical Analysis 30(1) 94–107
Jiang K, Sun D and Toh K-C (To appear) An inexact accelerated proximal gradient method for large scale linearly constrained convex SDP
Qi H and Sun D (2006) A quadratically convergent Newton method for computing the nearest correlation matrix SIAM J. Matrix AnalAppl 29(2) 360–385
5 Arguments
- 1:
g[] – doubleInput/Output
-
Note: the th element of the matrix is stored in .
On entry: , the initial matrix.
On exit: is overwritten.
- 2:
pdg – IntegerInput
-
On entry: the stride separating matrix row elements in the array
g.
Constraint:
.
- 3:
n – IntegerInput
On entry: the order of the matrix .
Constraint:
.
- 4:
alpha – doubleInput
On entry: the value of
.
If , is used.
Constraint:
.
- 5:
h[] – doubleInput/Output
-
Note: the th element of the matrix is stored in .
On entry: the matrix of weights .
On exit: a symmetric matrix with its diagonal elements set to zero and the remaining elements scaled so that the maximum element is .
Constraint:
, for all and , .
- 6:
pdh – IntegerInput
-
On entry: the stride separating matrix row elements in the array
h.
Constraint:
.
- 7:
errtol – doubleInput
-
On entry: the termination tolerance for the iteration. If
then
is used. See
Section 7 for further details.
- 8:
maxit – IntegerInput
-
On entry: specifies the maximum number of iterations to be used.
If , is used.
- 9:
x[] – doubleOutput
-
Note: the th element of the matrix is stored in .
On exit: contains the nearest correlation matrix.
- 10:
pdx – IntegerInput
-
On entry: the stride separating matrix row elements in the array
x.
Constraint:
.
- 11:
iter – Integer *Output
On exit: the number of iterations taken.
- 12:
norm – double *Output
On exit: the value of after the final iteration.
- 13:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
6 Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_CONVERGENCE
-
Function fails to converge in
iterations.
Increase
maxit or check the call to the function.
- NE_EIGENPROBLEM
-
Failure to solve intermediate eigenproblem. This should not occur. Please contact
NAG with details of your call.
- NE_INT
-
On entry, .
Constraint: .
- NE_INT_2
-
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
- 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.
- NE_REAL
-
On entry, .
Constraint: .
- NE_WEIGHTS_NOT_POSITIVE
-
On entry, one or more of the off-diagonal elements of were negative.
7 Accuracy
The returned accuracy is controlled by
errtol and limited by
machine precision. If
is the value of
norm at the
th iteration, that is
where
has been scaled as described above, then the algorithm terminates when:
8 Parallelism and Performance
nag_nearest_correlation_h_weight (g02ajc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_nearest_correlation_h_weight (g02ajc) 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
Users' Note for your implementation for any additional implementation-specific information.
Arrays are internally allocated by nag_nearest_correlation_h_weight (g02ajc). The total size of these arrays is double elements and Integer elements. All allocated memory is freed before return of nag_nearest_correlation_h_weight (g02ajc).
10 Example
This example finds the nearest correlation matrix to:
weighted by:
with minimum eigenvalue
.
10.1 Program Text
Program Text (g02ajce.c)
10.2 Program Data
Program Data (g02ajce.d)
10.3 Program Results
Program Results (g02ajce.r)