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

random doctest failure in src/sage/matrix/matrix_integer_dense_hnf.py #33751

Closed
yyyyx4 opened this issue Apr 24, 2022 · 9 comments
Closed

random doctest failure in src/sage/matrix/matrix_integer_dense_hnf.py #33751

yyyyx4 opened this issue Apr 24, 2022 · 9 comments

Comments

@yyyyx4
Copy link
Member

yyyyx4 commented Apr 24, 2022

Part of #32544:

sage -t --random-seed=47467259736041671371069989299524409608 src/sage/matrix/matrix_integer_dense_hnf.py
**********************************************************************
File "src/sage/matrix/matrix_integer_dense_hnf.py", line 1240, in sage.matrix.matrix_integer_dense_hnf.?
Failed example:
    matrix_integer_dense_hnf.sanity_checks(times=5, check_using_magma=False)
Exception raised:
    Traceback (most recent call last):
      File "~/sage/src/sage/doctest/forker.py", line 695, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "~/sage/src/sage/doctest/forker.py", line 1093, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.matrix.matrix_integer_dense_hnf.?[1]>", line 1, in <module>
        matrix_integer_dense_hnf.sanity_checks(times=Integer(5), check_using_magma=False)
      File "~/sage/src/sage/matrix/matrix_integer_dense_hnf.py", line 1285, in sanity_checks
        __do_check([random_matrix(ZZ, n, m, x=-2**32, y=2**32)
      File "~/sage/src/sage/matrix/matrix_integer_dense_hnf.py", line 1276, in __do_check
        if hnf(a)[0] != a.echelon_form(algorithm='pari'):
      File "~/sage/src/sage/matrix/matrix_integer_dense_hnf.py", line 1106, in hnf
        H, pivots = probable_hnf(A, include_zero_rows=include_zero_rows,
      File "~/sage/src/sage/matrix/matrix_integer_dense_hnf.py", line 926, in probable_hnf
        H = hnf_square(C, proof=proof)
      File "~/sage/src/sage/matrix/matrix_integer_dense_hnf.py", line 568, in hnf_square
        raise ValueError("A must be square.")
    ValueError: A must be square.
**********************************************************************

(From a patchbot run in #33619.)

Component: linear algebra

Author: Jonathan Kliem

Branch/Commit: 7ac22ad

Reviewer: Kevin Lui

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

@yyyyx4 yyyyx4 added this to the sage-9.6 milestone Apr 24, 2022
@kliem
Copy link
Contributor

kliem commented Apr 25, 2022

comment:1

This is awful.

hnf calls probable_hnf unconditionally. probable_hnf clearly states that it might raise an exception and must be called again in this case. The documentation of hnf makes no such statements and I guess just assumes that probable_hnf is always correct.

@kliem
Copy link
Contributor

kliem commented Apr 25, 2022

comment:2

But running something in an infinite loop until it works is also an awful idea, I guess.

@kliem
Copy link
Contributor

kliem commented Apr 25, 2022

comment:3

I guess in the case of proof=True we just add another test to the loop.
I still do not like the idea of running something in infinite loop (especially as I don't even know what it is doing).

But probable_hnf explicitly states that this can happen and that in this case it should be called again, so hnf with proof=True should account for this.


New commits:

7ac22adcatch value error of probable_hnf

@kliem
Copy link
Contributor

kliem commented Apr 25, 2022

Branch: public/33751

@kliem
Copy link
Contributor

kliem commented Apr 25, 2022

Commit: 7ac22ad

@kliem
Copy link
Contributor

kliem commented Apr 25, 2022

Author: Jonathan Kliem

@kevinywlui
Copy link
Mannequin

kevinywlui mannequin commented Apr 26, 2022

Reviewer: Kevin Lui

@kliem
Copy link
Contributor

kliem commented Apr 26, 2022

comment:5

Thank you.

@vbraun
Copy link
Member

vbraun commented May 12, 2022

Changed branch from public/33751 to 7ac22ad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants