[Numpy-discussion] invalid numeric result(s) in divide

Curzio Basso curzio.basso at unibas.ch
Fri Aug 13 05:42:04 EDT 2004


Hi all.

I have a matrix tmp a matrix w, both Float32, with

 >>> tmp.shape
(3,512,512)
 >>> w.shape
(512,512)
 >>> w.max()
1.0
 >>> w.min()
0.0
 >>> NA.where(NA.and_(w > 0.0, w < 1.0e-2))
(array([]), array([]))

What is for me surprising is the following:

 >>> tmp = NA.where(w > 0.0, tmp / w, 0.0)
Warning: Encountered invalid numeric result(s)  in divide

Ah, both matrices have no 'nan' or 'inf' elements. So, where could the 
invalid result come from?

thanks, curzio




More information about the NumPy-Discussion mailing list