SetDirectory["/www/user/fdahl/papers/Conjugation/"];
<<kappaLib.m
<<Petrov.m

V=(({{ lam1, 1, 0, 0, 0, 0}, {0, lam1, 0, 0, 0, 0}, {0, 0, lam2, 1, 0, 0}, {0, 0, 0, lam2, 0, 0}, {0, 0, 0, 0,  sigma1, tau1}, {0, 0, 0, 0, -tau1,  sigma1}}));
B=(({{0, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0}}));
W=(({{0, eps1, 0, 0, 0, 0}, {eps1, 0, 0, 0, 0, 0}, {0, 0, 0, eps2, 0, 0}, {0, 0, eps2, 0, 0, 0}, {0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 1, 0}}));

Solve S starting from expression in SWW

(* First find matrix that gives matrix in the SWW paper *)
Petrov[(({{lam1, 0, 0, 0, 0, 0}, {0, lam2, 0, 0, eps2, 0}, {0, 0, sigma1, 0, 0, -tau1}, {eps1, 0, 0, lam1, 0, 0}, {0, 0, 0, 0, lam2, 0}, {0, 0, tau1, 0, 0, sigma1}}))]

S=Table[ToExpression["s"<>ToString[i]<>ToString[j]],{i,1,6},{j,1,6}];

j1=Flatten[Transpose[S].B.S-W];
j2=Flatten[(({{lam1, 0, 0, 0, 0, 0}, {0, lam2, 0, 0, eps2, 0}, {0, 0, sigma1, 0, 0, -tau1}, {eps1, 0, 0, lam1, 0, 0}, {0, 0, 0, 0, lam2, 0}, {0, 0, tau1, 0, 0, sigma1}})).S-S.V];

sub={s11->0,s13->0,s14->0,s43->0,s44->0,s53->0,s51->0,s21->0,s52->0,s36->s65,s22->0,s35->-s66,s15->0,s16->0,s46->0,s45->0,s61->0,s31->0,s62->0,s32->0,s42->0,s63->0,s33->0,s64->0,s34->0,s56->0,s55->0,s25->0,s26->0,s66->0,s24->0,s65->1,s12->1,s41->eps1,s54->1,s23->eps2};
FullSimplify[Union[Join[j2,j1]//.sub]]//MatrixForm
S//.sub //MatrixForm

(* export .pdf *)
NotebookPrint[SelectedNotebook[],"/www/user/fdahl/papers/Conjugation/notebooks/ClassXIV_Solve.pdf"]