[Numpy-discussion] Using sum() within a function
Perry Greenfield
perry at stsci.edu
Mon Aug 16 10:10:05 EDT 2004
Jim Cser wrote:
>
> The loop was indeed wrong, and "tempval = 0.*x" was the trick I needed,
> thanks. Unfortunately, iterating over t is still extremely slow.
> Ideally, there would be a way to use fromfunction() with slices as
> arguments.
If the other 3 dimensions are small (e.g., each time sample
involves an array whose size is less than 1000 elements total),
then the slowness is due to the small arrays. In that event
you may want iterate over a different dimension than time, or
construct the for loop to iterate over ranges of times rather
than one at a time.
Perry
More information about the NumPy-Discussion
mailing list