pyriemann.geometry.base.nearest_sym_pos_def¶
- pyriemann.geometry.base.nearest_sym_pos_def(X, reg=1e-06)[source]¶
Find the nearest SPD matrices.
A NumPy port of John D’Errico’s
nearestSPDMATLAB code [1], which credits [2].- Parameters:
- Xndarray, shape (…, n, n)
Square matrices.
- regfloat, default=1e-6
Regularization parameter.
- Returns:
- Pndarray, shape (…, n, n)
Nearest SPD matrices.
Notes
Added in version 0.4.
Changed in version 0.11: Add broadcasting.
Changed in version 0.12: Add support for NumPy and PyTorch.
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