I have a matrix such as:
tT = {{a, b, c}, {d, e, f}, {g, h, i}};
a = {{0, 0, 1}, {0, 1, 0}, {1, 0, 0}};
b = {{1, 0, 0}, {0, 0, 0}, {0, 1, 0}};
c = {{0, 0, 0}, {1, 0, 1}, {0, 0, 0}};
d = {{1, 0, 0}, {0, 1, 0}, {0, 1, 0}};
e = {{0, 1, 0}, {1, 0, 0}, {1, 0, 0}};
f = {{0, 1, 0}, {1, 0, 0}, {0, 0, 1}};
g = {{1, 0, 0}, {0, 0, 0}, {0, 0, 1}};
h = {{0, 0, 0}, {0, 1, 0}, {0, 0, 0}};
i = {{1, 0, 0}, {0, 0, 0}, {1, 0, 0}};
That the picture of matrix is same as:
In the first step, I want to compare elements of tT11 with the elements of tT12, also compare between elements of tT11 with the elements of tT13. Moreover, compare between elements of tT12 with the elements of tT13. After that tT21 with tT22 and tT23 and so on.
If at least one of the corresponding elements of tT11 and tT12 are simultaneously equal to 1, I want to put a zero instead for all elements in tT12. Also, I want to make the same comparison, between elements of tT11 with the elements of tT13 with the same condition. (moreover, tT12 and tT13). Also the corresponding element in other rows. I write below line:
Do[
If[tT[[r, n, k, q]] == tT[[r, m, k, q]]==1,
Do[tT[[r, m, x, y]] = 0,{x,1,3},{y,1,3}]],
{r, 1, 3}, {n, 1, 2}, {k, 1, 3}, {q, 1, 3}, {m, n + 1, 3}]
Actually, my desire is to get the result that I bring it below: I am going to generalize this goal to a much larger matrix and this matrix (tT 3*3) is just an example. How can I modify above written process (code) for more efficiency. How can I replace other commands instead of two Do
loops. My desired result is:
Thank you so much for your attention.
T23_33
is equal to0
in your example. (same goes withT33_31
) $\endgroup$