A. M. Archibald wrote:
On 08/11/06, Pierre GM <pgmdevlist@gmail.com> wrote:
I like your idea, but not its implementation. If MA.masked_singleton is defined as an object, as you suggest, then the dtype of the ndarray it is passed to becomes 'object', as you pointed out, and that is not something one would naturally expec, as basic numerical functions don't work well with the 'object' dtype (just try N.sqrt(N.array([1],dtype=N.object)) to see what I mean). Even if we can construct a mask rather easily at the creation of the masked array, following your 'a==masked' suggestion, we still need to get the dtype of the non-masked section, and that doesn't seem trivial...
A good candidate for "should be masked" marked is NaN. It is supposed to mean, more or less, "no sensible value". Unfortunately, integer types do not have such a special value. It's also conceivable that some user might want to keep NaNs in their array separate from the mask. Finally, on some hardware, operations with NaN are very slow (so leaving them in the array, even masked, might not be a good idea).
It has always been my experience (on various flavors or Pentium) that operating on NANs is extremely slow. Does anyone know on what hardware NANs are *not* slow? Of course it's always possible I just never notice NANs on hardware where they aren't slow. [SNIP] -tim ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642