comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Assign data point to n-Dimensional grid
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Assign data point to n-Dimensional grid [message #80599] Fri, 22 June 2012 07:46 Go to next message
antar3s86 is currently offline  antar3s86
Messages: 8
Registered: June 2012
Junior Member
Hi

I face a serious problem in the development of my algorithm.In principle it is very simple:

I have a data point in a 9-dimensional parameter space (say, x1,x2,x3,y1,y2,y3,z1,z2,z3) with x,y,z being physical quantities with different units. Furthermore, I have an unequally spaced 9-dimensional reference grid and all i have to do is to compute which grid point is closest to my data point with respect to all 9 dimensions.

I have to do this several billion times, so I really want to make sure to do it as fast as possible.

Any help with that?

cheers
Re: Assign data point to n-Dimensional grid [message #80691 is a reply to message #80599] Tue, 26 June 2012 00:43 Go to previous message
antar3s86 is currently offline  antar3s86
Messages: 8
Registered: June 2012
Junior Member
Hi

I have manages to find the nearest neighbor for one parameter using something like that

ii = VALUE_LOCATE(grid, x)
wh = WHERE((grid[ii+1] - x) LT (x-grid[ii]), ct)
if ct GT 0 then ii[wh] = ii[wh]+1
nn = grid(ii)

but I discovered that not all of my parameters are independent. So I split the problem up and located the independent parameters with the procedure above and the dependent ones with a 2-D search using nearestn (http://www.ifa.hawaii.edu/~beaumont/code/nearestn.html). This is a pure coincidence and if I ever have to face a problem with more dependent parameters I will have to think of something else.

Now I face a different problem which I want to describe with an example:

Suppose my grid consists of three parameters, so e.g. gridx = [2,5,10], gridy = [10,40,50], and gridz = [100,101,102]. I need to fit my data point to the first two which can be done with the nearest neighbor method I solved for now. So for two test data points, say, x = [3,11], y = [8,47] they will snap to xs = [2,10], ys = [10,50] which is the 0th and 2nd position in the grid. From that I want to know which z-value and the third grid is assigned to them.

Any ideas how to solve that, meaning how to know at which position the test data points lie in the grid?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: @named_structure % Error opening file. File: named_structure
Next Topic: Matching elements in two arrays of different sizes

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:45:47 PDT 2025

Total time taken to generate the page: 0.00481 seconds