[Numpy-discussion] numarray.codegenerator.UfuncModule nary ufuncs

Todd Miller jmiller at stsci.edu
Wed Feb 9 06:33:46 EST 2005

On Wed, 2005-02-09 at 12:41 +1100, Simon Burton wrote:
> It looks like I may need to make n-ary (multi argument) ufuncs.
> The use case is something like this: some tricky function operates on single values
> but has many parameters (eg. offset and multiply). So the ufunc is called
> with an array as the first argument, but just scalars in the other arguments.
> I'm wondering how far is numarray.codegenerator.UfuncModule from handling n-ary functions ?
> If it's just not on the radar, i'll need to rethink my approach...
> bye for now,
> Simon.

The numarray n-ary ufunc system is very definitely on the radar,  but
still alpha.  Support for the kind of work you're trying to do is in the
code generation API but the ufunc runtime system needs more work for it
to be as fast as it can be.  For large arrays it should already be
pretty good.

There's an example of the nary-ufunc code generation in
numarray/Examples/ufunc/setup_special.py.  I added an example ufunc,
vsdemo(), similar in form to what I think you want,  one array input
parameter and 4 vector input parameters yielding a single value result.

Feedback is welcome.


More information about the NumPy-Discussion mailing list