Hello,

Thanks for the data examples. But you should give them in a form that's 
easy for us to copy and paste into an R session. Using ?dput, for 
instance. The examples below are the last two pairs of matrices in your 
post, the ones with different signs. fun1() checks rows and fun2() columns.

x1 <- structure(c(1, -1, 1, -1, 1, 1, 1, -1, -1), .Dim = c(3L, 3L))
y1 <- structure(c(1, -1, -1, -1, 1, -1, 1, -1, 1), .Dim = c(3L, 3L))
x2 <- structure(c(1, -1, 1, -1, 1, 1, 1, -1, -1), .Dim = c(3L, 3L))
y2 <- structure(c(1, -1, 1, 1, -1, -1, 1, -1, -1), .Dim = c(3L, 3L))


fun1 <- function(x, y){
     all(sapply(seq_len(nrow(x)), function(i)
         identical(x[i,], y[i,]) || identical(x[i,], -y[i,])))
}
fun2 <- function(x, y){
     all(sapply(seq_len(nrow(x)), function(i)
         identical(x[,i], y[,i]) || identical(x[,i], -y[,i])))
}


fun1(x1, y1)  # TRUE
fun2(x1, y1)  # FALSE

fun1(x2, y2)  # FALSE
fun2(x2, y2)  # TRUE


Hope this helps,

Rui Barradas
Em 11-11-2012 08:06, Haris Rhrlp escreveu:
> Dear R users,
>
> 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]]
>
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


	[[alternative HTML version deleted]]


