use scipy.linalg.inv rather than numpy.linalg.inv as SciPy will trigger an exception if non-finite values are encountered
Check matrix condition and try to compute pseudo inverse using scipy.linalg.pinv when the matrix is ill-conditioned. Non-finite values (NaN, Infinity) still trigger an exception.
Changes
scipy.linalg.inv
rather thannumpy.linalg.inv
as SciPy will trigger an exception if non-finite values are encounteredscipy.linalg.pinv
when the matrix is ill-conditioned. Non-finite values (NaN, Infinity) still trigger an exception.closes #37