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, n)

Square matrices, at least 2D ndarray.

regfloat

Regularization parameter.

Returns
Pndarray, shape (…, n, n)

Nearest SPD matrices.

Notes

New in version 0.3.1.

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