2

I want to find all the equivalent matrices of a matrix, let's say it as M, but I want these equivalent matrices to have exactly the same diagonal elements with M and the same non-diagonal elements with M.

For example if M is

> M<-matrix(x,4,4);M
     [,1] [,2] [,3] [,4]
[1,]   22   -2   -2    2
[2,]   -2   22    2    2
[3,]   -2    2   22   -2
[4,]    2    2   -2   22 

I want one of the equivalent matrix to be for example

     [,1] [,2] [,3] [,4]
[1,]   22    2   -2    2
[2,]    2   22    2   -2
[3,]   -2    2   22   -2
[4,]    2   -2   -2   22

As you can see not only M,but also all the equivalent matrices must be symmetric (M=transpose(M)).

I have tried lots of ways, such as "permut" and "Matrix" packages, but I can't find something to help me. I have used LU and QR decomposition, but it's not what I want.

Is there something to do with this problem???

Thank you all!

Vassilis Chasiotis
  • 427
  • 1
  • 3
  • 15

0 Answers0