Symplectic Gram-Schmidt process (source code)

= Symplectic Gram-Schmidt process
{c}

Construct a <symplectic basis> two <vectors> at a time. Choose $e\ne0$; the <nondegenerate bilinear form> supplies $g$ with $\omega(e,g)\ne0$, and set $f=g/\omega(e,g)$. For any <vector> $x$, remove its paired components by
$$
x'=x-\omega(x,f)e+\omega(x,e)f.
$$
Then $\omega(x',e)=\omega(x',f)=0$. Thus, for $U=\operatorname{span}\{e,f\}$, the <symplectic orthogonal complement> gives a <direct sum> $V=U\oplus U^\omega$; its restricted <bilinear form> remains <nondegenerate>. Repeat there until no <vectors> remain, then put all $e_i$ before all $f_i$. This proves even <dimension> and existence together. Only the nonzero pairing is divided out, so the construction also works in <characteristic> two. The pair-splitting argument is described in <Bilinear Forms by Keith Conrad> (Keith Conrad, Bilinear Forms, §5, proof of Theorem 5.1 and Theorem 5.4).