Solved

# matrix elements counting

Posted on 2011-03-17

Hello,

I have the following matrix of 1s a,d 0s

5x6: 5x5

r1 1 1 0 0 1 1 4 2 3 2 2

r2 1 0 0 0 1 0 2 2 2 0 1

r3 1 0 1 0 1 1 => 3 2 4 2 3

r4 0 1 1 1 0 1 2 0 2 4 3

r5 1 0 1 0 0 1 2 1 3 3 3

What i want to do as un can see in the example is to compare:

1 with 1 2 with 1 etc.....

1 with 2 2 with 2

1 with 3 2 with 3

1 with 4 2 with 4

1 with 5 2 with 5

when i compre for example r1 with all the rows: If row === 1 i incremement the matrix(5x5) by 1 so M[1,1] = M[1,1] + 1

and see where all the element of row1 are 1 with the same elements in row2 are 1:

as u can see:

r1 1 1 0 0 1 1

r2 1 0 0 0 1 0

row1 and row2 are only similar in 2 places the M[1,2] will be equal to 2 as u can see in the 5x5 matrix/

Hope that it's clear, i'll explain it again if there is a problem.

Thank you so much