Skip to main content
1 of 3
Amritanshu Prasad
  • 5.7k
  • 1
  • 38
  • 54

If you have $P$, I think you can recover $Q$ as $(D^{-1}PD)^{-1}$. Therefore, you are looking for invertible integer matrices $P$ such that $D^{-1}PD$ is also invertible (i.e., $P\in GL_n(\mathbf Z)\cap D GL_n(\mathbf Z) D^{-1}$).

This is actually the automorphism group of the finite abelian group $A=\mathbf Z/d_1\mathbf Z\times\dotsb\mathbf\times Z/d_n\mathbf Z$. This group is a product of the automorphism groups of the primary components of $A$.

A $p$-primary component of $A$ is of the form $\mathbf Z/p^{\lambda_1}\mathbf Z\times\dotsb\times\mathbf Z/p^{\lambda_n}\mathbf Z$. This group is generated by the Birkhoff moves (see Subgroups of Finite Abelian Groups by Garrett Birkhoff in Proceeding of the London Math. Society, 1935):

  1. Scaling any row/column by a $p$-free integer
  2. Adding $\alpha$ times the $i$th row (column) to the $j$th row (column) so long as $p^{\max\{0,\lambda_i-\lambda_j\}}$ divides $\alpha$.
  3. Interchanging rows or columns with the same invariant factors.
Amritanshu Prasad
  • 5.7k
  • 1
  • 38
  • 54