Function: qfgaussred
Section: linear_algebra
C-Name: qfgaussred
Prototype: G
Help: qfgaussred(q): square reduction of the (symmetric) matrix q (returns a
 square matrix whose i-th diagonal term is the coefficient of the i-th square
 in which the coefficient of the i-th variable is 1).
Doc:
 \idx{decomposition into squares} of the
 quadratic form represented by the symmetric matrix $q$. The result is an
 upper triangular
 matrix whose diagonal entries are the coefficients of the squares, and the
 off-diagonal entries on each line represent the bilinear forms. More
 precisely, if $(a_{ij})$ denotes the output, one has
 $$ q(x) = \sum_i a_{ii} (x_i + \sum_{j > i} a_{ij} x_j)^2 $$
Variant: \fun{GEN}{qfgaussred_positive}{GEN q} assumes that $q$ is
  positive definite and is a little faster; returns \kbd{NULL} if a vector
  with negative norm occurs (non positive matrix or too many rounding errors).
