[Numpy-discussion] Are masked arrays slower for processing than ndarrays?
Wed May 13 18:47:24 CDT 2009
On May 13, 2009, at 7:36 PM, Matt Knox wrote:
>> Here's the catch: it's basically cheating. I got rid of the pre-
>> processing (where a mask was calculated depending on the domain and
>> the input set to a filling value depending on this mask, before the
>> actual computation). Instead, I force
>> np.seterr(divide='ignore',invalid='ignore') before calling the ufunc
> This isn't a thread safe approach and could cause wierd side effects
> in a
> multi-threaded application. I think modifying global options/
> variables inside
> any function where it generally wouldn't be expected by the user is
> a bad idea.
Whine. I was afraid of something like that...
2 options, then:
* We revert to computing a mask beforehand. That looks like the part
that takes the most time w/ domained operations (according to Robert
K's profiler. Robert, you deserve a statue for this tool). And that
doesn't solve the pb of power, anyway: how do you compute the domain
of power ?
* We reimplement masked versions of the ufuncs in C. Won't happen from
me anytime soon (this fall or winter, maybe...)
Also, importing numpy.ma currently calls numpy.seterr(all='ignore')
So that's a -1 from Matt. Anybody else ?
More information about the Numpy-discussion