I am computing some integral homology in a C++ program using libpari, and while what I have works fine it is possible that there is a better (simpler or faster) way to do this, possibly even a built-in function which I have not found which does what I want more simply.
I have Z-linear maps maps Z^n2 -> Z^n1 -> Z^n0 whose composite is 0 with integer matrices A10 (size n0 x n1) and A21 (size n1 x n2), so acting on column vectors on the right, and A10*A21=0. All I want is the abelian group structure of ker(A10)/im(A21). A rough sketch of what I do is this:
1. Find the HNF of A10, say H = A10*U with U in GL(n1,Z) representing a change of basis for the module in the middle.
2. Compute M = U^{-1}*A21, the new matrix of the second map.
3. Drop the last r rows of M, where r is the rank of H (also of A10).
4. Return the SNF of M.
Is there a better way?
John