Suppose you have the following
DiagonalMatrix[{0, 0, 0, 0, 0}]
={{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}
I want to replace one 0 with one 1 in order nxn as n goes from 1 to 5 in this case.so that you would get 5 separate arrays.
={{1, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}
then
={{0, 0, 0, 0, 0}, {0,1, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}
then
={{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}
And so on. The following should work, but obviously doesn't...
Table[DiagonalMatrix[{0, 0, 0, 0, 0}][[i, i]] /. {0 -> 1}, {i, 1, 5}]
I also need to choose, in a larger array, 3 0s at a time and replace with 1s. But all such array combination must be created.
For above example,
{{1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}
can be the first combination. Then
{{0, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 0}}
and so on.
being the second. But there are far more combination possible.. I need to find all possibles.
Any help is greatly appreciated.