Ooops! It is not like this! On 19/01/11 11:50, Ramon Crehuet wrote: > c = zeros(n) > for (i,j) in d: > k = d[i,j] > c[k] += r[i,j] it should be like: c = zeros(n) for position, value in ndenumerate(d): c[value] += r[position] This is simpler, but probably still too slow... Thanks again! Ramon