Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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:

enter image description here

In the first step, I want to comprise, elements of tT11 with the elements of tT12, also comprise between elements of tT11 with the elements of tT13. Moreover, comprise 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 of all elements in tT12. Also, there is such comprising between elements of tT11 with the elements of tT13 with the same condition.(moreover, tT12 and tT13). Also corresponded element in other rows. I write bellow 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 bellow: I am going to generalize this goal to a very 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's. my desire result is:
enter image description here

Thank you so much for your attention

share|improve this question
    
By "If simultaneously, just one of the element of tT11 and tT12 equal to 1 ...",do you mean "one and only one" or "at least one"? –  belisarius Jun 2 at 14:39
    
at least one. ok I will correct the sentence. –  mostafa Jun 2 at 14:40
    
@mostafa See a closely related post How to Flatten Array of Arrays of the highest order in a simple way?. –  Artes Jun 2 at 21:14
    
@mostafa I don't really understand why T23_33 is equal to 0 in your example. (same goes with T33_31) –  Öskå Jun 3 at 12:22
    
What is T23_33? –  mostafa Jun 3 at 13:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.