Closed 1e9abhi1e10 closed 1 year ago
Okay, this looks good.
To demonstrate the improvements that PRS brings we should probably add some benchmarks that are not over ZZ or QQ. For example we could use ZZ_I
or ZZ.algebraic_field(sqrt(2))
. Those cases are very slow at the moment and are cases where the current sparse implementation converts to dense. The kinds of expressions that arise in https://github.com/sympy/sympy/issues/25403 would make good examples.
I also noticed there that many trivial cases are handled poorly like if one polynomial divides the other or if one is an element of the ground domain etc.
Should I add these benchmarks for only dense
and expr
cases ?
x = symbols("x")
f = x**2 + I
Traceback (most recent call last):
File "<pyshell#22>", line 1, in <module>
f = x**2 + I
TypeError: unsupported operand type(s) for +: 'PolyElement' and 'ImaginaryUnit'
Should I add these benchmarks for only
dense
andexpr
cases ?
We should test the sparse polynomials as well:
In [1]: p1 = ZZ_I[x](x + I)
In [2]: p2 = ZZ_I[x](x - I)
In [3]: (p1*p2).gcd(p2)
Out[3]: x + (0 + -1*I)
In [4]: type(_)
Out[4]: sympy.polys.rings.PolyElement
This PR adds the benchmarks for the subresultants PRS method. Related Issue: https://github.com/sympy/sympy_benchmarks/issues/88
See https://github.com/sympy/sympy/pull/25442