Consider the following real symmetric matrix
$M=\left[\begin{array}{ccc} A & B\\ B^T & D \end{array}\right]$
Both A and D are real symmetric $n\times n$ matrices. B is a real $n\times n$ matrix but not necessarily symmetric. I am interested in diagonalizing the matrix with a symplectic matrix R satisfying
$R^TJR=J$
where
$J=\left[\begin{array}{ccc} 0 & 1\\ -1 &0 \end{array}\right]$
such that $R^TMR$ is block-diagonal. In particular, I am interested in an algorithm that can be coded using, say Matlab. I am aware of the following similar posts.
1. This post discussed a similar question for Hamiltonian matrix. However, in the above case, matrix M may not anti-commute with J. I am thinking along the line that if it is possible to similar transform M into a Hamiltonian matrix. So I guess the question boils down to how to transform a real symmetric matrix into a Hamiltonian matrix, if possible.
2. This post gives criteria that if JM is diagonalizable, then the above procedure exists. However a clear procedure is still lacking, say to conjugate JM into the Cartan subalgebra as suggested, if we assume JM is diagonalizable. Any help is appreciated.
3. I am aware of the Willianmson's theorem from This post. But in this case, M may not be positive definite.
Any help is appreciated, and thanks in advance.