I am reading Conway and Sloane's book Sphere Packings, Lattice, and Groups. There is a condition on congruence lattices:
given Gram matrices $A$ and $B$ (which are square, real, symmetric, and positive definite), they describe congruent lattices iff $A = c^2XBX^{tr}$ for $X$ unimodular (determinant 1 and all integer components) and some constant $c$.
I want to be able to check if two lattices are congruent using this equation. How should I go about solving for $X$ ?
I understand that t-congruence is given as $A = XBX^{tr}$, in general. I have researched methodology to solve for $X$ in this t-congruence case, but the solution is not necessarily unique, and hence won't generally return $X$ as unimodular even if I know such a unimodular $X$ exists. Is there an appropriate algorithm I should consider in solving for the unimodular case?
Partial answer:
Let us consider the most natural way to obtain an $X$ complying with relationship:
$$A=XBX^T\tag{1}$$
Consider the two eigendecompositions :
$$A=X_1D_1X_1^{-1}=X_1D_1X_1^T \ and \ B=X_2D_2X_2^{-1}=X_2D_2X_2^T\tag{2}$$
Remark: we can write: $X_1^T=X_1^{-1}$ and $X_2^T=X_2^{-1}$ because the eigenvectors of symmetric matrices can be taken so as to constitute an orthonormal basis, explaining that we can take $X_1$ and $X_2$ as orthogonal matrices.
Writing $D_1=\Delta_1^2$ and $D_2=\Delta_2^2$, which is possible because the eigenvalues are $\ge 0$, (2) can be written:
$$A=(X_1\Delta_1)(X_1 \Delta_1)^T \ and \ B=(X_2\Delta_2)(X_2 \Delta_2)^T\tag{3}$$
In view of (3)
$$X=(X_1\Delta_1)(X_2 \Delta_2)^{-1}\tag{4}$$
is a solution to (1).
More generaly, if $Q$ is any orthogonal matrix:
is a solution to (1).
I am almost certain that (5) is the general solution to (1), but I am unable to find a thorough reference.
Among the matrices expressed by formula (5), are there unimodular solutions ? By taking for $Q$ permutation matrices ?