sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.4k stars 473 forks source link

Random failure in cycliccover_finite_field.py #30419

Open vbraun opened 4 years ago

vbraun commented 4 years ago
File "src/sage/schemes/cyclic_covers/cycliccover_finite_field.py", line 1130, in sage.schemes.cyclic_covers.cycliccover_finite_field.CyclicCover_finite_field.frobenius_polynomial
Failed example:
    CyclicCover(11, PolynomialRing(GF(1129), 'x')([-1] + [0]*(5-1) + [1])).frobenius_polynomial() # long time
Exception raised:
    Traceback (most recent call last):
      File "/var/lib/buildbot/slave/sage_git/build/local/lib/python3.8/site-packages/sage/doctest/forker.py", line 720, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/var/lib/buildbot/slave/sage_git/build/local/lib/python3.8/site-packages/sage/doctest/forker.py", line 1145, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.cyclic_covers.cycliccover_finite_field.CyclicCover_finite_field.frobenius_polynomial[23]>", line 1, in <module>
        CyclicCover(Integer(11), PolynomialRing(GF(Integer(1129)), 'x')([-Integer(1)] + [Integer(0)]*(Integer(5)-Integer(1)) + [Integer(1)])).frobenius_polynomial() # long time
      File "sage/misc/cachefunc.pyx", line 2310, in sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ (build/cythonized/sage/misc/cachefunc.c:12907)
        self.cache = f(self._instance)
      File "/var/lib/buildbot/slave/sage_git/build/local/lib/python3.8/site-packages/sage/schemes/cyclic_covers/cycliccover_finite_field.py", line 1266, in frobenius_polynomial
        cp = charpoly_frobenius(F, charpoly_prec, self._p, 1, self._n, denom.list())
      File "/var/lib/buildbot/slave/sage_git/build/local/lib/python3.8/site-packages/sage/schemes/cyclic_covers/charpoly_frobenius.py", line 209, in charpoly_frobenius
        assert cp[-1] == 1
    AssertionError
**********************************************************************
1 item had failures:
   1 of  60 in sage.schemes.cyclic_covers.cycliccover_finite_field.CyclicCover_finite_field.frobenius_polynomial
    [168 tests, 1 failure, 107.13 s]
----------------------------------------------------------------------
sage -t --long --random-seed=0 src/sage/schemes/cyclic_covers/cycliccover_finite_field.py  # 1 doctest failed
----------------------------------------------------------------------

CC: @edgarcosta @alexjbest

Component: algebraic geometry

Keywords: random_fail

Issue created by migration from https://trac.sagemath.org/ticket/30419

vbraun commented 4 years ago

Changed keywords from none to random_fail

edgarcosta commented 4 years ago
comment:2

What do you mean by random_fail?

On the last ticket that touched this code, the test runs fine. I will build the latest sage and try it.

# sage -t --long --random-seed=0 src/sage/schemes/cyclic_covers/cycliccover_finite_field.py
too few successful tests, not using stored timings
Running doctests with ID 2020-08-23-17-19-40-8badb20d.
Git branch: halfdegree
Using --optional=build,dochtml,python_openid,sage,speaklater
Doctesting 1 file.
sage -t --long --random-seed=0 src/sage/schemes/cyclic_covers/cycliccover_finite_field.py
    [168 tests, 79.02 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
Total time for all tests: 79.1 seconds
    cpu time: 78.7 seconds
    cumulative wall time: 79.0 seconds
#  git log -1
commit 264f9c1b4c8aa012db4a7cff46645edf7a6f658b (HEAD -> halfdegree)
Author: Edgar Costa <edgarc@mit.edu>
Date:   Fri Aug 14 15:35:27 2020 -0400

    integer div
edgarcosta commented 4 years ago
comment:4
# sage -t --long --random-seed=0 src/sage/schemes/cyclic_covers/cycliccover_finite_field.py
too few successful tests, not using stored timings
Running doctests with ID 2020-08-23-18-10-15-26903d91.
Git branch: HEAD
Using --optional=build,dochtml,python_openid,sage,speaklater
Doctesting 1 file.
sage -t --long --random-seed=0 src/sage/schemes/cyclic_covers/cycliccover_finite_field.py
    [168 tests, 80.03 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
Total time for all tests: 80.1 seconds
    cpu time: 78.6 seconds
    cumulative wall time: 80.0 seconds

# git log -1
commit 30cac80dd70b5f1fa5398863cc90aa133c18d424 (HEAD, tag: 9.2.beta10, upstream/develop, upstream/HEAD)
Author: Release Manager <release@sagemath.org>
Date:   Sun Aug 23 22:51:01 2020 +0200

    Updated SageMath version to 9.2.beta10

Built with clang version 11.0.0 (clang-1100.0.33.17) and with ntl 11.4.3 and flint 2.6.2

vbraun commented 4 years ago
comment:5

random_fail is the tag for tickets with failures that only appear sometimes, but not always. The code is probably doing something different occasionally, picking random primes or depending on iteration orders in dictionaries or some such.

vbraun commented 4 years ago
comment:6

For starters it would be nice to use assert cp[-1] == 1, cp so we actually see what it is when hitting the assertion.

edgarcosta commented 4 years ago
comment:7

That assert is a pretty stupid one, I added it there for my own sanity, to be sure that I'm getting det(x - A) and not det(I - xA) (which is how I usually think about characteristic polynomials of Frobenius actions).

Anyhow, the code starts with:

try:
        cp = frob_matrix.change_ring(ZZ).charpoly().list()
    except ValueError:
        # the given matrix wasn't integral
        cp = frob_matrix.charpoly().change_ring(ZZ).list()
    assert len(charpoly_prec) == len(cp) - (len(known_factor) - 1)
    assert cp[-1] == 1

In this example, the try should have succeeded, but somehow our characteristic polynomial is not monic.

edgarcosta commented 4 years ago
comment:8

Also, I may add that the matrix is a 40 x 40 dense matrix over 1129-adic Field with capped relative precision 12.

mkoeppe commented 3 years ago
comment:10

Moving to 9.4, as 9.3 has been released.

mkoeppe commented 9 months ago

seen again in https://github.com/sagemath/sage/actions/runs/7517557537/job/20463864297?pr=37056#step:11:8066