[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Need Help with Distance Algorithm in Numeric
Kamilche <klachemin@xxxxxxxxxxx>:
>
> That does work for the case you show... yay! But the arrays will be
> arbitrarily large... and if you add even one more entry to your first
> array, it fails with this error:
>
> ValueError: frames are not aligned
Uhm, yes, it seems I've got some dimensions confused here :)
> It's failing on the 'sum' calculation in the distance function.
Yeah. Upon brief reflection it seems to me that the "..." gobbled up
one dimension too many, and that ":" is, in fact, warranted:
all_dists = dist(first, second[:, NewAxis])
It does seem to work, at least -- but, then again, so did the previous
code, and it's late ;)
--
Magnus Lie Hetland Fall seven times, stand up eight
http://hetland.org [Japanese proverb]