I have a large tuple and I want to elements of the tuples into groups of 6 elements like this:
{{a1, a2, a3, a4, a5, a6, a7, a8}, {a3, a2, a1, a6, a5, a4, a8,
a7}, {-a1 - a3, a2, a1, -a4 - a6, a5, a4, -a7 - a8, a7}, {a1,
a2, -a1 - a3, a4, a5, -a4 - a6, a7, -a7 - a8}, {-a1 - a3, a2,
a3, -a4 - a6, a5, a6, -a7 - a8, a8}, {a3, a2, -a1 - a3, a6,
a5, -a4 - a6, a8, -a7 - a8}}.
This is the input and output samples but with a small number of elements.
inputTup = {{1, 2, 3, 4, 5, 6, 7, 8}, {3, 2, 1, 6, 5, 4, 8, 7}, {-4,
2, 1, -10, 5, 4, -15, 7}, {1, 2, -4, 4, 5, -10, 7, -15}, {-4, 2,
3, -10, 5, 6, -15, 8}, {3, 2, -4, 6, 5, -10, 8, -15}, {1, 2, 3, 4,
5, 6, 8, 8} , {1, 1, 3, 4, 5, 6, 7, 8}};
outputSample = {{1, 2, 3, 4, 5, 6, 7, 8}, {3, 2, 1, 6, 5, 4, 8,
7}, {-4, 2, 1, -10, 5, 4, -15, 7}, {1, 2, -4, 4, 5, -10,
7, -15}, {-4, 2, 3, -10, 5, 6, -15, 8}, {3, 2, -4, 6, 5, -10,
8, -15}};
How can I do it? I thought about Gather function but still not able to implement it with this large selection conditions like this.
EDIT:
As it seems like my question not clear enough, I will give another example of simpler problem but of same form.
Assume that I have a list of list like this. The list here has 8 sublists but in reality there are much more.
input = {{1, 2, 3}, {1, 0, 1}, {-2, 1, 3}, {1, -2, 3}, {0, 1, 1}, {1, 0,
1}, {1, 0, 0}, {1, 2, 5}}
Now I want to group tuples of the form below into groups:
{{a1, a2, a3}, {-a2, a1, a3}, {a1, -a2, a3}}
where a1, a2, a3 can be any number.
And this is the desired output. Notice that there are two groups satisfying the condition above.
output ={{{1, 2, 3}, {-2, 1, 3}, {1, -2, 3}}, {{1, 0, 1}, {0, 1, 1}, {1, 0,
1}}, {1, 0, 0}, {1, 2, 5}}
Two groups satisfying the condition above:
group1 = {{1, 2, 3}, {-2, 1, 3}, {1, -2, 3}}
group2 = {{1, 0, 1}, {0, 1, 1}, {1, 0, 1}}
{a1, a2, a3}
into{-a2, a1, a3}
into{a1, -a2, a3}
into{a1, a2, a3}
? (I don't think it even needs to be invertible, but that would help.) That way, you can use the operation to define an equivalence relation, and then you'd be able to useGather
orGatherBy
with a functionalized version of the operation. $\endgroup$