Re: [Numpy-discussion] Array of Callables

2007-03-21 Thread Anne Archibald
On 21/03/07, Andrew Corrigan <[EMAIL PROTECTED]> wrote: > Thanks for pointing that out. Technically that works, but it doesn't really > express this operation as concisely and as naturally as I'd like to be able > to. > > What I really want is to be able to write: > > >>> a = array([lambda x: x**

Re: [Numpy-discussion] Array of Callables

2007-03-21 Thread Andrew Corrigan
Good point! I think I will, Thanks a lot. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array of Callables

2007-03-21 Thread Shane Holloway
On Mar 21, 2007, at 6:58 AM, Anne Archibald wrote: > Vectorizing apply is what you're looking for, by the sound of it: > In [13]: a = array([lambda x: x**2, lambda x: x**3]) > > In [14]: b = arange(5) > > In [15]: va = vectorize(lambda f, x: f(x)) > > In [16]: va(a[:,newaxis],b[newaxis,:]) > Out[

Re: [Numpy-discussion] Array of Callables

2007-03-21 Thread Michael McLay
On Wednesday 21 March 2007 09:52, Andrew Corrigan wrote: > Anne Archibald gmail.com> writes: > > Vectorizing apply is what you're looking for, by the sound of it: > > In [13]: a = array([lambda x: x**2, lambda x: x**3]) > > > > In [14]: b = arange(5) > > > > In [15]: va = vectorize(lambda f, x: f(

Re: [Numpy-discussion] Array of Callables

2007-03-21 Thread Andrew Corrigan
Anne Archibald gmail.com> writes: > Vectorizing apply is what you're looking for, by the sound of it: > In [13]: a = array([lambda x: x**2, lambda x: x**3]) > > In [14]: b = arange(5) > > In [15]: va = vectorize(lambda f, x: f(x)) > > In [16]: va(a[:,newaxis],b[newaxis,:]) > Out[16]: > array([

Re: [Numpy-discussion] Array of Callables

2007-03-21 Thread Anne Archibald
On 21/03/07, Andrew Corrigan <[EMAIL PROTECTED]> wrote: > This is a feature I've been wanting for a long time, so I'm really glad that > Shane brought this up. > > While I was hoping for a gain in speed, that isn't the only reason that I > would > like to see this added. In fact, the most compel

Re: [Numpy-discussion] Array of Callables

2007-03-21 Thread Andrew Corrigan
Robert Kern gmail.com> writes: > > Shane Holloway wrote: > > To the vector-processing masters of numpy! > > > > I'm wanting to optimize calling a list (or array) of callable > > objects. Consider the following: > > > > vCallables = numpy.array([ > classes, builtin functions>]) > > vParam1

Re: [Numpy-discussion] Array of Callables

2007-03-20 Thread Robert Kern
Shane Holloway wrote: > To the vector-processing masters of numpy! > > I'm wanting to optimize calling a list (or array) of callable > objects. Consider the following: > > vCallables = numpy.array([ classes, builtin functions>]) > vParam1 = numpy.array([]) > vParam2 = numpy.array([]) > vParam3

[Numpy-discussion] Array of Callables

2007-03-20 Thread Shane Holloway
To the vector-processing masters of numpy! I'm wanting to optimize calling a list (or array) of callable objects. Consider the following: vCallables = numpy.array([]) vParam1 = numpy.array([]) vParam2 = numpy.array([]) vParam3 = numpy.array([]) vResults = numpy.array([None for e in vCallables]