A proximal approach to the inversion of ill-conditioned matrices