[Numpy-discussion] svd error checking vs. speed

Sturla Molden sturla.molden at gmail.com
Mon Feb 17 13:09:22 EST 2014


Dave Hirschfeld <novin01 at gmail.com> wrote:

> Even if lapack_lite always performed the isfinite check and threw a python 
> error if False, it would be much better than either hanging or segfaulting and 
> people who care about the isfinite cost probably would be linking to a fast 
> lapack anyway.

+1 (if I have a vote)

Correctness is always more important than speed. Segfaulting or hanging
while burning the CPU is not something we should allow "by design". And
those who need speed should in any case use a different lapack library
instead. The easiest place to put a finiteness test is the check_object
function here:

https://github.com/numpy/numpy/blob/master/numpy/linalg/lapack_litemodule.c

But in that case we should probably use a macro guard to leave it out if
any other LAPACK than the builtin f2c version is used.

Sturla




More information about the NumPy-Discussion mailing list