Hi Alpha!



 AlphaBetaGamma96:

Is it just to use torch.cholesky_inverse for PSD matrices


Yes, because (if you know your matrix is symmetric-positive-definite)
you can use cholesky_inverse() and doing so will be faster.


and torch.inverse for all other cases?


Yes, because in the non-SPD case cholesky_inverse() won’t work.


Because I’ve used both for a PSD matrix and they give different results? Is this just numerical noise?


You don’t say how large the discrepancy is, so my default assumption
is that you are seeing floating-point round-off error.  An easy test for
this is to repeat the same computations using float64 tensors.  If the
discrepancy is reduced by several orders of magnitude, you are most
likely seeing round-off error.
Best.
K. Frank