Let $G$ be a $n\times n-$symmetric matrix with integral coefficients and determinant $1$ (*i.e. unimodular*) such that the associated quadratic form is positive-definite.

I am interested in having an algorithm to find a *rational* basis of a lattice $L$ sucht that $G$ is the Gram matrix of $L$. Concretely, this consists in finding a *square* matrix $M$ (with rational coefficients) such that $G$ factors as $^tM \cdot M$.

Note that:

1) The unimodular condition and Hasse-Minkowski theory predict that this is indeed possible (this is a remark in Serre's course in arithmetics, §1.3.6 p. 86 in the French edition).

2) I demand the matrix $M$ to be square. (For non-square $M$, this is much easier: first by the Gram-Schmidt process, one can assume that $M$ is diagonal (with positive rational entries); then write each diagonal entry as a sums of  (at most 4) squares).