Indeed, calling previous_prime(p) with p=2 does not sound like a good
idea :-) The following is very suspicious to me

~/Applications/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/matrix/misc.pyx
in sage.matrix.misc.matrix_rational_echelon_form_multimodular
(build/cythonized/sage/matrix/misc.c:7147)()

    375                 verbose("Excluding this prime (bad pivots).",
caller_name="multimod echelon")

    376             t = verbose("time for pivot compare", t, level=2,
caller_name="multimod echelon")

--> 377             p = previous_prime(p)

Vincent

On Fri, 29 Jul 2022 at 16:07, Trevor Karn <trevor.k.k...@gmail.com> wrote:
>
> Hi all,
>
> I'm working on trac ticket https://trac.sagemath.org/ticket/34138 and during 
> some testing on commit b3ef1f7 got an error that I don't understand. In 
> implementing the F4 algorithm there is a computation of matrix RREF. During 
> that step, on the "gametwo7" example of 
> https://web.archive.org/web/20181129231728/http://www.cecm.sfu.ca/~rpearcea/polsys.txt,
>  I get the error below. It looks like the error is occurring in the matrix 
> row reduction. Does this seem like a bug with the Groebner basis code or with 
> the matrix code?
>
> Thanks so much!
>
> Best,
> Trevor
>
>  ---------------------------------------------------------------------------
>
> ValueError                                Traceback (most recent call last)
>
> <ipython-input-11-92ee538afd06> in <module>
>
> ----> 1 cProfile.runctx('I.groebner_basis()', globals(), locals(), 
> 'profile.prof')
>
>
> /usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/cProfile.py
>  in runctx(statement, globals, locals, filename, sort)
>
>      17
>
>      18 def runctx(statement, globals, locals, filename=None, sort=-1):
>
> ---> 19     return _pyprofile._Utils(Profile).runctx(statement, globals, 
> locals,
>
>      20                                              filename, sort)
>
>      21
>
>
> /usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/profile.py
>  in runctx(self, statement, globals, locals, filename, sort)
>
>      60         prof = self.profiler()
>
>      61         try:
>
> ---> 62             prof.runctx(statement, globals, locals)
>
>      63         except SystemExit:
>
>      64             pass
>
>
> /usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/cProfile.py
>  in runctx(self, cmd, globals, locals)
>
>      98         self.enable()
>
>      99         try:
>
> --> 100             exec(cmd, globals, locals)
>
>     101         finally:
>
>     102             self.disable()
>
>
> <string> in <module>
>
>
> ~/Applications/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/algebras/clifford_algebra.py
>  in groebner_basis(self, term_order)
>
>    2755             return self._groebner_strategy.groebner_basis
>
>    2756         self._groebner_strategy = strategy(self)
>
> -> 2757         self._groebner_strategy.compute_groebner()
>
>    2758         return self._groebner_strategy.groebner_basis
>
>    2759
>
>
> ~/Applications/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/algebras/exterior_algebra_groebner.pyx
>  in sage.algebras.exterior_algebra_groebner.GroebnerStrategy.compute_groebner 
> (build/cythonized/sage/algebras/exterior_algebra_groebner.c:8678)()
>
>     221         while P:
>
>     222             Pp = P.pop(min(P))  # The selection: lowest lcm degree
>
> --> 223             Gp = self.reduction(Pp, G)
>
>     224             G.extend(Gp)
>
>     225             for j in range(n, len(G)):
>
>
> ~/Applications/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/algebras/exterior_algebra_groebner.pyx
>  in sage.algebras.exterior_algebra_groebner.GroebnerStrategy.reduction 
> (build/cythonized/sage/algebras/exterior_algebra_groebner.c:7581)()
>
>     178                     for m,c in (<CliffordAlgebraElement> 
> f)._monomial_coefficients.items()},
>
>     179                    sparse=True)
>
> --> 180         M.echelonize()  # Do this in place
>
>     181         lead_supports = 
> set(self.leading_supp(<CliffordAlgebraElement> f) for f in L)
>
>     182         return [self.E.element_class(self.E, {self.int_to_bitset(r - 
> Integer(j)): c for j,c in M[i].iteritems()})
>
>
> ~/Applications/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/matrix/matrix_rational_sparse.pyx
>  in sage.matrix.matrix_rational_sparse.Matrix_rational_sparse.echelonize 
> (build/cythonized/sage/matrix/matrix_rational_sparse.c:7063)()
>
>     524         self.check_mutability()
>
>     525
>
> --> 526         pivots = self._echelonize_multimodular(height_guess, proof, 
> **kwds)
>
>     527
>
>     528         self.cache('in_echelon_form', True)
>
>
> ~/Applications/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/matrix/matrix_rational_sparse.pyx
>  in 
> sage.matrix.matrix_rational_sparse.Matrix_rational_sparse._echelonize_multimodular
>  (build/cythonized/sage/matrix/matrix_rational_sparse.c:7609)()
>
>     571     def _echelonize_multimodular(self, height_guess=None, proof=True, 
> **kwds):
>
>     572         cdef Matrix_rational_sparse E
>
> --> 573         E, pivots = self._echelon_form_multimodular(height_guess, 
> proof=proof, **kwds)
>
>     574         self.clear_cache()
>
>     575         # Swap the data of E and self (effectively moving E to self)
>
>
> ~/Applications/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/matrix/matrix_rational_sparse.pyx
>  in 
> sage.matrix.matrix_rational_sparse.Matrix_rational_sparse._echelon_form_multimodular
>  (build/cythonized/sage/matrix/matrix_rational_sparse.c:7874)()
>
>     589         from .misc import matrix_rational_echelon_form_multimodular
>
>     590         cdef Matrix E
>
> --> 591         E, pivots = matrix_rational_echelon_form_multimodular(self,
>
>     592                                  height_guess=height_guess, 
> proof=proof)
>
>     593         E._parent = self._parent
>
>
> ~/Applications/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/matrix/misc.pyx
>  in sage.matrix.misc.matrix_rational_echelon_form_multimodular 
> (build/cythonized/sage/matrix/misc.c:7147)()
>
>     375                 verbose("Excluding this prime (bad pivots).", 
> caller_name="multimod echelon")
>
>     376             t = verbose("time for pivot compare", t, level=2, 
> caller_name="multimod echelon")
>
> --> 377             p = previous_prime(p)
>
>     378         # Find set of best matrices.
>
>     379         Y = []
>
>
> ~/Applications/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/arith/misc.py
>  in previous_prime(n)
>
>    1234     n = ZZ(n) - 1
>
>    1235     if n <= 1:
>
> -> 1236         raise ValueError("no previous prime")
>
>    1237     if n <= 3:
>
>    1238         return ZZ(n)
>
>
> ValueError: no previous prime
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/5ddae1bd-c275-43fb-a740-4352b867f76dn%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAGEwAAkA8%2Bh%2BjF3uQrYFeLOYD8P%3D2b-rZWhu7ebut9cCSks0Tw%40mail.gmail.com.

Reply via email to