[SciPy-Dev] check_finite pull request

Christopher Jordan-Squire cjordan1 at uw.edu
Tue Jan 17 02:56:26 EST 2012


Hi,

This is an old pull request, but it's been active recently.
https://github.com/scipy/scipy/pull/48 adds a check_finite flag to
scipy.linalg functions that allows for disabling a check on whether
there are infs/nans in the array. This can save (a lot) of speed in
certain cases, such as when you're calling a linalg function over and
over again on a matrix that you've already verified, outside the
linalg function, consists of non-nan, finite numbers. It also has the
potential for very bad things to happen. If you disable the checks and
then pass an array to some of the functions, you'll silently get
garbage out, or, even worse, the program will freeze. By default the
checks remain on, of course, so this can only happen if the checks are
intentionally disabled and garbage is passed in. What bad behavior you
get depends on the function, and that in turn depends on the
underlying linear algebra function called. (e.g., the LAPACK function
called.) Click on the link for some more details, or review the old
thread (from late August/early September).

The previous consensus then appeared to be, "We should be able to find
a better solution." Various ideas included writing a C/cython/assembly
function to make the chkfinite function faster, or even adding some
flag to the numpy arrays themselves, but as yet nothing has been
added. (And several of the previous ideas proved less
workable/fruitful than we'd hoped.) Which is unfortunate, since this
feature addresses a common problem in data analysis fields, like
statistics and machine learning.

-Chris Jordan-Squire



More information about the SciPy-Dev mailing list