From a (not positive definite) Gram matrix to a (Kac-Moody) Cartan matrix Suppose I am given a symmetric matrix $G_{ij}$ with $G_{ii} = 2$. Can I always find an invertible integer matrix $S$ such that $(S^T G S)_{ii}=2$ and $(S^T G S)_{ij} \leq 0$ for $i \neq j$? Is there a practical algorithm to do so?
If you'd like a particular challenge, I'd like to know the answer for
$$G = \begin{pmatrix}
2 & -4 & 3 \\
-4 & 2 & -2 \\
3 & -2 & 2 \\
\end{pmatrix}.$$

Wondering how well this would work out in $4$ by $4,$ given that David says the individual steps in the "algorithm" preserve something important:
$$ G =
\left(
\begin{array}{cccc} 
2 & a & b & c \\
a & 2 & d & e \\
b &   d & 2 & f \\ 
c & e & f& 2
\end{array}
\right)
$$
$$ \det G = a^2  f^2 + b^2  e^2 + c^2  d^2 - 2  (a  b  e  f + a  c  d  f + b  c  d  e) + 4  (a  b  d + a  c  e + b  c  f + d  e  f) -4  ( a^2 + b^2 + c^2 + d^2 + e^2 + f^2   ) + 16 $$
where the degree four terms can be regarded as the indefinite ternary form $\langle 1,1,1,-2,-2,-2 \rangle$ in $x=af, y=be,z=cd.$
$$ S =
\left(
\begin{array}{cccc} 
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 &   0 & 1 & f \\ 
0 & 0 & 0& -1
\end{array}
\right)
$$
$$ S^t G S =
\left(
\begin{array}{cccc} 
2 & a & b & fb-c \\
a & 2 & d & fd-e \\
b &   d & 2 & f \\ 
fb-c & fd-e & f& 2
\end{array}
\right)
$$
So, this basic operation (an involution) flips two positions at once..
$$ T =
\left(
\begin{array}{cccc} 
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 &   0 & -1 & 0 \\ 
0 & 0 & f& 1
\end{array}
\right)
$$
$$ T^t G T =
\left(
\begin{array}{cccc} 
2 & a & fc-b & c \\
a & 2 & fe-d & e \\
fc-b &   fe-d & 2 & f \\ 
c & e & f& 2
\end{array}
\right)
$$
hmmmm.......
Just checking, 
$$ N_1 =
\left(
\begin{array}{cccc} 
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 &   0 & 1 & 0 \\ 
0 & 0 & 0& -1
\end{array}
\right)
$$
$$ N_1 G N_1 =
\left(
\begin{array}{cccc} 
2 & a & b & -c \\
a & 2 & d & -e \\
b &   d & 2 & -f \\ 
-c & -e & -f& 2
\end{array}
\right)
$$
$$ N_2 =
\left(
\begin{array}{cccc} 
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 &   0 & -1 & 0 \\ 
0 & 0 & 0& -1
\end{array}
\right)
$$
$$ N_2 G N_2 =
\left(
\begin{array}{cccc} 
2 & a & -b & -c \\
a & 2 & -d & -e \\
-b &   -d & 2 & f \\ 
-c & -e & f& 2
\end{array}
\right)
$$
Right, that is enough to know on these because $-I$ changes nothing.
Really ought to see what a permutation, a single transposition, does
$$ T_2 =
\left(
\begin{array}{cccc} 
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 &   0 & 0 & 1 \\ 
0 & 0 & 1 & 0
\end{array}
\right)
$$
$$ T_2 G T_2 =
\left(
\begin{array}{cccc} 
2 & a & c & b \\
a & 2 & e & d \\
c &   e & 2 & f \\ 
b & d & f& 2
\end{array}
\right)
$$
Swaps two pairs
