sympy / sympy_benchmarks

Some benchmarks of SymPy
14 stars 32 forks source link

benchmarks for sparse polynomial methods #88

Open 1e9abhi1e10 opened 1 year ago

1e9abhi1e10 commented 1 year ago

@oscarbenjamin I want to know whether I create a new file or add a benchmark in the benchmarks/polys.py file. Also, should I add all benchmarks which were I commented on the Issue.

oscarbenjamin commented 1 year ago

It would be good to have a polynomial benchmarks file if there is not already somewhere that has polynomial benchmarks.

Also, should I add all benchmarks which were I commented on the

Yes, and there should be many different benchmarks for them like comparing different methods for the same operation e.g. the prem function vs the Poly.prem method vs the PolyElement.prem method etc:

In [1]: f, g = x**2*y + x*z + 1, x*z + y

In [2]: %time prem(f, g, x)
CPU times: user 13.2 ms, sys: 196 µs, total: 13.4 ms
Wall time: 12.3 ms
Out[2]: 
 3      2    2
y  - y⋅z  + z 

In [3]: fp, gp = Poly(f, [x, y, z]), Poly(g, [x, y, z])

In [4]: %time fp.prem(gp)
CPU times: user 3.71 ms, sys: 0 ns, total: 3.71 ms
Wall time: 3.39 ms
Out[4]: Poly(y**3 - y*z**2 + z**2, x, y, z, domain='ZZ')

In [5]: R = ZZ[x,y,z]

In [6]: fpe, gpe = R.from_sympy(f), R.from_sympy(g)

In [7]: %time fpe.prem(gpe)
CPU times: user 1.86 ms, sys: 0 ns, total: 1.86 ms
Wall time: 1.88 ms
Out[7]: y**3 - y*z**2 + z**2
1e9abhi1e10 commented 1 year ago

Moving ahead should we also add benchmarks for the pdiv, pquo and pexquo?

oscarbenjamin commented 1 year ago

Moving ahead should we also add benchmarks for the pdiv, pquo and pexquo?

Yes.

oscarbenjamin commented 1 year ago

Moving ahead should we also add benchmarks for the pdiv, pquo and pexquo?

Yes.

Actually thinking about this we don't need benchmarks for pquo, pexquo and pdiv because they all use the same code (and that is unlikely to change in future). Just one of these is fine.