symplectify makes a matrix more symplectic follow Healy algorithm as described by McKay BNL-75461-2006-CP
0001 function MS=symplectify(M) 0002 %symplectify makes a matrix more symplectic 0003 %follow Healy algorithm as described by McKay 0004 %BNL-75461-2006-CP 0005 0006 J=jmat(3); 0007 V=J*(eye(6)-M)*inv(eye(6)+M); 0008 %V should be almost symmetric. Replace with symmetrized version. 0009 0010 W=(V+V')/2; 0011 %Now reconstruct M from W 0012 MS=(eye(6)+J*W)*inv(eye(6)-J*W);