Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More conformance tests, fix some corner cases #1883

Merged
merged 7 commits into from
Nov 8, 2024
Merged

Conversation

fingolfin
Copy link
Member

@fingolfin fingolfin commented Oct 8, 2024

No description provided.

@fingolfin fingolfin marked this pull request as draft October 8, 2024 06:49
@fingolfin
Copy link
Member Author

This reports what looks like a genuine issue but I did not yet have time to look into it. Specifically fpRelPowerSeriesRingElem.conformance_tests fails with

  Expression: base_ring_type(R) == typeof(base_ring(R))
   Evaluated: zzModRing == fpField

@lgoettgens

This comment was marked as off-topic.

@lgoettgens
Copy link
Collaborator

I cherry-picked #1884 on top of this branch to see what failure CI runs into next

@lgoettgens
Copy link
Collaborator

The next failure is due to a wrong neg! method in #1869. This branch would need to get rebased for us to even be able to fix it.

@fingolfin fingolfin force-pushed the mh/conformance-more branch 2 times, most recently from 2c7f642 to 8c52790 Compare October 8, 2024 16:58
src/flint/fmpz_mod.jl Outdated Show resolved Hide resolved
@fingolfin fingolfin force-pushed the mh/conformance-more branch 3 times, most recently from 0b10ec8 to 2b6c23f Compare October 8, 2024 20:02
Copy link

codecov bot commented Oct 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.84%. Comparing base (16f4530) to head (6f7d06a).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1883      +/-   ##
==========================================
+ Coverage   87.49%   87.84%   +0.35%     
==========================================
  Files          97       97              
  Lines       35537    35534       -3     
==========================================
+ Hits        31092    31215     +123     
+ Misses       4445     4319     -126     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fingolfin fingolfin marked this pull request as ready for review October 8, 2024 23:37
src/Nemo.jl Outdated Show resolved Hide resolved
@fingolfin fingolfin changed the title More conformance tests More conformance tests, fix some corner cases Oct 14, 2024
@fingolfin fingolfin force-pushed the mh/conformance-more branch 2 times, most recently from a83ade1 to c2d3375 Compare October 18, 2024 09:02
@lgoettgens
Copy link
Collaborator

The CI failures still unveil some issue with gcdinv for fpPolyRing

@fingolfin
Copy link
Member Author

Weird, tests pass for me locally. But it seems in CI they also only fail in some runs, so probably a rare random input triggers this? sigh

@lgoettgens
Copy link
Collaborator

lgoettgens commented Oct 18, 2024 via email

@lgoettgens
Copy link
Collaborator

I boiled the problem down to the following:
It happens if the first argument of gcdinv is a multiple of the second. In this case, the definitions of AA and FLINT disagree:
AA states that the first return value is always the gcd, while FLINT states that if the first argument is zero modulo the second it will return 0 as both return values.
So this will need another (sigh) check in https://github.com/nemocas/Nemo.jl/blob/c2d3375041be823ee38a6f5ebbb21df37c7d466e/src/flint/gfp_poly.jl#L236 and in the analogous one for FpPolyRingElem...

@fingolfin
Copy link
Member Author

I guess in that case there are even more issues, just not discovered by the tests. E.g:

julia> gcdinv(25, 5)
(5, 0)

julia> gcdinv(ZZ(25), ZZ(5))
ERROR: DomainError with (25, 5):
First argument must be smaller than second argument
Stacktrace:
 [1] gcdinv(a::ZZRingElem, b::ZZRingElem)
   @ Nemo ~/Projekte/OSCAR/Nemo.jl/src/flint/fmpz.jl:1410
 [2] top-level scope
   @ REPL[18]:1

The documentation for gcdinv in FLINT is insufficient, I've submitted flintlib/flint#2104 now.

In the meantime I think the definition we have in AA at least is simple. But we could of course augment it to say something like "if f is zero mod g then the return value is undefined"

@fingolfin
Copy link
Member Author

Should be ready now. Found several true bugs in the code where we produced incorrect results or errors

@fingolfin
Copy link
Member Author

Oh and I just removed two ccalls into FLINT gcdinv methods. Claus and me inspected the FLINT implementation and they basically avoid some allocations. But at the same time their API is completely underspecified, and trying to make them work sanely is not worth the hassle right now. See also flintlib/flint#2104

@lgoettgens lgoettgens merged commit 2876db2 into master Nov 8, 2024
24 checks passed
@lgoettgens lgoettgens deleted the mh/conformance-more branch November 8, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants