Re: [Numpy-discussion] Writing new ufuncs

2008-05-11 Thread Robert Kern
On Mon, May 12, 2008 at 12:37 AM, Anne Archibald <[EMAIL PROTECTED]> wrote: > 2008/5/11 Robert Kern <[EMAIL PROTECTED]>: > >> Perhaps, but ufuncs only allow 0 or 1 for this value, currently. > > That's a shame, minus infinity is the identity for maximum too. > >> Also, I was wrong about using PyUFu

Re: [Numpy-discussion] Writing new ufuncs

2008-05-11 Thread Anne Archibald
2008/5/11 Robert Kern <[EMAIL PROTECTED]>: > Perhaps, but ufuncs only allow 0 or 1 for this value, currently. That's a shame, minus infinity is the identity for maximum too. > Also, I was wrong about using PyUFunc_ff_f. Instead, use PyUFunc_ff_f_As_dd_d. Hmm. Well, I tried implementing logsum()

Re: [Numpy-discussion] Writing new ufuncs

2008-05-11 Thread Robert Kern
On Sun, May 11, 2008 at 9:50 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > 2008/5/11 Robert Kern <[EMAIL PROTECTED]>: > >> Basically, you need 3 arrays: functions implementing the type-specific >> inner loops, void* extra data to pass to these functions, and an array >> of arrays containing the t

Re: [Numpy-discussion] Writing new ufuncs

2008-05-11 Thread Anne Archibald
2008/5/11 Robert Kern <[EMAIL PROTECTED]>: > Basically, you need 3 arrays: functions implementing the type-specific > inner loops, void* extra data to pass to these functions, and an array > of arrays containing the type signatures of the ufunc. In numpy, we > already have generic implementations

Re: [Numpy-discussion] Writing new ufuncs

2008-05-11 Thread Robert Kern
On Sun, May 11, 2008 at 1:04 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > Hi, > > Suppose I have a C function, > double logsum(double a, double b); > What is needed to produce a ufunc object whose elementwise operation > is done by calling this function? Basically, you need 3 arrays: functions

Re: [Numpy-discussion] Writing new ufuncs

2008-05-11 Thread Anne Archibald
2008/5/11 Alan McIntyre <[EMAIL PROTECTED]>: > On Sun, May 11, 2008 at 2:04 PM, Anne Archibald > <[EMAIL PROTECTED]> wrote: >> Also, is there a way to take a python function and automatically make >> a ufunc out of it? (No, vectorize doesn't implement reduce(), >> accumulate(), reduceat(), or ou

Re: [Numpy-discussion] Writing new ufuncs

2008-05-11 Thread Alan McIntyre
On Sun, May 11, 2008 at 2:04 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > Also, is there a way to take a python function and automatically make > a ufunc out of it? (No, vectorize doesn't implement reduce(), > accumulate(), reduceat(), or outer().) I've not used it, but have a look at numpy.

[Numpy-discussion] Writing new ufuncs

2008-05-11 Thread Anne Archibald
Hi, Suppose I have a C function, double logsum(double a, double b); What is needed to produce a ufunc object whose elementwise operation is done by calling this function? Also, is there a way to take a python function and automatically make a ufunc out of it? (No, vectorize doesn't implement redu