spd_learn.functional.nearest_sym_pos_def#
- spd_learn.functional.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:
X (ndarray, shape (..., n, n)) – Square matrices.
reg (float, default=1e-6) – Regularization parameter.
- Returns:
P – Nearest SPD matrices.
- Return type:
ndarray, shape (…, n, n)
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