Nemocas / AbstractAlgebra.jl

Generic abstract algebra functionality in pure Julia (no C dependencies)
https://nemocas.github.io/AbstractAlgebra.jl/dev/index.html
Other
163 stars 63 forks source link

slow arithmetic in generic polynomial rings #1132

Open HechtiDerLachs opened 2 years ago

HechtiDerLachs commented 2 years ago

I'm using generic polynomial rings S = A[x,y,...] over other base rings A. Now I have the following problem:

The arithmetic is rather slow, for instance when multiplying polynomials. The reason that I spotted is here. In my case, A is the localization of a quotient of a polynomial ring, so the check for being zero involves reduction modulo some Groebner basis and is not cheap (especially given all the necessary conversions to Singular which are still necessary for this).

Is there a way to avoid those massive checks for being zero?

tthsqe12 commented 2 years ago

Skipping zero checks or replacing them with possibly inaccurate checks can introduce polynomials with zero coefficients stored. These non-canonical polynomials are fine for +,-,* but not fine for division and zero checking. If you are avoiding division and zero checking, do the SLP polynomials fit your needs?

HechtiDerLachs commented 2 years ago

I think they do. But from what you say, it seems to be possible to do a 'clean up' before division and zero checking, right? Maybe that's the way to go then?

HechtiDerLachs commented 2 years ago

Just to give you an idea of what's happening: In my example I have about 133 polynomials in 16 variables of degree ~3. Evaluating all of them on elements of some MPolyQuoLocalizedRing takes several minutes. But I think, this task could/should be fast.

thofma commented 2 years ago

Chances are very low that this will be implemented.

Is it really the iszero check? Do you use MPolyQuoElem for the arithmetic? I just noted that the MPolyQuoElem are very inefficient, as they always perform simplify/simplify! after every arithmetic operation and before every equality check. This is quite a waste.