Given two set A and B of matrices containing 5 elements. For example:
A B
1 0 0 1 0 0
0 1 0 0 1 0
0 0 1 0 0 1
-1 -1 -1 0 1 0
0 1 0 1 0 0
0 0 1 0 0 1
-1 0 0 -1 0 0
0 -1 0 0 -1 0
0 0 -1 0 0 -1
-1 0 0 0 1 0
0 0 -1 1 0 0
0 -1 0 0 0 -1
-1 -1 -1 -1 0 0
0 0 1 0 0 1
1 0 0 0 -1 0
How can a unique similarity transform be found which maps each matrix in A onto the corresponding matrix in B. In other words, is there an efficient algorithm/method capable of finding $S$ such that $$S A_i S^{-1} = B_i $$ for every i.