[Numpy-discussion] Quaternion dtype for NumPy - initial implementation available

Martin Ling martin-numpy at earth.li
Sun Jul 17 16:24:12 EDT 2011


On Sun, Jul 17, 2011 at 05:52:19PM +0200, Ralf Gommers wrote:
> 
>    Looks very interesting.
> 
>    One thing that is surprising to me is that the quaternion dtype is
>    inserted in to the numpy namespace. For dtypes that are planned to be
>    integrated with numpy later on perhaps this makes sense, but in general
>    this doesn't look right I think. Can you explain your reasoning to do it
>    like this?

To be honest I didn't think about it a great deal; the basic glue code
of the package was copied directly from Mark Weibe's numpy_half module.

In retrospect, the rationale is that I would like to see this dtype
integrated into NumPy, so the implementation aims to show exactly what
that would look like to the user. I would have written this as a patch
to NumPy had Mark not shown me it was possible to write it separately.

In the general case I would agree with you that application-specific
dtypes should not go into the numpy namespace. I think this is a
sufficiently general thing that it would be worth including there - it's
just another sort of number, after all. That said, I would have no major
objections to this being a separate package and not touching the numpy
namespace. The key thing is just that it's usable as a dtype.

However, if this is going to be a separate package then I'd like to be
sure that it's not going to be broken by internal changes to NumPy in
the future. At present there is no official documentation of how to
write an external dtype.


Martin



More information about the NumPy-Discussion mailing list