Opened 12 years ago

Closed 6 years ago

#10227 closed defect (fixed)

change_labels for sum species structure does not actually change the labels

Reported by: mhansen Owned by: hivert
Priority: major Milestone: sage-7.0
Component: combinatorics Keywords: species
Cc: sage-combinat, mantepse Merged in:
Authors: Mike Hansen Reviewers: Florent Hivert, Martin Rubey
Report Upstream: N/A Work issues:
Branch: 5fda98d (Commits, GitHub, GitLab) Commit: 5fda98d3c6516df514f46e5890717f6e83e3ad5d
Dependencies: Stopgaps:

Status badges

Description

sage: X = species.SingletonSpecies()
sage: X2 = X+X
sage: X2.structures([1]).list()
[1, 1]
sage: s = X2.structures([1]).list()[0]
sage: s.labels()
[1]
sage: s.change_labels(["a"])
1

Attachments (1)

trac_10227-species_fixes-mh.patch (21.7 KB) - added by mhansen 10 years ago.

Download all attachments as: .zip

Change History (28)

comment:1 Changed 12 years ago by mhansen

  • Authors set to Mike Hansen
  • Cc sage-combinat added
  • Milestone set to sage-4.6.2
  • Status changed from new to needs_review

This patch does a couple of things:

  1. Fix the change_labels bug above.
  1. Add a left/right summand/factor method to sum and product species.
  1. Make the labels method return all of the labels rather than just the ones that appear. This is a backwards incompatible change, but I am pretty sure that there isn't really any code out there that depends on this.
  1. Add a labels_subset method to do what the old labels methods did for subsets.
  1. Add additional documentation to some of the classes.

comment:2 Changed 11 years ago by jdemeyer

  • Milestone changed from sage-4.6.2 to sage-4.7

comment:3 Changed 10 years ago by hivert

  • Owner changed from mhansen to hivert
  • Reviewers set to Florent Hivert

I'm assigning the ticket to myself to remember to review it.

comment:4 Changed 10 years ago by mhansen

Florent, if you have time, could you take a quick look at this. #5512 is waiting on it.5512 Thanks!

comment:5 Changed 10 years ago by mhansen

  • Dependencies set to #5512

I rebased trac_10227-species_fixes-mh.patch on #5512

Apply trac_10227-species_fixes-mh.patch

comment:6 Changed 10 years ago by mhansen

  • Dependencies changed from #5512 to #5512, #13317

Changed 10 years ago by mhansen

comment:7 Changed 10 years ago by mhansen

  • Dependencies changed from #5512, #13317 to #5457, #5512, #13317

comment:8 Changed 10 years ago by chapoton

  • Keywords species added

comment:9 Changed 9 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:10 Changed 8 years ago by chapoton

  • Branch set to u/chapoton/10227
  • Commit set to 33131ae7c27ef89147ec09fc297011e89ef38931

New commits:

33131ae#10227: change_labels for sum species structure does not actually change the labels

comment:11 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:12 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:13 Changed 8 years ago by git

  • Commit changed from 33131ae7c27ef89147ec09fc297011e89ef38931 to 9382d6fc32ed505ac7f2bbded5f1e345579e9544

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

0581575Merge branch 'u/chapoton/10227' of ssh://trac.sagemath.org:22/sage into 10227
9382d6ftrac #10277 a few minor doc formatting

comment:14 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:15 Changed 7 years ago by chapoton

  • Milestone changed from sage-6.4 to sage-6.9

comment:16 Changed 7 years ago by git

  • Commit changed from 9382d6fc32ed505ac7f2bbded5f1e345579e9544 to d1d5103607927e9cc9294368075ea6d2fc3fad53

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

d1d5103Merge branch 'u/chapoton/10227' into 6.10.b2

comment:17 Changed 7 years ago by chapoton

  • Milestone changed from sage-6.9 to sage-6.10

comment:18 Changed 6 years ago by chapoton

  • Milestone changed from sage-6.10 to sage-7.0

comment:19 Changed 6 years ago by mantepse

  • Cc mantepse added

comment:20 Changed 6 years ago by mantepse

I'm now building this.

comment:21 Changed 6 years ago by mantepse

Looks OK. It might make sense to add a docstring to change_labels in

composition_species.py:69:    def change_labels(self, labels):
partition_species.py:112:    def change_labels(self, labels):
product_species.py:119:    def change_labels(self, labels):
structure.py:125:    def change_labels(self, labels):
structure.py:267:    def change_labels(self, labels):

I suggest:

Returns a relabelled structure.

INPUT:

- ``labels``, a list of labels.

OUTPUT:

A structure with the i-th label of self replaced with the i-th label of the list.

EXAMPLES::

    sage: C = species.CycleSpecies(3)
    sage: ls1 = C.structures([1,2,3]); ls2 = C.structures(["a", "b", "c"])
    sage: s = s1[0].change_labels(["b", "c", "a"]); t = s2[0]; (s,t,s==t)
    (('b', 'c', 'a'), ('a', 'b', 'c'), False)
    sage: s = s1[0].change_labels(["a", "b", "c"]); t = s2[0]; (s,t,s==t)
    (('a', 'b', 'c'), ('a', 'b', 'c'), True)


comment:22 Changed 6 years ago by git

  • Commit changed from d1d5103607927e9cc9294368075ea6d2fc3fad53 to 5fda98d3c6516df514f46e5890717f6e83e3ad5d

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

8a9b25bMerge branch 'u/chapoton/10227' into 6.7.b3
5fda98dadding doc to change_labels methods

comment:23 follow-up: Changed 6 years ago by mantepse

(You didn't put my example into the doc for change_labels, but that's OK. It's purpose would have been to clarify equality of structures: one might think that (b, c, a) and (a, b, c) are the same cycle, but they are not. So it should actually be in the doc for equality)

Can I give this positive review? (Florent is in the reviewer list, not me)

comment:24 in reply to: ↑ 23 Changed 6 years ago by chapoton

Replying to mantepse:

(You didn't put my example into the doc for change_labels, but that's OK. It's purpose would have been to clarify equality of structures: one might think that (b, c, a) and (a, b, c) are the same cycle, but they are not. So it should actually be in the doc for equality)

Where precisely do you want this example to be added ?

Can I give this positive review? (Florent is in the reviewer list, not me)

Yes, you can ; just add yourself to the reviewer list.

comment:25 Changed 6 years ago by mantepse

  • Reviewers changed from Florent Hivert to Florent Hivert, Martin Rubey
  • Status changed from needs_review to positive_review

comment:26 Changed 6 years ago by vbraun

  • Dependencies #5457, #5512, #13317 deleted

comment:27 Changed 6 years ago by vbraun

  • Branch changed from u/chapoton/10227 to 5fda98d3c6516df514f46e5890717f6e83e3ad5d
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.