Hey guys,

I'm looking for a little input on something I'm about to implement. I figure some of you guys might be interested in thinking about this a little bit if you haven't already before.

So, I have two lists of objects that I have positions of in RA and Dec - essentially spherical coordinates for the uninitiated. One list of objects is rather short - about 100 or less - and the other is potentially quite long - perhaps 2 or 3 thousand.

What needs to be done is to match each one of these objects in the short list to the closest object in the second list. So, obviously, the slow way to do this is to take object 1 from the short list and compare its distance against each one of the long list. I am saying this just to illustrate what needs to be done!

So, I'm thinking of implementing a KD tree form from Numerical Recipes in C in order to do this. Basically, I'll just construct the tree from the large list, and then feed every element from the small list into it and pull out the value that I need. Do any of you gurus out there have any input on perhaps efficient ways to do this, or other methods I should look at? I'm just looking for a little input on alternatives!

Thanks in advance for your help!