sagemath / sage

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

Smith form of p-adic matrices #23450

Closed xcaruso closed 6 years ago

xcaruso commented 7 years ago

Currently Smith form are not implemented over inexact rings.

This ticket provides a (currently unoptimized) implementation of Smith normal form over complete discrete valuation rings/fields (e.g. p-adic rings/fields).

CC: @roed314 @saraedum @sagetrac-TristanVaccon @kedlaya

Component: padics

Keywords: sd87

Author: Xavier Caruso, Julian Rüth, David Roe

Branch/Commit: e6f54bb

Reviewer: Julian Rüth, David Roe

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

saraedum commented 7 years ago

Changed work issues from failing unit tests to failing unit tests, clarify meaning of integral, talk about precision

saraedum commented 7 years ago
comment:32

Xavier: Could you write something about what it means for an entry on the diagonal to be zero (in the field case)? I mean it is somewhat unclear since we compute with inexact elements.

fchapoton commented 7 years ago
comment:33

doc does not build

+[dochtml] [matrices ] docstring of sage.matrix.matrix2.Matrix.smith_form:26: WARNING: Bullet list ends without a blank line; unexpected unindent.
+[dochtml] [matrices ] docstring of sage.matrix.matrix2.Matrix.smith_form:29: WARNING: Bullet list ends without a blank line; unexpected unindent.

The issue is in the INPUT field there.

4dfe6752-6233-4f7f-8e0e-e1363b12c1b7 commented 7 years ago

Changed branch from u/saraedum/padic_smith to u/aly.deines/padic_smith

4dfe6752-6233-4f7f-8e0e-e1363b12c1b7 commented 7 years ago

New commits:

1fd5309Merge branch 'u/saraedum/padic_smith' of git://trac.sagemath.org/sage into t/23450/padic_smith
89ec3abRemoved trailing whitespace.
4dfe6752-6233-4f7f-8e0e-e1363b12c1b7 commented 7 years ago

Changed commit from 502c887 to 89ec3ab

4dfe6752-6233-4f7f-8e0e-e1363b12c1b7 commented 7 years ago
comment:36

Changed to needs work because of above issues.

simonbrandhorst commented 7 years ago
comment:37

ping - I could really use this p-adic smith form. (over ZZp) Need help? (not an expert though)

fchapoton commented 6 years ago

Changed branch from u/aly.deines/padic_smith to public/23450

fchapoton commented 6 years ago

Changed commit from 89ec3ab to 8b239f4

fchapoton commented 6 years ago

New commits:

d92d3e9Merge branch 'u/aly.deines/padic_smith' in 8.1.rc4
8b239f4trac 23450 details of doc
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

93d4e32Merge branch 'public/23450' in 8.1
14f591cfixing 2 doctests
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from 8b239f4 to 14f591c

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from 14f591c to cf85a34

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

cf85a34Merge branch 'public/23450' of ssh://trac.sagemath.org/sage into t/23450/padic_smith
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from cf85a34 to 7ad838a

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

7ad838aRemove _get_matrix_class that was inadvertently added in a merge
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

b5863a1Add newline back in from fix to matrix_space.py
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from 7ad838a to b5863a1

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from b5863a1 to 777f494

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

777f494Remove the tracks_precision method and update the p-adic smith form to be able to deal with lattice elements
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

d78a1d5Add exact parameter to _matrix_smith_form, fix precision behavior and allow integral=True for non-padic matrices
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from 777f494 to d78a1d5

roed314 commented 6 years ago

Changed author from Xavier Caruso, Julian Rüth to Xavier Caruso, Julian Rüth, David Roe

roed314 commented 6 years ago
comment:47

If Xavier is happy with my changes, I'm happy to give this positive review.

roed314 commented 6 years ago

Changed reviewer from Julian Rüth to Julian Rüth, David Roe

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from d78a1d5 to f7d4e38

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

f7d4e38lift_to_precision() was missing at some point
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

0d46aa5Add a test: Smith form of the zero matrix
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from f7d4e38 to 0d46aa5

xcaruso commented 6 years ago
comment:50

I've fixed a small issue with precision.

Now, everything seems fine to me. I let you give a positive review if you're OK (and if the patchbot is happy)

roed314 commented 6 years ago
comment:51

Patchbot is green, so positive review.

fchapoton commented 6 years ago

Changed work issues from failing unit tests, clarify meaning of integral, talk about precision to none

vbraun commented 6 years ago
comment:54

Tests fail

    UnboundLocalError: local variable 'precM' referenced before assignment
kiwifb commented 6 years ago
comment:55

Let me add a bit of details, 6 doctests fails

sage -t --long /usr/lib64/python2.7/site-packages/sage/rings/padics/padic_lattice_element.py  # 4 doctests failed
sage -t --long /usr/lib64/python2.7/site-packages/sage/rings/padics/padic_base_leaves.py  # 2 doctests failed

and they all fail the same way

File "/usr/lib64/python2.7/site-packages/sage/rings/padics/padic_base_leaves.py", line 879, in sage.rings.padics.padic_base_leaves.pAdicRingLattice.__init__
Failed example:
    TestSuite(R).run(skip='_test_teichmuller')
Expected nothing
Got:
    Failure in _test_matrix_smith:
    Traceback (most recent call last):
      File "/usr/lib64/python2.7/site-packages/sage/misc/sage_unittest.py", line 294, in run
        test_method(tester = tester)
      File "/usr/lib64/python2.7/site-packages/sage/rings/padics/local_generic.py", line 1248, in _test_matrix_smith
        S,U,V = M.smith_form(integral=base)
      File "sage/matrix/matrix2.pyx", line 13416, in sage.matrix.matrix2.Matrix.smith_form (/dev/shm/portage/sci-mathematics/sage-9999/work/sage-9999/src-python2_7/build/cythonized/sage/matrix/matrix2.c:96167)
        return R._matrix_smith_form(self, transformation=transformation, integral=integral, exact=exact)
      File "/usr/lib64/python2.7/site-packages/sage/rings/padics/local_generic.py", line 1148, in _matrix_smith_form
        if inexact_ring and not allzero and val >= precM:
    UnboundLocalError: local variable 'precM' referenced before assignment
    ------------------------------------------------------------
    The following tests failed: _test_matrix_smith

ending in local_generic.py.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from 0d46aa5 to e6f54bb

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

0613f84Recompute precM in the lattice precision framework
e6f54bbMerge branch 'develop' into t/23450/public/23450
xcaruso commented 6 years ago
comment:57

Should be fixed.

roed314 commented 6 years ago
comment:58

The patchbots continue to be noisy, but this looks good to me.

vbraun commented 6 years ago

Changed branch from public/23450 to e6f54bb