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

Test output littered with flint exceptions

Open thofma opened this issue 10 months ago • 6 comments

See https://github.com/Nemocas/Nemo.jl/actions/runs/13058194155/job/36434421271?pr=2011#step:6:1004.

Have not looked into it, but it appears they are coming from the conformance tests.

Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.Test Summary:                   |   Pass   Total   Time
zzModRingElem.conformance_tests | 347783  347783  21.3s

thofma avatar Jan 30 '25 19:01 thofma

Of course this needs to be looked into (I'll try to get to it), but in the meantime I wonder: should we (and can we) perhaps turn these into Julia exceptions? Then we'd notice this kind of problem immediately. And isn't it arguably the right thing to do? If not, what's the point of printing the message in the first place

fingolfin avatar Feb 05 '25 13:02 fingolfin

It looks like https://github.com/Nemocas/Nemo.jl/pull/1994 is the cause of this.

To test this, just run flint/nmod-test.jl.

albinahlback avatar Mar 31 '25 12:03 albinahlback

julia> R, = residue_ring(ZZ, 2^10)
(Integers modulo 1024, Map: ZZ -> R)

julia> Rx, (x, y) = R[:x, :y]
(Multivariate polynomial ring in 2 variables over R, zzModMPolyRingElem[x, y])

julia> a = 534*x^2*y^2
534*x^2*y^2

julia> b = 264*x^3*y^3 + 485*x^3 + 310*x^2*y + 351*x*y^2 + 780*x
264*x^3*y^3 + 485*x^3 + 310*x^2*y + 351*x*y^2 + 780*x

julia> try divides(a, b); catch fl; end
Flint exception (Impossible inverse):
    nmod_mpoly_divides: leading coefficient is not invertible.

thofma avatar Mar 31 '25 13:03 thofma

OK, this is just the usual error message thrown by flint. Another example would be

julia> try; @ccall Nemo.libflint.n_invmod(2::UInt, 4::UInt)::UInt; catch; end
Flint exception (Impossible inverse):
    Cannot invert modulo 2*2

thofma avatar Mar 31 '25 13:03 thofma

I thought we were better at catching. I suggest adding a callback via pointer that would allow us to set this to some julia function to throw an error - and catch it properly without cluttering the screen

fieker avatar Apr 01 '25 06:04 fieker

I thought we were better at catching. I suggest adding a callback via pointer that would allow us to set this to some julia function to throw an error - and catch it properly without cluttering the screen

This will hopefully work once https://github.com/flintlib/flint/pull/2279 is available to Nemo.

lgoettgens avatar Apr 15 '25 17:04 lgoettgens