[Numpy-discussion] is __array_ufunc__ ready for prime-time?

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Thu Nov 2 14:39:42 EDT 2017


Hi Josef,

Indeed, for some applications one would like to have different units
for different parts of an array. And that means that, at present, the
quantity implementations that we have are no good at storing, say, a
covariance matrix involving parameters with different units, where
thus each element of the covariance matrix has a different unit. I
fear at present it would have to be an object array instead; other
cases may be a bit easier to solve, by, e.g., allowing structured
arrays with similarly structured units. I do note that actually doing
it would clarify, e.g., what the axes in Vandermonde (spelling?)
matrices mean.

That said, there is truly an enormous benefit for checking units on
"regular" operations. Spacecraft have missed Mars because people
didn't do it properly...

All the best,

Marten

p.s. The scipy functions should indeed be included in the ufuncs
covered; there is a fairly long-standing issue for that in astropy...


More information about the NumPy-Discussion mailing list