Thanks Zach for your interest
I was thinking about ndimage.generic_filter when I wrote about generic filter.
For generic_filter I used trivial function that returns .sum() but I can't seem
to make the code any faster than it is.
This is the code:
You might want to have a look at :
http://code.google.com/p/glumpy/source/browse/demos/gray-scott.py
which implements a Gray-Scott reaction-diffusion system.
The 'convolution_matrix(src, dst, kernel, toric)' build a sparse matrix such
that multiplying an array with this matrix will result in
Thanks Zach
You are right. I needed generic filter - to update current point, and
not the neighbors as I wrote.
Initial code is slow loop over 2D python lists, which I'm trying to
convert to numpy and make it useful. In that loop there is inner loop
for calculating neighbors properties, which
You are right. I needed generic filter - to update current point, and not the
neighbors as I wrote.
Initial code is slow loop over 2D python lists, which I'm trying to convert
to numpy and make it useful. In that loop there is inner loop for calculating
neighbors properties, which confused
Hi,
I have 2D array, let's say: `np.random.random((100,100))` and I want
to do simple manipulation on each point neighbors, like divide their
values by 3.
So for each array value, x, and it neighbors n:
n n nn/3 n/3 n/3
n x n - n/3 x n/3
n n nn/3 n/3 n/3
I searched a bit, and found
I have 2D array, let's say: `np.random.random((100,100))` and I want to do
simple manipulation on each point neighbors, like divide their values by 3.
So for each array value, x, and it neighbors n:
n n nn/3 n/3 n/3
n x n - n/3 x n/3
n n nn/3 n/3 n/3
I searched a bit, and