I would like to know if it is possible to have "nested arrays", that is to say an array that contains arrays that have different shapes.
I have a list of lists of coordinates, so something like:
coord = [ [ [x1,y1],[x2,y2] ], [ [x3,y3],[x4,y4],[x5,y5] ], [ [x6,y6] ] ]
I would like to convert all these lists into arrays, so I can do mathematical operations with it. The result would be a (3,)-array containing 3 arrays (one at each position) of respective shapes (2,2) (corresponding to the nested list [ [x1,y1],[x2,y2] ]
), (3,2) and (1,2).
The final goal is to be able do to something like result = coord + [x7,y7]
, to beneficiate from the properties of matricial operations in Python (I was told that it was much more efficient than doing loops, and I have a lot of coordinates).
The result would be:
result = [ [ [x1+x7,y1+y7],[x2+x7,y2+y7] ], [ [x3+x7,y3+y7],[x4+x7,y4+y7],[x5+x7,y5+y7] ] ]