utils.numpy_utils

Numpy functions that can be usefull.

borch.utils.numpy_utils.is_pos_definite(mat)

Returns true when input is positive-definite, via Cholesky

borch.utils.numpy_utils.nearest_pos_def_mat(A)

Find the nearest positive-definite matrix to input

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

[1] https://www.mathworks.com/matlabcentral/fileexchange/42885-nearestspd

[2] N.J. Higham, “Computing a nearest symmetric positive semidefinite matrix” (1988): https://doi.org/10.1016/0024-3795(88)90223-6