g02aa computes the nearest correlation matrix, in the Frobenius norm, to a given square, input matrix.
Public Shared Sub g02aa ( _ g As Double(,), _ n As Integer, _ errtol As Double, _ maxits As Integer, _ maxit As Integer, _ x As Double(,), _ <OutAttribute> ByRef iter As Integer, _ <OutAttribute> ByRef feval As Integer, _ <OutAttribute> ByRef nrmgrd As Double, _ <OutAttribute> ByRef ifail As Integer _ )
public: static void g02aa( array<double,2>^ g, int n, double errtol, int maxits, int maxit, array<double,2>^ x, [OutAttribute] int% iter, [OutAttribute] int% feval, [OutAttribute] double% nrmgrd, [OutAttribute] int% ifail )
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, n]Note: dim1 must satisfy the constraint:On entry: , the initial matrix.On exit: a symmetric matrix with the diagonal set to .
- Type: System..::..Int32On entry: the size of the matrix .Constraint: .
- Type: System..::..DoubleOn entry: the termination tolerance for the Newton iteration. If then is used.
- Type: System..::..Int32On entry: maxits specifies the maximum number of iterations used for the iterative scheme used to solve the linear algebraic equations at each Newton step.If , is used.
- Type: System..::..Int32On entry: specifies the maximum number of Newton iterations.If , is used.
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, n]Note: dim1 must satisfy the constraint:On exit: contains the nearest correlation matrix.
- Type: System..::..Int32%On exit: the number of Newton steps taken.
- Type: System..::..Int32%On exit: the number of function evaluations of the dual problem.
- Type: System..::..Double%On exit: the norm of the gradient of the last Newton step.
A correlation matrix may be characterised as a real square matrix that is symmetric, has a unit diagonal and is positive semidefinite.
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
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
Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (LDG, LDX) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
On entry, and .
Constraint: .On entry, and .
Constraint: .On entry, .
Newton iteration fails to converge in iterations.
Machine precision is limiting convergence.
The array returned in x may still be of interest.
An intermediate eigenproblem could not be solved. This should not occur. Please contact NAG with details of your call.
Dynamic memory allocation failed.
The returned accuracy is controlled by errtol and limited by machine precision.
Arrays are internally allocated by g02aa. The total size of these arrays is real elements and integer elements.
This example finds the nearest correlation matrix to: