If we know that
tuples
is constructed from ngrids
grids, and
- each grid has at least one unique element
then tuples
is constructed from ngrids
input grids and if each grid has at least one non-repeating element, we can extractget the lengthsduplicates and their counts in each of the grids using:
extractGridLengthsextractDuplicates =
Map[l |-> TotalSelect[GreaterThan[1]] @ Normalize[#, Min] & @ Counts[#[[All, l]]]] @
Range @ #2 &;
ngrids = 3;
extractGridLengths[tuplesextractDuplicates[tuples, ngrids]
{6<|0.2 -> 2|>, 6<||>, 5<|0.35 -> 2|>}
ToWe can get the duplicatesinput grids and their counts in each of the gridslengths as follows:
extractDuplicatesextractGridLengths =
Map[l |-> Select[GreaterThan[1]]Total @ Normalize[#, Min] & @ Counts[#[[All, l]]]] @
Range @ #2 &;
extractDuplicates[tuplesextractGridLengths[tuples, ngrids]
{<|0.2 -> 2|>6, <||>6, <|0.35 -> 2|>5}