Question: How to obtain the Smith normal form of an integer matrix

Certainly a standard question.

I have an integer n*n matrix A (the entries are explicitly integers; there is no variable -type x- in the matrix). I want the Smith normal form of A, that is A=UDV where U,V are integer matrices with determinant +-1 and D is a diagonal matrix with -eventually- some zero and positive integers d_i s.t. d_i divides d_{i+1}.

"SmithForm()" doesn't work directly (I get rational -non integer- matrices). Maybe it is necessary to declare the matrix A as 'Matrix(integer)' ...
Thank you in advance for your help.

Please Wait...