I am new to Julia and I must store and access a weirdly shaped dataset, for which I would like to ask your advice. It’s not very easy to explain what I must do.
I must store in a variable, let say A
, a collection of points with coordinates in 2D, with the following requirements (I know that I am violating basic conventions of arrays, below, I am just trying to get my point across):
-
Consider two integers
K, J
. For each couple of integers(k,j)
, wherek=1,...,K
, andj = 1,...,J
, thenA(k,j)
containsn_{k,j}
points each having coordinates x and y.A(k,j)
can be an array with 2 columns andn_{k,j}
rows, but it does not need to be an array, strictly speaking. For instanceA(1,1)
may contain 3 points(x1,y1), (x2,y2), (x3,y3)
in whatever format is best, whileA(1,2)
may contain 5 points(x1,y1), ..., (x5,y5)
. -
While the dataset is generated, I will sort points by their x coordinates, so that
A(k,j)
should store points according with increasing values of x, so thatx1 <= x2 <= ...
-
Typically, I will need access only the ‘topmost’ elements of
A(k,j)
, in the sense that I will need access for some time to the point with coordinatex1
, and then, from some moment onward, only to the point with coordinatex2
, and so on. -
Finally, the number
(K,J)
in which the index(k,j)
can vary may be moderately large.
I am not after the best or most performing solution: I am just starting to prototype for now, and for now I would like to know what is a good data structure I could use in Julia to store A. I will experiments with K
and J
in the order of hundreds, before potentially scaling up.
Thanks in advance