Haris Rhrlp
2012-Nov-11 08:03 UTC
[R] Changing the signs in rows or columns in matrices and check the matrices if they are identical
i have this problem with matrices i want to check between two matrices if they are isomorphic i will give an example for what excactly i want 1 -1 1 -1 1 1 -1 1 -1 1 -1 -1 1 1 -1 1 1 -1 this two matrices are isomorphic beacause if i change the first 2 columns the matrices are identical 1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 1 1 -1 1 -1 1 this two matrices are isomorphic because if i change the first 2 rows the matrices are identical 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 -1 1 this two matrices are isomorphic because in the third line if i change the signs the two matrices are identical 1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 -1 -1 this two matrices are isomorphic because in the second column if i change the signs the two matrices are identical and all the above together rA <- apply(BB2[,,1,(j-1)],1,paste,collapse=" ") rB <- apply(BB2[,,i,(j-1)],1,paste,collapse=" ") cA <- apply(BB2[,,1,(j-1)],2,paste,collapse=" ") cB <- apply(BB2[,,i,(j-1)],2,paste,collapse=" ") iso <- all(sort(rA) == sort(rB)) | all(sort(cA) == sort(cB)) this is only for the change or rows and columns but i want to change the signs too. [[alternative HTML version deleted]]