Opened 8 months ago

Closed 7 months ago

#27654 closed enhancement (fixed)

py3 : Fix combinat/root_system/integrable_representations.py for python3.

Reported by: vklein Owned by:
Priority: major Milestone: sage-8.8
Component: python3 Keywords:
Cc: Merged in:
Authors: Vincent Klein Reviewers: Travis Scrimshaw, John Palmieri
Report Upstream: N/A Work issues:
Branch: ef632a1 (Commits) Commit: ef632a1bf976d2c717b7e1d49ddc9c2c2508d65f
Dependencies: Stopgaps:

Description (last modified by vklein)

Fix combinat/root_system/integrable_representations.py for python3.

Use #py3 #py2 doctest flags.

Change History (16)

comment:1 Changed 8 months ago by vklein

  • Branch set to u/vklein/27654

comment:2 Changed 8 months ago by vklein

  • Commit set to 2a1ce980d4ac8d5b7db09e44887fdc08f1f74988
  • Status changed from new to needs_review

New commits:

2a1ce98Trac 27654: Fix integrable_representation.py ...

comment:3 Changed 8 months ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to needs_info

I am -1 on sorting the output of dominant_maximal_weights. That seems to have a fixed output order (assuming RecursivelyEnumeratedSet does, but it should). I think it would be better for the printing to match that order. Or does the output order change in Python3?

comment:4 follow-up: Changed 8 months ago by chapoton

with python3:

sage -t --long src/sage/combinat/root_system/integrable_representations.py
**********************************************************************
File "src/sage/combinat/root_system/integrable_representations.py", line 89, in sage.combinat.root_system.integrable_representations.IntegrableRepresentation
Failed example:
    IntegrableRepresentation(Lambda[1]+Lambda[2]+Lambda[3]).print_strings()
Expected:
    2*Lambda[0] + Lambda[2]: 4 31 161 665 2380 7658 22721 63120 166085 417295 1007601 2349655
    Lambda[0] + 2*Lambda[1]: 2 18 99 430 1593 5274 16005 45324 121200 308829 754884 1779570
    Lambda[0] + 2*Lambda[3]: 2 18 99 430 1593 5274 16005 45324 121200 308829 754884 1779570
    Lambda[1] + Lambda[2] + Lambda[3]: 1 10 60 274 1056 3601 11199 32354 88009 227555 563390 1343178
    3*Lambda[2] - delta: 3 21 107 450 1638 5367 16194 45687 121876 310056 757056 1783324
Got:
    2*Lambda[0] + Lambda[2]: 4 31 161 665 2380 7658 22721 63120 166085 417295 1007601 2349655
    Lambda[0] + 2*Lambda[3]: 2 18 99 430 1593 5274 16005 45324 121200 308829 754884 1779570
    Lambda[0] + 2*Lambda[1]: 2 18 99 430 1593 5274 16005 45324 121200 308829 754884 1779570
    Lambda[1] + Lambda[2] + Lambda[3]: 1 10 60 274 1056 3601 11199 32354 88009 227555 563390 1343178
    3*Lambda[2] - delta: 3 21 107 450 1638 5367 16194 45687 121876 310056 757056 1783324
**********************************************************************
File "src/sage/combinat/root_system/integrable_representations.py", line 162, in sage.combinat.root_system.integrable_representations.IntegrableRepresentation
Failed example:
    V.print_strings() # long time
Expected:
    6*Lambdacheck[0]: 4 28 100 320 944 2460 6064 14300 31968 69020 144676 293916
    4*Lambdacheck[0] + Lambdacheck[2]: 4 22 84 276 800 2124 5288 12470 28116 61056 128304 261972
    3*Lambdacheck[0] + Lambdacheck[1]: 2 16 58 192 588 1568 3952 9520 21644 47456 100906 207536
    Lambdacheck[0] + Lambdacheck[1] + Lambdacheck[2]: 1 6 26 94 294 832 2184 5388 12634 28390 61488 128976
    2*Lambdacheck[1] - deltacheck: 2 8 32 120 354 980 2576 6244 14498 32480 69776 145528
    2*Lambdacheck[0] + 2*Lambdacheck[2]: 2 12 48 164 492 1344 3428 8256 18960 41844 89208 184512
    3*Lambdacheck[2] - deltacheck: 4 16 60 208 592 1584 4032 9552 21728 47776 101068 207888
Got:
    6*Lambdacheck[0]: 4 28 100 320 944 2460 6064 14300 31968 69020 144676 293916
    3*Lambdacheck[0] + Lambdacheck[1]: 2 16 58 192 588 1568 3952 9520 21644 47456 100906 207536
    4*Lambdacheck[0] + Lambdacheck[2]: 4 22 84 276 800 2124 5288 12470 28116 61056 128304 261972
    Lambdacheck[0] + Lambdacheck[1] + Lambdacheck[2]: 1 6 26 94 294 832 2184 5388 12634 28390 61488 128976
    2*Lambdacheck[1] - deltacheck: 2 8 32 120 354 980 2576 6244 14498 32480 69776 145528
    2*Lambdacheck[0] + 2*Lambdacheck[2]: 2 12 48 164 492 1344 3428 8256 18960 41844 89208 184512
    3*Lambdacheck[2] - deltacheck: 4 16 60 208 592 1584 4032 9552 21728 47776 101068 207888
**********************************************************************
File "src/sage/combinat/root_system/integrable_representations.py", line 172, in sage.combinat.root_system.integrable_representations.IntegrableRepresentation
Failed example:
    V.print_strings() # long time
Expected:
    5*Lambda[0]: 3 42 378 2508 13707 64650 272211 1045470 3721815 12425064 39254163 118191378
    3*Lambda[0] + Lambda[2]: 1 23 234 1690 9689 47313 204247 800029 2893198 9786257 31262198 95035357
    Lambda[0] + 2*Lambda[1]: 1 14 154 1160 6920 34756 153523 612354 2248318 7702198 24875351 76341630
    Lambda[0] + Lambda[1] + Lambda[3] - 2*delta: 6 87 751 4779 25060 113971 464842 1736620 6034717 19723537 61152367 181068152
    Lambda[0] + 2*Lambda[2] - 2*delta: 3 54 499 3349 18166 84836 353092 1341250 4725259 15625727 48938396 146190544
    Lambda[0] + 2*Lambda[3] - 4*delta: 15 195 1539 9186 45804 200073 789201 2866560 9723582 31120281 94724550 275919741
Got:
    5*Lambda[0]: 3 42 378 2508 13707 64650 272211 1045470 3721815 12425064 39254163 118191378
    3*Lambda[0] + Lambda[2]: 1 23 234 1690 9689 47313 204247 800029 2893198 9786257 31262198 95035357
    Lambda[0] + Lambda[1] + Lambda[3] - 2*delta: 6 87 751 4779 25060 113971 464842 1736620 6034717 19723537 61152367 181068152
    Lambda[0] + 2*Lambda[3] - 4*delta: 15 195 1539 9186 45804 200073 789201 2866560 9723582 31120281 94724550 275919741
    Lambda[0] + 2*Lambda[1]: 1 14 154 1160 6920 34756 153523 612354 2248318 7702198 24875351 76341630
    Lambda[0] + 2*Lambda[2] - 2*delta: 3 54 499 3349 18166 84836 353092 1341250 4725259 15625727 48938396 146190544
**********************************************************************
File "src/sage/combinat/root_system/integrable_representations.py", line 913, in sage.combinat.root_system.integrable_representations.IntegrableRepresentation.dominant_maximal_weights
Failed example:
    IntegrableRepresentation(2*Lambda[0]).dominant_maximal_weights()
Expected:
    (2*Lambda[0],
     Lambda[0] + Lambda[2] - delta,
     2*Lambda[1] - delta,
     Lambda[1] + Lambda[3] - 2*delta,
     2*Lambda[2] - 2*delta,
     2*Lambda[3] - 3*delta)
Got:
    (2*Lambda[0],
     Lambda[0] + Lambda[2] - delta,
     Lambda[1] + Lambda[3] - 2*delta,
     2*Lambda[3] - 3*delta,
     2*Lambda[1] - delta,
     2*Lambda[2] - 2*delta)

comment:5 follow-ups: Changed 8 months ago by tscrim

So that means anything involving RecursivelyEnumeratedSet will likely be inconsistent across Python versions. :/ Hmmm... I don't really like the sorting on the print output that splits it from the dominant_maximal_weights() output, but IMO that should not be sorted either. We definitely do not want to mark the output as # random. I guess we do # py2 and # py3 versions? The only other decent option would be to always sort the output of dominant_maximal_weights().

comment:6 in reply to: ↑ 5 Changed 8 months ago by andrew.mathas

Replying to tscrim:

So that means anything involving RecursivelyEnumeratedSet will likely be inconsistent across Python versions. :/ Hmmm... I don't really like the sorting on the print output that splits it from the dominant_maximal_weights() output, but IMO that should not be sorted either. We definitely do not want to mark the output as # random. I guess we do # py2 and # py3 versions? The only other decent option would be to always sort the output of dominant_maximal_weights().

In https://trac.sagemath.org/ticket/27710, following the discussion in https://groups.google.com/forum/#!topic/sage-devel/kokSk7Nc8T8 I've marked some output as #random print output.

comment:7 in reply to: ↑ 4 Changed 8 months ago by vklein

Replying to chapoton:

with python3:

 sage -t --long src/sage/combinat/root_system/integrable_representations.py
 **********************************************************************
 File "src/sage/combinat/root_system/integrable_representations.py", line 89, in sage.combinat.root_system.integrable_representations.IntegrableRepresentation
 Failed example:
     IntegrableRepresentation(Lambda[1]+Lambda[2]+Lambda[3]).print_strings()
 Expected:
     2*Lambda[0] + Lambda[2]: 4 31 161 665 2380 7658 22721 63120 166085 417295 1007601 2349655
...
 Got:
     (2*Lambda[0],
      Lambda[0] + Lambda[2] - delta,
      Lambda[1] + Lambda[3] - 2*delta,
      2*Lambda[3] - 3*delta,
      2*Lambda[1] - delta,
      2*Lambda[2] - 2*delta)

Is it a response to Travis or do you mean with this ticket ? Because the order of results you show are exactly what i get without this ticket.

Last edited 8 months ago by vklein (previous) (diff)

comment:8 in reply to: ↑ 5 Changed 8 months ago by vklein

Replying to tscrim:

I guess we do # py2 and # py3 versions? The only other decent option would be to always sort the output of dominant_maximal_weights().

Ok i will do that.

comment:9 Changed 8 months ago by git

  • Commit changed from 2a1ce980d4ac8d5b7db09e44887fdc08f1f74988 to ef1ae437986a835be8ba416c964fb403812751d0

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

ef1ae43Trac 27654: Fix integrable_representation.py ...

comment:10 Changed 8 months ago by git

  • Commit changed from ef1ae437986a835be8ba416c964fb403812751d0 to ef632a1bf976d2c717b7e1d49ddc9c2c2508d65f

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

ef632a1Trac 27654: Fix integrable_representation.py ...

comment:11 Changed 8 months ago by vklein

  • Description modified (diff)
  • Status changed from needs_info to needs_review

comment:12 Changed 8 months ago by vklein

  • Description modified (diff)

comment:13 Changed 7 months ago by jhpalmieri

This works for me. I'm not delighted with more # py2 and # py3 doctests, but maybe that's the best solution here. Anyone object to a positive review?

comment:14 Changed 7 months ago by vklein

Apparently not.

comment:15 Changed 7 months ago by jhpalmieri

  • Reviewers changed from Travis Scrimshaw to Travis Scrimshaw, John Palmieri
  • Status changed from needs_review to positive_review

comment:16 Changed 7 months ago by vbraun

  • Branch changed from u/vklein/27654 to ef632a1bf976d2c717b7e1d49ddc9c2c2508d65f
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.