Ticket #5787 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

[with third patch, with positive review] Improve doctest coverage for sage/modular/hecke (continued)

Reported by: davidloeffler Owned by: davidloeffler
Priority: major Milestone: sage-4.0
Component: modular forms Keywords: doctests
Cc: Work issues:
Report Upstream: Reviewers: Craig Citro, David Loeffler
Authors: David Loeffler, Craig Citro Merged in: 4.0.alpha0
Dependencies: Stopgaps:

Description

This is a continuation of #5736. The patch which I am about to upload contains more doctests and bugfixes for sage/modular/hecke. The main change this makes is in the methods for constructing elements of Hecke algebras: previously these accepted more or less arbitrary matrices as input (despite the fact that all Hecke algebras in Sage are supposed to be commutative). Similarly, any element of a full Hecke algebra could be coerced into the corresponding anemic algebra -- including the Hecke operators at primes dividing the level -- which is not great.

I've also added an extra check into the __mul__ method of the MatrixMorphism? class; what's the point of having morphism objects that remember their domain and codomain if one doesn't check compatibility when composing them?

Attachments

trac_5787-all.patch Download (66.4 KB) - added by davidloeffler 4 years ago.
replaces all previous patches
trac_5787_pt2.patch Download (19.8 KB) - added by craigcitro 4 years ago.
trac_5787_pt2_rebased.patch Download (19.3 KB) - added by davidloeffler 4 years ago.
rebased not to conflict with #4357
trac_5787_pt3.patch Download (1.2 KB) - added by davidloeffler 4 years ago.

Change History

comment:1 Changed 4 years ago by davidloeffler

  • Status changed from new to assigned

Oops -- sorry, I messed up, that patch was incomplete (it applies OK but doctests do not pass). Please use both the patches above; then it will work.

Changed 4 years ago by davidloeffler

replaces all previous patches

comment:2 Changed 4 years ago by davidloeffler

The patch I've just uploaded unifies the previous two patches, and adds some more doctests to bring the coverage higher still (although not quite to 100% as I don't have time right now to understand some of the weirder things that are going on in hecke/submodule.py). Note that again this patch is designed to be applied over the patches at #5736.

Changed 4 years ago by craigcitro

comment:3 follow-up: ↓ 4 Changed 4 years ago by craigcitro

  • Summary changed from [with patch, needs review] Improve doctest coverage for sage/modular/hecke (continued) to [with second patch, needs review] Improve doctest coverage for sage/modular/hecke (continued)

This looks good. I started adding a few changes while refereeing, and then I got motivated and went ahead and finished doctesting sage/modular/hecke. So positive review for David's part, and now someone needs to review my (much shorter) patch. After this, the only part of sage/modular still needing any doctesting is the modsym directory.

comment:4 in reply to: ↑ 3 Changed 4 years ago by cremona

Replying to craigcitro:

This looks good. I started adding a few changes while refereeing, and then I got motivated and went ahead and finished doctesting sage/modular/hecke. So positive review for David's part, and now someone needs to review my (much shorter) patch. After this, the only part of sage/modular still needing any doctesting is the modsym directory.

I think it would be better for David to review Craig's extra patch rather than a newcomer.

Last docdays I started properly doctesting modsym, but only got two of the files done. I do intend to do more.

comment:5 Changed 4 years ago by davidloeffler

At a glance, I can spot two small problems: firstly, the new doctest for __cmp__ in submodule.py fails on my machine; secondly, Craig's patch changes the intersection method (so it works for modular forms spaces as well as modular symbols) but I also did the same in #4357, so those are going to conflict.

I'm not entirely sure why the first failure happens: although __cmp__ doctests are always irritatingly machine-dependent when comparing objects of different types, the comparison order for submodules of a common ambient module should be consistent, surely? I'm changing this back to "needs work" until we can get to the bottom of this. Once that's sorted I'll do a rebased version that combines this with #4357.

David

comment:6 Changed 4 years ago by davidloeffler

  • Summary changed from [with second patch, needs review] Improve doctest coverage for sage/modular/hecke (continued) to [with second patch, needs work] Improve doctest coverage for sage/modular/hecke (continued)

Changed 4 years ago by davidloeffler

rebased not to conflict with #4357

Changed 4 years ago by davidloeffler

comment:7 Changed 4 years ago by davidloeffler

  • Summary changed from [with second patch, needs work] Improve doctest coverage for sage/modular/hecke (continued) to [with third patch, needs review] Improve doctest coverage for sage/modular/hecke (continued)

On inspection, it turns out that the __cmp__ routine was written stupidly anyway, so I rewrote it. Hence the third patch above. So now applying trac_5787-all.patch, trac_5787_pt2_rebased.patch, and trac_5787_pt3.patch (on top of the already-merged #5736 patches and #4357) should not conflict -- at least it doesn't on my machine.

Craig: I'm entirely happy with the rest of your changes, so if you could just check to make sure that applying #5736 + #4357 + the patches here works for you and passes doctests, I think we can call this a positive review at last.

comment:8 Changed 4 years ago by craigcitro

  • Summary changed from [with third patch, needs review] Improve doctest coverage for sage/modular/hecke (continued) to [with third patch, with positive review] Improve doctest coverage for sage/modular/hecke (continued)

Yep, I'm happy with the changes. I didn't get a chance to do a full doctest run, but Michael surely will when he commits, so I'm going to leave that to him. :)

comment:9 Changed 4 years ago by mabshoff

  • Status changed from assigned to closed
  • Resolution set to fixed

Merged

  • trac_5787-all.patch
  • trac_5787_pt2_rebased.patch
  • trac_5787_pt3.patch

in Sage 4.0.alpha0.

Cheers,

Michael

comment:10 Changed 4 years ago by davidloeffler

  • Reviewers set to Craig Citro, David Loeffler
  • Merged in set to 4.0.alpha0
  • Authors set to David Loeffler, Craig Citro
Note: See TracTickets for help on using tickets.