В Mon, 10 Oct 2011 11:20:08 -0400
Olivier Delalleau пишет:
>
> The following doesn't use numpy but seems to be about 20x faster:
>
> A_rows = {}
> for i, row in enumerate(A):
> A_rows[tuple(row)] = i
> for i, row in enumerate(B):
> C[i] = A_rows.get(tuple(row), -1)
>
В Mon, 10 Oct 2011 10:03:48 +0100
Bob Dowling пишет:
>
> On 10/10/11 09:53, Andrey N. Sobolev wrote:
>
> > I have 2 arrays - A with the dimensions of 1000x4 and B with the
> > dimensions of 5000x4. B doesn't (hopefully) contain any rows that
> > are not in A. I
Hi all,
I have 2 arrays - A with the dimensions of 1000x4 and B with the
dimensions of 5000x4. B doesn't (hopefully) contain any rows that are
not in A. I need to create a lookup array C, the i-th value of which
will be the index of B[i] in A. In the (very rare) case when B[i] is not
in A C[i] sho
Hi eat and Gary,
Thanks a lot for your suggestions, I've tried them in my code and
achieved similar speedup of ~270% for both of them. So I guess I'll
stick to one of those.
Regards,
Andrey.
> Hi,
>
> On Thu, Mar 17, 2011 at 10:44 AM, Andrey N. Sobolev
>
Dear all,
Sorry if that's a noob question, but anyway. I have several thousands of
vectors stacked in 2d array. I'd like to get new array containing
Euclidean norms of these vectors and get the vector with minimal norm.
Is there more efficient way to do this than
argmin(array([sqrt(dot(x,x)) fo