[SciPy-Dev] adding chkfinite flags to linalg functions

Stéfan van der Walt stefan@sun.ac...
Sun Sep 18 11:07:13 CDT 2011


On Sat, Sep 17, 2011 at 5:11 AM, Martin Teichmann
<lkb.teichmann@gmail.com> wrote:
> * adding a ALLFINITE flag to ndarrays. Gaël correctly pointed out that
> this is not as simple as it sounds, but it's nevertheless possible:
> ALLFINITE would have to be a immutable flag at creation time of the
> ndarray, and everytime one does something to the ndarray (possibly
> via a view, to which the ALLFINITE flag has to be copied), we have
> to check everything is finite. This solution would create a lot of work,
> but also nice side-effects: even NaN-aware functions in numpy can
> be very slow on some (actually very common) hardware, accidental
> NaNs can be very annoying.

I don't think this is possible.  Think, for example, of a ctypes call
that simply receives the array data pointer, and then directly
operates on memory.  There is no way for the array to know that this
is happening.

Regards
Stéfan


More information about the SciPy-Dev mailing list