Elementary decomposition of a finite free chain complex (source code)

= Elementary decomposition of a finite free chain complex

Over the principal ideal domain $\mathbb Z$, <Smith normal form> decomposes a chain complex of finitely generated free modules into direct sums of one-term complexes $\mathbb Z$ and two-term complexes
$$
0\longrightarrow\mathbb Z\xrightarrow{m}\mathbb Z\longrightarrow0.
$$
The one-term summands record free homology, the summands with $m>1$ record cyclic torsion, and those with $m=1$ are acyclic.