B. Hartley and T.O. Hawkes define the invariant factors of a matrix over a PID, and they also give an algorithm for computing the aforementioned factors.
So far so good, but they also define the invariant factors of a finitely generated module over a PID in terms of its invariant factor decomposition, and I haven't been able to puzzle out the connection between these definitions. If I want to find the invariant factor decomposition of a finitely generated module over PID, how do I turn this problem into a matrix problem so that I can apply the algorithm?