-*- M2 -*-

a = 7; b = 3; c = 7
R = ZZ/5[x,y,MonomialOrder => {Position => Down}]
inc = random(R^a,R^b,MaximalRank=>true);
prj = random(R^b, R^c, MaximalRank=>true);
f = inc * prj;
time (g,s,t) = smithNormalForm(f,KeepZeroes => false);
	 -- used 0.212014 seconds

time g - s*f*t == 0
	 -- used 14.2089 seconds
g;
s;
t;


end

This might be slow matrix multiplication.

    Macaulay 2, version 0.9.20
    with packages: Classic, Elimination, LLLBases, PrimaryDecomposition, SchurRings, TangentCone

    i1 : a = 7; b = 3; c = 7

    o3 = 7

    i4 : R = ZZ/5[x,y,MonomialOrder => {Position => Down}]

    o4 = R

    o4 : PolynomialRing

    i5 : inc = random(R^a,R^b,MaximalRank=>true);

		 7       3
    o5 : Matrix R  <--- R

    i6 : prj = random(R^b, R^c, MaximalRank=>true);

		 3       7
    o6 : Matrix R  <--- R

    i7 : f = inc * prj;

		 7       7
    o7 : Matrix R  <--- R

    i8 : time (g,s,t) = smithNormalForm(f,KeepZeroes => false);
	 -- used 0.212014 seconds

    i9 : time g - s*f*t == 0
	 -- used 14.2089 seconds

    o9 = true

    i10 : g;

		  10       10
    o10 : Matrix R   <--- R

    i11 : s;

		  10       7
    o11 : Matrix R   <--- R

    i12 : t;

		  7       10
    o12 : Matrix R  <--- R
