pyriemann.utils.base.nearest_sym_pos_def

pyriemann.utils.base.nearest_sym_pos_def(X, reg=1e-06)

Find the nearest SPD matrices.

A NumPy port of John D’Errico’s nearestSPD MATLAB code [1], which credits [2].

Parameters:
Xndarray, shape (n_matrices, n, n)

Square matrices.

regfloat, default=1e-6

Regularization parameter.

Returns:
Pndarray, shape (n_matrices, n, n)

Nearest SPD matrices.

Notes

Added in version 0.4.

References

[1]

nearestSPD J. D’Errico, MATLAB Central File Exchange

[2]

Computing a nearest symmetric positive semidefinite matrix N.J. Higham, Linear Algebra and its Applications, vol 103, 1988