Closed
Description
In certain cases, when trying to solve singular linear systems, no feedback is given about the singular nature of the solution. For example:
>>> import numpy
>>> from numpy import array
>>> from numpy.linalg import solve
>>> A=array([[1,2,3],[4,5,6],[7,8,9]])
>>> b=array([15,15,15])
>>> solve(A,b)
array([-39., 63., -24.])
But, on other cas 5B79 es:
>>> C=array([[1,1,1],[1,1,1],[1,1,1]])
>>> x=solve(C,b)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/juanlu/.local/lib/python3.3/site-packages/numpy/linalg/linalg.py", line 328, in solve
raise LinAlgError('Singular matrix')
numpy.linalg.linalg.LinAlgError: Singular matrix
This issue was raised here:
http://web.archive.org/liveweb/http://www.walkingrandomly.com/?p=5092
A warning based on the condition number of the matrix has been suggested as a possible solution.