This file has many functions for computing timing benchmarks of various methods for random matrices with given bounds for the entries. The systems supported are Sage and Magma.
The basic command syntax is as follows:
sage: import sage.matrix.benchmark as b
sage: print "starting"; import sys; sys.stdout.flush(); b.report([b.det_ZZ], 'Test', systems=['sage'])
starting...
======================================================================
Test
======================================================================
...
======================================================================
Compute product of square n matrix by random vector with num and denom bounded by h the given number of times.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.MatrixVector_QQ(500)
sage: tm = b.MatrixVector_QQ(500, system='magma') # optional - magma
Given a n x n matrix over GF with random entries, compute the charpoly.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.charpoly_GF(100)
sage: tm = b.charpoly_GF(100, system='magma') # optional - magma
Characteristic polynomial over ZZ: Given a n x n matrix over ZZ with random entries between min and max, compute the charpoly.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.charpoly_ZZ(100)
sage: tm = b.charpoly_ZZ(100, system='magma') # optional - magma
Dense determinant over GF(p). Given an n x n matrix A over GF with random entries compute det(A).
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.det_GF(1000)
sage: tm = b.det_GF(1000, system='magma') # optional - magma
Dense rational determinant over QQ. Given an n x n matrix A over QQ with random entries with numerator bound and denominator bound, compute det(A).
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.det_QQ(200)
sage: ts = b.det_QQ(10, num_bound=100000, den_bound=10000)
sage: tm = b.det_QQ(200, system='magma') # optional - magma
Dense integer determinant over ZZ. Given an n x n matrix A over ZZ with random entries between min and max, inclusive, compute det(A).
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.det_ZZ(200)
sage: tm = b.det_ZZ(200, system='magma') # optional - magma
Runs the benchmark for calculating the determinant of the hilbert matrix over rationals of dimension n.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.det_hilbert_QQ(50)
sage: tm = b.det_hilbert_QQ(50, system='magma') # optional - magma
Given a n x (2*n) matrix over QQ with random integer entries between min and max, compute the reduced row echelon form.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.echelon_QQ(100)
sage: tm = b.echelon_QQ(100, system='magma') # optional - magma
Returns the Hilbert matrix of size n over rationals.
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: b.hilbert_matrix(3)
[ 1 1/2 1/3]
[1/2 1/3 1/4]
[1/3 1/4 1/5]
Given a n x n matrix over QQ with random integer entries between min and max, compute the reduced row echelon form.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.inverse_QQ(100)
sage: tm = b.inverse_QQ(100, system='magma') # optional - magma
Runs the benchmark for calculating the inverse of the hilbert matrix over rationals of dimension n.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.invert_hilbert_QQ(30)
sage: tm = b.invert_hilbert_QQ(30, system='magma') # optional - magma
Given two n x n matrix over GF(p) with random entries, add them.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.matrix_add_GF(500, p=19)
sage: tm = b.matrix_add_GF(500, p=19, system='magma') # optional - magma
Matrix addition over ZZ Given an n x n matrix A and B over ZZ with random entries between min and max, inclusive, compute A + B times times.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.matrix_add_ZZ(200)
sage: tm = b.matrix_add_ZZ(200, system='magma') # optional - magma
Matrix addition over ZZ. Given an n x n matrix A and B over ZZ with random bits-bit entries, compute A + B.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.matrix_add_ZZ_2(200)
sage: tm = b.matrix_add_ZZ_2(200, system='magma') # optional - magma
Given an n x n matrix A over GF(p) with random entries, compute A * (A+1).
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.matrix_multiply_GF(100, p=19)
sage: tm = b.matrix_multiply_GF(100, p=19, system='magma') # optional - magma
Given an n x n matrix A over QQ with random entries whose numerators and denominators are bounded by bnd, compute A * (A+1).
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.matrix_multiply_QQ(100)
sage: tm = b.matrix_multiply_QQ(100, system='magma') # optional - magma
Matrix multiplication over ZZ Given an n x n matrix A over ZZ with random entries between min and max, inclusive, compute A * (A+1).
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.matrix_multiply_ZZ(200)
sage: tm = b.matrix_multiply_ZZ(200, system='magma') # optional - magma
Given a n+1 x n matrix over GF(p) with random entries, compute the nullspace.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.nullspace_GF(300)
sage: tm = b.nullspace_GF(300, system='magma') # optional - magma
Nullspace over RDF: Given a n+1 x n matrix over RDF with random entries between min and max, compute the nullspace.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.nullspace_RDF(100) # long time
sage: tm = b.nullspace_RDF(100, system='magma') # optional - magma
Nullspace over RR: Given a n+1 x n matrix over RR with random entries between min and max, compute the nullspace.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.nullspace_RR(100)
sage: tm = b.nullspace_RR(100, system='magma') # optional - magma
Nullspace over ZZ: Given a n+1 x n matrix over ZZ with random entries between min and max, compute the nullspace.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.nullspace_ZZ(200)
sage: tm = b.nullspace_ZZ(200, system='magma') # optional - magma
Rank over GF(p): Given a (n + 10) x n matrix over GF(p) with random entries, compute the rank.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.rank2_GF(500)
sage: tm = b.rank2_GF(500, system='magma') # optional - magma
Rank 2 over ZZ: Given a (n + 10) x n matrix over ZZ with random entries between min and max, compute the rank.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.rank2_ZZ(300)
sage: tm = b.rank2_ZZ(300, system='magma') # optional - magma
Rank over GF(p): Given a n x (n+10) matrix over GF(p) with random entries, compute the rank.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.rank_GF(1000)
sage: tm = b.rank_GF(1000, system='magma') # optional - magma
Rank over ZZ: Given a n x (n+10) matrix over ZZ with random entries between min and max, compute the rank.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.rank_ZZ(300)
sage: tm = b.rank_ZZ(300, system='magma') # optional - magma
Run benchmarks with default arguments for each function in the list F.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: print "starting"; import sys; sys.stdout.flush(); b.report([b.det_ZZ], 'Test', systems=['sage'])
starting...
======================================================================
Test
======================================================================
...
======================================================================
Runs all the reports for finite field matrix operations, for prime p=16411.
INPUT:
Note
right now, even though p is an input, it is being ignored! If you need to check the performance for other primes, you can call individual benchmark functions.
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: print "starting"; import sys; sys.stdout.flush(); b.report_GF(systems=['sage'])
starting...
======================================================================
Dense benchmarks over GF with prime 16411
======================================================================
...
======================================================================
Reports all the benchmarks for integer matrices and few rational matrices.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: print "starting"; import sys; sys.stdout.flush(); b.report_ZZ(systems=['sage']) # long time (15s on sage.math, 2012)
starting...
======================================================================
Dense benchmarks over ZZ
======================================================================
...
======================================================================
Smith Form over ZZ: Given a n x n matrix over ZZ with random entries between min and max, compute the Smith normal form.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.smithform_ZZ(100)
sage: tm = b.smithform_ZZ(100, system='magma') # optional - magma
Vector matrix multiplication over ZZ.
Given an n x n matrix A over ZZ with random entries between min and max, inclusive, and v the first row of A, compute the product v * A.
INPUT:
EXAMPLES:
sage: import sage.matrix.benchmark as b
sage: ts = b.vecmat_ZZ(300) # long time
sage: tm = b.vecmat_ZZ(300, system='magma') # optional - magma