I have written this optimization procedure using numpy where I have to perform the following calculation:
B is a symmetric negative semi-definite matrix and I the identity matrix. The problem is that the values of B can be too big (>1e25) and when subtracting by the diagonal matrix some elements don't because there is enough precision. Is there any way to overcome this problem or do I need to rewrite it using another library like mpmath?