Operations on large arrays of multi-dimentional vector

#1

Hi everyone,
I am looking for an easy way to get the kind of functionality numpy and scipy.spacial modules give me in python. I have an array of about a million 9 dimensional vectors and I am looking for a way to find the closest neighbor to that vector, most likely with a kd tree.
Thoughts, anyone?

in python, it would be:

create large array of 9D vectors

A = np.random.random((1000000,9))*100

build a kd tree

Atree = spatial.KDTree(A)

initialize a 9D vector

pt = [6, 30, 47, 34, 22, 87, 38, 2, 9]

find distance to and index of closest neighbor

Atree.query(pt)