[Numpy-discussion] Generalized ufuncs?

Charles R Harris charlesr.harris@gmail....
Mon Aug 18 00:43:07 CDT 2008

On Sun, Aug 17, 2008 at 9:15 PM, Robert Kern <robert.kern@gmail.com> wrote:

> On Sun, Aug 17, 2008 at 21:55, Anne Archibald <peridot.faceted@gmail.com>
> wrote:
> > 2008/8/17 Robert Kern <robert.kern@gmail.com>:
> >>
> >> I suggested that we move it to a branch for the time being so we can
> >> play with it and come up with examples of its use. If you have
> >> examples that you have already written, I would love to see them. I,
> >> for one, am amenable to seeing this in 1.2.0, but only if we push back
> >> the release by at least a few weeks.
> >
> > This is not a worked example, but this is exactly what is needed to
> > make possible the "arrays of matrices" functions that were discussed
> > some time ago. For example, users frequently want to do something like
> > multiply an array of matrices by an array of matrices; that is not
> > currently feasible without a very large temporary array (or a loop).
> >
> > But I think you were looking for examples of code using the interface,
> > to see whether it worked well.
> I'll take what I can get. In order of increasing utility:
>  1. Descriptions of use cases (as above).

It is also possible to do sums, cumulative sums, and other such things. A
generalization of the proposed ufuncs useful for these sorts of things would
be mixed type arguments, which would also help in implementing such things
as argsort and casting. This requires a different kind of infrastructure for
defining and looking up the ufuncs, but I don't think of this as a
complication, but rather a simplification as it would allow us to make good
use of the code generator and introduce a certain uniformity to the
implementation of numpy.  Uniformity is good.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080817/154febad/attachment.html 

More information about the Numpy-discussion mailing list