On Friday 05 of January 2007 19:29, Matt Knox wrote:
> > On Friday 05 of January 2007 17:42, Matt Knox wrote:
> > > -
> > > Example 1 - exponential moving average:
> > >
> > > # naive brute force method...
> > > def expmave(x, k):
> > > result = numpy
> Are you sure about this? I ran this case using timeit, and the first one
> was 5 times or so *faster* than the second case. I just dug around and
> frompyfunc is acutally implemented in C, although it has to call back
> into python to execute the function being vectorized. Can you try using
>
Matt Knox wrote:
>>> You might want to look at frompyfunc:
>>>
>>> def expmave2(x, k):
>>> def expmave_sub(a, b):
>>> return a + k * (b - a)
>>> return np.frompyfunc(expmave_sub, 2, 1).accumulate(x)
>>>
>>>
>>> It's amazing wha
> >>
> > You might want to look at frompyfunc:
> >
> > def expmave2(x, k):
> > def expmave_sub(a, b):
> > return a + k * (b - a)
> > return np.frompyfunc(expmave_sub, 2, 1).accumulate(x)
> >
> >
> > It's amazing what you find when you dig around.
Tim Hochberg wrote:
>A. M. Archibald wrote:
>
>
>[SNIP]
>
>
>>Really it would be nice if what vectorize() returned were effectively
>>a ufunc, supporting all the various operations we might want from a
>>ufunc (albeit inefficiently). This should not be difficult, but I am
>>not up to writing it
Tim Hochberg wrote:
> A. M. Archibald wrote:
>
>
> [SNIP]
>
>> Really it would be nice if what vectorize() returned were effectively
>> a ufunc, supporting all the various operations we might want from a
>> ufunc (albeit inefficiently). This should not be difficult, but I am
>> not up to writing
A. M. Archibald wrote:
[SNIP]
>
> Really it would be nice if what vectorize() returned were effectively
> a ufunc, supporting all the various operations we might want from a
> ufunc (albeit inefficiently). This should not be difficult, but I am
> not up to writing it this evening.
>
You might
On 05/01/07, Charles R Harris <[EMAIL PROTECTED]> wrote:
> On 1/5/07, Tim Hochberg <[EMAIL PROTECTED]> wrote:
> > Matt Knox wrote:
> > > Basically, I'd like to be able to do accumulate operations with custom
> functions. numpy.vectorize does not seem to provide an accumulate method
> with the func
Matt Knox wrote:
> I made a post about this a while ago on the scipy-user mailing list, but I
> didn't receive much of a response so I'm just throwing it out there again
> (with more detail) in case it got overlooked.
>
> Basically, I'd like to be able to do accumulate operations with custom
> f
On 1/5/07, Tim Hochberg <[EMAIL PROTECTED]> wrote:
Matt Knox wrote:
> I made a post about this a while ago on the scipy-user mailing list, but
I didn't receive much of a response so I'm just throwing it out there again
(with more detail) in case it got overlooked.
>
> Basically, I'd like to be a
Matt Knox wrote:
> I made a post about this a while ago on the scipy-user mailing list, but I
> didn't receive much of a response so I'm just throwing it out there again
> (with more detail) in case it got overlooked.
>
> Basically, I'd like to be able to do accumulate operations with custom
> f
>
> On Friday 05 of January 2007 17:42, Matt Knox wrote:
> > -
> > Example 1 - exponential moving average:
> >
> > # naive brute force method...
> > def expmave(x, k):
> > result = numpy.array(x, copy=True)
> > for i in range(1, result.size):
> >
On Friday 05 of January 2007 17:42, Matt Knox wrote:
> -
> Example 1 - exponential moving average:
>
> # naive brute force method...
> def expmave(x, k):
> result = numpy.array(x, copy=True)
> for i in range(1, result.size):
>result[i] = r
I made a post about this a while ago on the scipy-user mailing list, but I
didn't receive much of a response so I'm just throwing it out there again (with
more detail) in case it got overlooked.
Basically, I'd like to be able to do accumulate operations with custom
functions. numpy.vectorize d
14 matches
Mail list logo