naginterfaces.library.correg.corrmat_shrinking(g, k, errtol=0.0, eigtol=0.0)[source]

corrmat_shrinking computes a correlation matrix, subject to preserving a leading principal submatrix and applying the smallest relative perturbation to the remainder of the approximate input matrix.

For full information please refer to the NAG Library document for g02an

gfloat, array-like, shape

, the initial matrix.


, the order of the leading principal submatrix .

errtolfloat, optional

The termination tolerance for the iteration.

If , is used.

See Accuracy for further details.

eigtolfloat, optional

The tolerance used in determining the definiteness of .

If , where and denote the minimum and maximum eigenvalues of respectively, is positive definite.

If , machine precision is used.

xfloat, ndarray, shape

Contains the matrix .




The number of iterations taken.


The smallest eigenvalue of the leading principal submatrix .


The value of after the final iteration.

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

The principal leading submatrix of the initial matrix is not positive definite.

(errno )

Failure to solve intermediate eigenproblem. This should not occur. Please contact NAG.


corrmat_shrinking finds a correlation matrix, , starting from an approximate correlation matrix, , with positive definite leading principal submatrix of order . The returned correlation matrix, , has the following structure:

where is the leading principal submatrix of the input matrix and positive definite, and .

corrmat_shrinking utilizes a shrinking method to find the minimum value of such that is positive definite with unit diagonal.


Higham, N J, Strabić, N and Šego, V, 2014, Restoring definiteness via shrinking, with an application to correlation matrices with a fixed block, MIMS EPrint 2014.54, Manchester Institute for Mathematical Sciences, The University of Manchester, UK