naginterfaces.library.correg.corrmat_h_weight¶
- naginterfaces.library.correg.corrmat_h_weight(g, alpha, h, errtol=0.0, maxit=0)[source]¶
corrmat_h_weight
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.For full information please refer to the NAG Library document for g02aj
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g02/g02ajf.html
- Parameters
- gfloat, array-like, shape
, the initial matrix.
- alphafloat
The value of .
If , is used.
- hfloat, array-like, shape
The matrix of weights .
- errtolfloat, optional
The termination tolerance for the iteration. If , is used. See Accuracy for further details.
- maxitint, optional
Specifies the maximum number of iterations to be used.
If , is used.
- Returns
- xfloat, ndarray, shape
Contains the nearest correlation matrix.
- iteraint
The number of iterations taken.
- normfloat
The value of after the final iteration.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, one or more of the off-diagonal elements of were negative.
- (errno )
Function failed to converge in iterations.
Increase or check the call to the function.
- Warns
- NagAlgorithmicWarning
- (errno )
Failure to solve intermediate eigenproblem. This should not occur. Please contact NAG with details of your call.
- Notes
corrmat_h_weight
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 Accuracy.
Note that if the elements in vary by several orders of magnitude from one another the algorithm may fail to converge.
- 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, 2012, An inexact accelerated proximal gradient method for large scale linearly constrained convex SDP, SIAM J. Optim. (22(3)), 1042–1064
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