Hello Zhao, here is another approach to your problem :
(*Your matrices *)
A = {{-I, 0, 0, 0}, {0, I, 0, 0}, {0, 0, 0, -I}, {0, 0, -I, 0}};
B = {{0, 1, 0, 0}, {-1, 0, 0, 0}, {0, 0, 0, I}, {0, 0, I, 0}};
(* Are they conjugates , do they have the same Eigenvalues (Thanks to Daniel) ?*)
Eigenvalues[A]
Eigenvalues[B]
(* The potential Matrix for the transformation *)
mm = Table[m[i, k], {i, 1, 4}, {k, 1, 4}];
mm // MatrixForm
(* Make an equation for your problem *)
e1 = # == 0 & /@ Flatten[A.mm - mm.B]
(* and transform it to an algebraic problem *)
e2 = CoefficientArrays[e1, Flatten[mm]]
(* get the according matrix *)
e3 = Normal[e2][[2]];
e3 // MatrixForm
(*check whether a solution is possible ( that means det = 0 ) *)
Det[e3]
(* There are 16 - rank of matrix = 8 solutions of the problem *)
MatrixRank[e3]
(*Find the solutions to the enhanced problem *)
vecs = NullSpace[e3]
(* Transform the solution vectors back to matrices *)
mats = Partition[#, 4] & /@ vecs
(* each fulfills the original problem, as it must be *)
Simplify[A.# - #.B] & /@ mats
(* but none is invertible *)
Det[#] & /@ mats
(* so sum them up *)
mat = Total[mats]
Det[mat]
(* and *)
A.mat - mat.B