[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help setting up an array



Apologies if this is trivial, but I have been working for about 8 hours
on it and can't even begin to see how to code it in IDL. Any help very
gratefully received. I am setting up a function which receives the
location of points in n-dimensional space for m fields, as well as their
weights. On call the function does not know the size of any of these
dimensions.

Simplifying to m=1 (this m dimension should be trivial) the input is:

an array of size (n x npoints) locations of each point in the
n-dimensional space

a vector of size (npoints) the weights.

Now, what I want to be able to do is re-bin these points into an
n-dimensional discretized space array which encloses all points. I can
work out the limits of this space by simply finding min and max in each
of the n dimensions of the location array. I then need to split this
grid into nbox n-dimensional discrete boxes (say 50 divisions per
dimension, boxes need not be of equal size in each dimension) and place
the respective points in their boxes in this finite representation,
weighted by weight (trivial). 

At present I am having two major problems:

1. How to declare this discretized array and the limits in n-dimensional
space of each box into which I bin my values given that I know n and
nbox.

and doubtless much more difficult to overcome:

2. How to sensibly code selection criteria to ascertain whether a
particular value belongs to a particular grid box.

Perhaps it is not possible to code without an a priori knowledge of n -
the dimensionality of the problem to know how many for loops to use? I
can't see how where statements could be used.

Any help or useful pointers very gratefully received.

Thanks

Peter