Ticket #5600 (closed enhancement: fixed)

Opened 12 months ago

Last modified 7 months ago

[with patch, positive review] Cleanup of integer compositions

Reported by: nthiery Owned by: nthiery
Priority: major Milestone: sage-4.1.2
Component: combinatorics Keywords: integer compositions
Cc: sage-combinat, jbandlow Author(s): Nicolas M. Thiéry
Report Upstream: Reviewer(s): Dan Drake, Jason Bandlow, Minh Van Nguyen
Merged in: Sage 4.1.2.alpha0 Work issues:

Description (last modified by nthiery) (diff)

  • Documentation improvements
  • Fixes some of  http://wiki.sagemath.org/combinat/Weirdness
  • Composition(l) accepts any iterable l, and in particular a tuple
  • New functionalities:
    • concatenation (as add and sum)
    • size
    • fatter, finer, fatten (refinement of compositions)
  • Uses IntegerListsLex? (fast iteration, ...) instead of not any better specific code Note: this changes the iteration order to inverse lexicographic, and iteration changes the iteration order for set partitions, skew partitions, and skew tableaux.

Attachments

compositions-cleanup-5600-nt.patch Download (40.4 KB) - added by nthiery 10 months ago.
trac_5600-compositions_cleanup-nt.2.patch Download (41.5 KB) - added by nthiery 8 months ago.
trac_5600-compositions_cleanup-nt.patch Download (41.5 KB) - added by nthiery 8 months ago.
Apply only this one, yes, this one!
trac_5600-reviewer.patch Download (6.8 KB) - added by mvngu 7 months ago.
reviewer patch

Change History

  Changed 12 months ago by nthiery

  • description modified (diff)

  Changed 12 months ago by nthiery

  • description modified (diff)

  Changed 12 months ago by nthiery

  • cc sage-combinat-devel@… removed
  • description modified (diff)

  Changed 11 months ago by nthiery

  • cc sage-combinat added

  Changed 11 months ago by nthiery

  • keywords integer compositions added
  • description modified (diff)
  • summary changed from Cleanup of integer compositions to [with patch, needs review] Cleanup of integer compositions

Changed 10 months ago by nthiery

  Changed 10 months ago by nthiery

  • status changed from new to assigned

  Changed 10 months ago by ddrake

  • summary changed from [with patch, needs review] Cleanup of integer compositions to [with patch, needs work] Cleanup of integer compositions

I very much want this patch to get in, since I almost opened a ticket for one of the problems that it fixes. (Composition() doesn't take tuples as input.) One thing that needs to change, though, is with the docstring for Composition: right now, it tells the user to do Composition_class?, but that doesn't work since Composition_class is not in the default namespace. I think Composition? should simply display the correct docstring; there's no need to annoy the user by sending him or her bouncing from one docstring to the next.

Another issue is that the AUTHORS block is deleted from the head of the file. This should not be done. In fact, you should add yourself to it as the  developer's guide suggests: something like "Nicolas M. Thiery (2009-05-25): several cleanups, new functions, and improvements (trac #5600)". I like listing ticket numbers because interested developers can go see exactly what you changed.

Tiny grammar/spelling issues:

  • At the top of compositions.py, you write "a compositions c of..."; you should use the singular. "A composition c of..."
  • line 56: you say a composition is a list of positive integers, but it should be a list of nonnegative integers.

Finally, I am seeing a doctest failure with this patch applied to vanilla 4.0.rc0:

**********************************************************************
File "/var/tmp/sage-4.0.rc0/devel/sage/sage/combinat/ribbon_tableau.py", line 875:
    sage: SemistandardMultiSkewTableaux([sp[0], sp[-1]],[2,2,2]).list()
Expected:
    [[[[1], [2], [3]], [[1, 2, 3]]]]
Got:
    [[[[1, 1, 2]], [[None, None, 3], [None, 3], [2]]], [[[1, 2, 2]], [[None, None, 3], [None, 3], [1]]], [[[1, 1, 2]], [[None, None, 3], [None, 2], [3]]], [[[1, 2, 2]], [[None, None, 3], [None, 1], [3]]], [[[1, 1, 2]], [[None, None, 2], [None, 3], [3]]], [[[1, 2, 2]], [[None, None, 1], [None, 3], [3]]], [[[1, 1, 3]], [[None, None, 3], [None, 2], [2]]], [[[1, 2, 3]], [[None, None, 3], [None, 2], [1]]], [[[1, 2, 3]], [[None, None, 3], [None, 1], [2]]], [[[2, 2, 3]], [[None, None, 3], [None, 1], [1]]], [[[1, 1, 3]], [[None, None, 2], [None, 3], [2]]], [[[1, 2, 3]], [[None, None, 2], [None, 3], [1]]], [[[1, 2, 3]], [[None, None, 1], [None, 3], [2]]], [[[2, 2, 3]], [[None, None, 1], [None, 3], [1]]], [[[1, 1, 3]], [[None, None, 2], [None, 2], [3]]], [[[1, 2, 3]], [[None, None, 2], [None, 1], [3]]], [[[1, 2, 3]], [[None, None, 1], [None, 2], [3]]], [[[2, 2, 3]], [[None, None, 1], [None, 1], [3]]], [[[1, 3, 3]], [[None, None, 2], [None, 2], [1]]], [[[1, 3, 3]], [[None, None, 2], [None, 1], [2]]], [[[1, 3, 3]], [[None, None, 1], [None, 2], [2]]], [[[2, 3, 3]], [[None, None, 2], [None, 1], [1]]], [[[2, 3, 3]], [[None, None, 1], [None, 2], [1]]], [[[2, 3, 3]], [[None, None, 1], [None, 1], [2]]]]
**********************************************************************

  Changed 8 months ago by nthiery

  • cc jbandlow added
  • reviewer set to Dan Drake, Jason Bandlow
  • milestone changed from sage-combinat to sage-4.1.1
  • summary changed from [with patch, needs work] Cleanup of integer compositions to [with patch, needs review] Cleanup of integer compositions
  • author set to Nicolas M. Thiéry

The updated patch fixes the (the failure was actually actually a trivial thing in the doctest; thanks to Jason for spotting this!)

Changed 8 months ago by nthiery

Changed 8 months ago by nthiery

Apply only this one, yes, this one!

  Changed 8 months ago by jbandlow

  • summary changed from [with patch, needs review] Cleanup of integer compositions to [with patch, positive review] Cleanup of integer compositions

Doctests pass, and it looks like Dan's issues have been resolved. Positive review from me.

Changed 7 months ago by mvngu

reviewer patch

follow-up: ↓ 11   Changed 7 months ago by mvngu

I'm attaching the reviewer patch trac_5600-reviewer.patch. It fixes a number of typos introduced by trac_5600-compositions_cleanup-nt.patch, and edits some docstrings so they look a bit nicer when one views the corresponding pages in the reference manual. If people are happy with my reviewer patch trac_5600-reviewer.patch, then patches should be merged in this order:

  1. trac_5600-compositions_cleanup-nt.patch
  2. trac_5600-reviewer.patch

in reply to: ↑ 10   Changed 7 months ago by nthiery

Replying to mvngu:

I'm attaching the reviewer patch trac_5600-reviewer.patch. It fixes a number of typos introduced by trac_5600-compositions_cleanup-nt.patch, and edits some docstrings so they look a bit nicer when one views the corresponding pages in the reference manual. If people are happy with my reviewer patch trac_5600-reviewer.patch, then patches should be merged in this order: 1. trac_5600-compositions_cleanup-nt.patch 1. trac_5600-reviewer.patch

Thanks much for fixing all those typos! positive review on your reviewer's patch.

  Changed 7 months ago by mvngu

  • status changed from assigned to closed
  • reviewer changed from Dan Drake, Jason Bandlow to Dan Drake, Jason Bandlow, Minh Van Nguyen
  • resolution set to fixed
  • merged set to Sage 4.1.2.alpha0

Merged patches in this order:

  1. trac_5600-compositions_cleanup-nt.patch
  2. trac_5600-reviewer.patch
Note: See TracTickets for help on using tickets.