[Numpy-discussion] ‎ Find contiguous sequences of booleans in arrays

2007-09-17 Thread Kurdt Bane
Hi to all, I've got an 1-D array of bools and I'd like to find the length of the first contiguous sequence of True values, starting from position [0] of the array. (That's equivalent to find the position of the first occurrence of False in the array). The problem is trivial, but I was wondering: w

Re: [Numpy-discussion] Optimizing similarity matrix algorithm

2007-09-12 Thread Kurdt Bane
sions len(a) x len(b) where M[x][y] = (a[x] == b[y]) On 9/12/07, Kurdt Bane <[EMAIL PROTECTED]> wrote: > > Hi to all! > For reverse engineering purposes, I need to find where every possible > chunk of bytes in file A is contained in file B. Obviously, if a chunk of > length n is

[Numpy-discussion] Optimizing similarity matrix algorithm

2007-09-12 Thread Kurdt Bane
Hi to all! For reverse engineering purposes, I need to find where every possible chunk of bytes in file A is contained in file B. Obviously, if a chunk of length n is contained in B, I dont' want my script to recognize also all the subchunks of size < n contained in the chunk. I coded a naive impl