I have two sets of numbers, e.g.,
[A1 A2 A3]
[B1 B2 B3].
Now I want to swap some of them between the two sets, but the numbers should always stay at the same position.
Some possibilities would be: [B1 A2 A3] and [A1 B2 B3];
[A1 B2 B3]
[B1 A2 A3].
in case of 2x3 numbers there are
- 1(intitial position, would be the same as swapping all three)
- 3(single swaps)
- 3(double swaps)
- = 7 possibilites.
It's basically very easy, I probably explained it too complicated. But I cannot figure out how to produce this with perms or some other function. it would already be very helpful just to get a matrix like
for any size of n, which I could then use as index 1 means swapping 0 means change nothing.