def benchmark_magma_hnf(nrange, bits=4): """ EXAMPLES: sage: import sage.matrix.matrix_integer_dense_hnf as hnf sage: hnf.benchmark_magma_hnf([50,100],32) # optional - magma ('magma', 50, 32, ...), ('magma', 100, 32, ...), """ from sage.interfaces.all import magma b = 2**bits for n in nrange: a = magma('MatrixAlgebra(IntegerRing(),%s)![Random(%s,%s) : i in [1..%s]]'%(n,-b,b,n**2)) t = magma.cputime() h = a.EchelonForm() tm = magma.cputime(t) print '%s,'%(('magma', n, bits, tm),)