I have two lists, which we'll call testList
and modifiedTestList
. The first list looks something like this:
testList = Table[RandomReal[{0, 1000}, {RandomInteger[{0, 32}], 2}], {i, 1, 10}];
To generate modifiedTestList
, I can flatten testList
by strictly one level (never breaking up the pairs of real numbers specifying 2D coordinates), scramble the elements, and select and prune elements. For example:
modifiedTestList = Flatten[testList, 1];
modifiedTestList = RandomSample[modifiedTestList, Length[modifiedTestList]];
modifiedTestList = Select[modifiedTestList, #[[1]] > 700 &];
Once I've had my fun, I'd like to take testList
and prune away all of the 2D coordinates that no longer exist in modifiedTestList
while respecting the original array structure of testList
(i.e. testList
should not be flattened and elements should not be moved between subarrays).
Let's say testList
and modifiedTestList
are both quite large ($>10^6$ elements each). Is there a fast way to do the above pruning provided these large data structures?