Ticket #5178 (needs_work enhancement)

Opened 4 years ago

Last modified 2 years ago

[with patch, needs work (doc cleanup)] change LLL_gram to work with Gram matrices with not-necessarily integer entries

Reported by: was Owned by: was
Priority: major Milestone: sage-5.10
Component: linear algebra Keywords:
Cc: Work issues:
Report Upstream: Fixed upstream, in a later stable release. Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

This patch changes LLL_gram to work with Gram matrices with not-necessarily integer entries. Also it fixes several "non-optimal" coding issues both in the old implementation and the doctests. For example, instead of computing U.det() to determine if the unimodular A has det -1 or 1, we just compute A.change_ring(GF(3)).det(), which is much faster.

Changing LLL_gram to work for nonintegral gram matrices is critical for applications to computing class groups for the course I'm teaching right now.

Attachments

trac_5178.patch Download (5.9 KB) - added by was 4 years ago.

Change History

Changed 4 years ago by was

comment:1 Changed 4 years ago by was

Gonzalo Tornaria sent this review in email to me:

Looks good to me.

However, it seems pari is hanging when using lllgram() on some
matrices with rational or integer entries; maybe indefinite or
semidefinite matrices are the issue.
Moreover, sage hangs badly on this...

E.g.

sage: pari("[1,1;1,1/2]").qflllgram()

(it also hangs when running equivalent command from gp, Ctrl-C stops
gp but not sage).
[equivalent command = qflllgram([1,1,1,1/2])

However, using 0.5 instead of 1/2 works ok.

Seems a bug in pari, but it was not exposed in sage's LLL_gram() before.

Gonzalo

He does point out that bad things can happen, but that the bugs are in PARI, not the new code attached to this patch.

comment:2 Changed 4 years ago by boothby

I reported the bug upstream. Is Gonzalo's +1 good enough? I'm not really comfortable with LLL enough to sign off on this.

comment:3 Changed 4 years ago by boothby

  • Summary changed from [with patch; needs review] change LLL_gram to work with Gram matrices with not-necessarily integer entries to [with patch; review] change LLL_gram to work with Gram matrices with not-necessarily integer entries

Email from Bill Allombert in response to the bug:

Hello,
This problem does not occurs with PARI 2.4.3.
This seems to be another instance of bug #505 which was fixed in
PARI 2.4.1 as

 1- qflll / qflllgram (t_MAT with t_FRAC entries) would not reduce to
    the integer case (--> insufficient precision, SEGV) [#505]

The fix should probably be backported.

Thanks for your bug report,
Bill

comment:4 Changed 4 years ago by mabshoff

So, it this a positive review then?

Nick did ping me last night about updating to pari 2.4.3svn sources and it seems that we don't really have a choice any more. But this issue should be raised on sage-nt I guess.

Cheers,

Michael

comment:5 Changed 4 years ago by ncalexan

  • Summary changed from [with patch; review] change LLL_gram to work with Gram matrices with not-necessarily integer entries to [with patch, needs review] change LLL_gram to work with Gram matrices with not-necessarily integer entries

Can we get some movement on this? I don't think an updated pari is happening anytime soon but it would be nice to close this.

comment:6 Changed 4 years ago by craigcitro

  • Summary changed from [with patch, needs review] change LLL_gram to work with Gram matrices with not-necessarily integer entries to [with patch, needs work (doc cleanup)] change LLL_gram to work with Gram matrices with not-necessarily integer entries

This looks good. The only objection I have is that the documentation isn't correctly formatted for sphinx -- in particular, the various sections of the docstring (like EXAMPLES) should have a double colon, and there should be more blank lines to get things to format correctly. Also, one or two more examples with noninteger entries in the docstring wouldn't hurt, if you're already there. Maybe something from a class group computation, even if it requires # long?

comment:7 Changed 2 years ago by boothby

  • Report Upstream set to N/A

Just got an email from Bill Allombert regarding this bug:

Hello,
PARI 2.5.0-stable was released with a fix for this problem,
closing this report.

Thanks for using our bug tracking system,
Cheers,
Bill.

comment:8 Changed 2 years ago by boothby

  • Status changed from needs_work to closed
  • Resolution set to fixed
  • Report Upstream changed from N/A to Fixed upstream, in a later stable release.

comment:9 Changed 2 years ago by boothby

  • Status changed from closed to new
  • Resolution fixed deleted

oops, didn't realize changing the "upstream" field would close the ticket

comment:10 Changed 2 years ago by boothby

  • Status changed from new to needs_review

comment:11 Changed 2 years ago by boothby

  • Status changed from needs_review to needs_work
Note: See TracTickets for help on using tickets.