Hecke.jl icon indicating copy to clipboard operation
Hecke.jl copied to clipboard

feat: make gcd over number fields faster

Open thofma opened this issue 1 year ago • 6 comments

thofma avatar May 11 '24 17:05 thofma

Not terminating for the following example:

julia> Qx, x = QQ["x"];

julia> K, a = number_field(x^16 + 36*x^12 - 120*x^10 + 392*x^8 - 432*x^6 + 216*x^4 - 48*x^2 + 4, "a");

julia> R, (x, y, t) = polynomial_ring(K, ["x", "y", "t"]);

julia> gcd((x + 1)^10 * (x + y)^5, (x + 1)^5 * (x + y)^10 * t^10)

Because coeff(gl, 0) == 0 and so glp == 0 for every p.

thofma avatar May 11 '24 17:05 thofma

Codecov Report

Attention: Patch coverage is 69.09091% with 34 lines in your changes are missing coverage. Please review.

Project coverage is 75.33%. Comparing base (cd37d53) to head (8ba3bcd). Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1505      +/-   ##
==========================================
+ Coverage   75.22%   75.33%   +0.11%     
==========================================
  Files         354      354              
  Lines      112724   112796      +72     
==========================================
+ Hits        84796    84980     +184     
+ Misses      27928    27816     -112     
Files Coverage Δ
src/NumFieldOrd/NfOrd/Ideal/TwoElement.jl 58.39% <100.00%> (+2.44%) :arrow_up:
src/NumFieldOrd/NfOrd/LLL.jl 78.01% <100.00%> (+0.31%) :arrow_up:
src/NumField/NfRel/absolute_field.jl 91.83% <0.00%> (-1.92%) :arrow_down:
src/Misc/CRT.jl 59.10% <78.78%> (+0.40%) :arrow_up:
src/NumField/NfAbs/MPolyGcd.jl 64.07% <61.29%> (-3.67%) :arrow_down:

... and 33 files with indirect coverage changes

codecov[bot] avatar May 13 '24 13:05 codecov[bot]

Let's do a mini multivariate polynomial triage and decide:

  1. Should we always use the trick to work over $\mathbf{F}_p[X]/(f)$ with squarefree $f$? But this does not seem to scale well. Or stick to the idea of using prime ideals of degree $1$? Or mix both?
  2. Should we recognize rational polynomials and do the computation with fmpq_mpoly? (We could speed up the finish! in this case).
  3. Do we agree that for towers, we should pass to an absolute_simple_field? (Of course caching it together with both maps).

thofma avatar May 14 '24 18:05 thofma

No. Yes. Yes.

thofma avatar May 16 '24 13:05 thofma

Should be good to go. I noticed no regression. Even for rationals_as_number_field(), passing to the rationals is still faster.

thofma avatar May 16 '24 16:05 thofma

@benlorenz Some non-canonical output changed for the booktest (but the result is isomorphic). What is the recommended way? Do a breaking release and then adjust it?

thofma avatar May 16 '24 19:05 thofma

@benlorenz Some non-canonical output changed for the booktest (but the result is isomorphic). What is the recommended way? Do a breaking release and then adjust it?

Yes. Since it only affects Oscar master and not a release we could do without a breaking release as well, but with a version bump would be safer and probably avoids some intermittent booktest errors on Oscar PRs until the adjusted output is merged into all branches.

benlorenz avatar May 17 '24 06:05 benlorenz