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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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.62%. Comparing base (9df1993) to head (7fabacf).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1883      +/-   ##
==========================================
+ Coverage   87.34%   87.62%   +0.27%     
==========================================
  Files          97       97              
  Lines       35532    35534       +2     
==========================================
+ Hits        31036    31137     +101     
+ Misses       4496     4397      -99     

☔ 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"

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