Ask Your Question

Revision history [back]

Symmetric matrix up to permutation of its columns

What is a quick way (if any) to decide whether a matrix is symmetric up to permutation of its columns?

Below is the slow way:

 def SymPerm(L):
    n=len(L)
    for g in SymmetricGroup(n):
        N=[[L[i][g(j+1)-1] for j in range(n)] for i in range(n)]
        M=matrix(N)
        if M==M.transpose():
            return True
    return False