[Numpy-discussion] numpy1.2 : make sorts unary ufuncs
Charles R Harris
Sat Apr 19 01:55:49 CDT 2008
On Sat, Apr 19, 2008 at 12:20 AM, Travis E. Oliphant <firstname.lastname@example.org>
> Charles R Harris wrote:
> > The signature for a ufunc is something like
> > @TYPE@_@kind@(char **args, intp *dimensions, intp *steps, void *func)
> > Which contains all the info necessary to do a sort. Means and other
> > such functions could also be implemented that way.
> I dont' think the ufunc is the right place for this. Perhaps sorting
> can be viewed however as a "general function" which I'd like to add.
> Maybe, in that case the ufunc could be a special case of the "general
> function" concept. But, that is the direction I would expect the
> discussion to go.
> The ufunc object is a very particular kind of thing. The 1-d inner
> loop signature is a key part of it, but there is more to it than that.
> I don't see how the sorting function can be pushed into this concept.
Yes, but the inner loop is just something that uses the array values along
that axis to produce another set of values, i.e., it is a vector valued
function of vectors. So is a sort, so is argsort, so is the inner product,
so on and so forth. That's what we have here:
typedef void (*PyUFuncGenericFunction) (char **, npy_intp *, npy_intp *,
No difference that I can see. It is the call function in PyUFuncObject that
> But, there is a case to be made for perhaps figuring out how to merge
> the data-type functions and the ufuncs into one idea that allows for
> better code re-use.
I don't think we can get all of them, but I think we can get most.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion