Error in linalg.inv ??

Carl Banks pavlovevidence at gmail.com
Sat Jun 6 19:08:52 EDT 2009


On Jun 6, 3:31 pm, Robert Kern <robert.k... at gmail.com> wrote:
> On 2009-06-06 17:09, John Machin wrote:
> > Robert Kern<robert.kern<at>  gmail.com>  writes:
> >> You have a very singular matrix (2*a[1] - a[0] == a[2]). You cannot invert it
> >> numerically and expect sensible results.
>
> > Is raising an exception (as documented
> > (http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.inv....)) not
> > a "sensible result"?
>
> That's not the way I was using the phrase, but you have a point.
>
> We depend on the underlying LAPACK routine to tell us if the array is singular
> or not.

Perhaps the documentation should be updated to say "Raises LinAlgError
if inv() detects that 'a' a singular matrix".

Anyone with much experience with linear algebra libraries should know
that these routines are shaky when ill-conditioned, but it could help
newbies and computer science experts to be explicit about it.


Carl Banks



More information about the Python-list mailing list