[Numpy-discussion] record arrays and vectorizing
Stéfan van der Walt
stefan at sun.ac.za
Wed May 2 15:26:45 EDT 2012
On Wed, May 2, 2012 at 11:06 AM, Moroney, Catherine M (388D)
<Catherine.M.Moroney at jpl.nasa.gov> wrote:
> I will want to compare a 7-element vector (called "element") to a large list of similarly-dimensioned
> vectors (called "target", and pick out the vector in "target" that is the closest to "element"
> (determined by minimizing the Euclidean distance).
It's not entirely clear what you mean from the description above. In
the code example, you return a single index, but from the description
it sounds like you want to pick out a vector?
If you need multiple answers, one for each element, then you probably
need to do broadcasting as shown in the NumPy medkit:
http://mentat.za.net/numpy/numpy_advanced_slides/
Stéfan
More information about the NumPy-Discussion
mailing list