# How to adjust two Gramian matrices to make them “aligned” without enumeration?

I have two set of vectors:

V1,V2,V3,...,Vn

W1,W2,W3,...,Wn

And two Gramian matrices of them: Mv, Mw

Now I want to find an ordering of W1,W2,W3,...,Wn such that the Gramian matrix of the new order of the vectors is closed to Mv as much as possible.

In other words, repeated doing both exchange i-th column and j-th column and exchange i-th row and j-th row of matrix Mw to make it closed to Mv as much as possible.

And here are two equivalent ways to measure if one matrix is closed to another

1, Minimize the Frobenius norm of Mv-Mw

2, Maximize the Sum of the total matrix of the Hadamard product of Mv and Mw

Are there any method to find the solution without enumerating n! cases? (I tried to use Rearrangement inequality, but unfortunately it is for a sequence with every possible permutation, not for matrices in that rules)

Note that the Gramian matrix which I deal with is always a real symmetric positive-semidefiniteness matrix with only three non-zero eigenvalues