Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#15279 closed defect (fixed)

RootSystem __init__ builds the dual twice, breaking initialization of non-crystallographic root systems

Reported by: darij Owned by:
Priority: major Milestone: sage-5.13
Component: combinatorics Keywords: root-system, sage-combinat
Cc: aschilling, tscrim, sage-combinat, nthiery, mhansen, bump Merged in: sage-5.13.beta1
Authors: Darij Grinberg Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Relevant piece of the code:

        if as_dual_of is None:
            self.dual_side = False
            self.dual = RootSystem(self._cartan_type.dual(), as_dual_of=self);
            # still fails for CartanType G2xA1
            try:
                self.dual = RootSystem(self._cartan_type.dual(), as_dual_of=self);
            except StandardError:
                pass

The definition of self.dual is done twice, one time in a try clause, one time outside. I don't know if the breaking of non-crystallographic root systems is intentional or not (might be it is because there doesn't seem to be much functionality implemented for that), but it certainly slows down things.

Attachments (1)

trac_15279-init_RootSystem-dg.patch (832 bytes) - added by darij 8 years ago.

Download all attachments as: .zip

Change History (16)

Changed 8 years ago by darij

comment:1 Changed 8 years ago by darij

  • Status changed from new to needs_review

comment:2 Changed 8 years ago by darij

  • Component changed from PLEASE CHANGE to combinatorics

comment:3 Changed 8 years ago by tscrim

  • Cc nthiery added
  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

Looks good to me.

comment:4 follow-up: Changed 8 years ago by nthiery

This sounds like a merge that went wrong, so +1 on the change. You might want to add a test if this impacts non crystalographic root systems (yes we want to progressively support them!!!).

In the long run, we would want something better than just trying and hoping for the best. We should be able to tell exactly when the dual should be defined or not.

comment:5 Changed 8 years ago by darij

I don't know what to test for the non-crystallographic ones, since nothing nontrivial seems to work for them so far... Once they are actually implemented, they will have their own doctests, which of course will implicitly test init as well, so I'm not worried about init. As for now, this is more about speed and just getting rid of a line that doesn't make sense.

Travis: thanks for looking at it!

Last edited 8 years ago by darij (previous) (diff)

comment:6 in reply to: ↑ 4 ; follow-up: Changed 8 years ago by jdemeyer

Replying to nthiery:

This sounds like a merge that went wrong

It would be interesting to know why/how it went wrong. The patch is from #5794, 4 years ago.

Interestingly, the patch trac_5794-exceptional.patch:ticket:5794 on Trac is correct, it does remove the duplicate line. However, the patch which is merged (revision -r13366 in Mercurial) has a different commit message (trac_5794-exceptional.patch modified for combinat server) and does not remove that line. I can only hope that the "combinat server" doesn't make these mistakes any more.

comment:7 Changed 8 years ago by jdemeyer

  • Cc mhansen added

There is also this suspicious commit, which was never actually reverted.

changeset:   13363:359efb582d39
user:        Mike Hansen <mhansen@gmail.com>
date:        Thu Nov 19 08:25:56 2009 -0800
summary:     this temporary patch to be taken down when root system and 5794 patches stabilize.

comment:8 Changed 8 years ago by jdemeyer

More generally, the patches on Trac from #5794 are not the ones which were merged. I don't plan to further investigate this, but perhaps somebody should.

comment:9 follow-up: Changed 8 years ago by darij

Is there a way to see the patches which were merged? This is spooky. Thanks for getting to the roots (oops) of this, Jeroen!

Last edited 8 years ago by darij (previous) (diff)

comment:10 in reply to: ↑ 9 Changed 8 years ago by jdemeyer

Replying to darij:

Is there a way to see the patches which were merged?

Use hg log and hg export -r13366 to see a particular commit.

comment:11 in reply to: ↑ 6 ; follow-up: Changed 8 years ago by nthiery

Replying to jdemeyer:

Replying to nthiery:

This sounds like a merge that went wrong

It would be interesting to know why/how it went wrong. The patch is from #5794, 4 years ago.

Interestingly, the patch trac_5794-exceptional.patch:ticket:5794 on Trac is correct, it does remove the duplicate line. However, the patch which is merged (revision -r13366 in Mercurial) has a different commit message (trac_5794-exceptional.patch modified for combinat server) and does not remove that line. I can only hope that the "combinat server" doesn't make these mistakes any more.

Not having duplication between patches on the combinat server and on trac and not having to rebase constantly, like we will have with the new workflow, will certainly help ...

Thanks for tracking this down!

comment:12 in reply to: ↑ 11 ; follow-up: Changed 8 years ago by jdemeyer

Replying to nthiery:

not having to rebase constantly, like we will have with the new workflow

Why would one need to rebase less with the new workflow? A merge conflict is a merge conflict, and the new workflow is not going to change that.

comment:13 in reply to: ↑ 12 Changed 8 years ago by nthiery

Replying to jdemeyer:

Replying to nthiery:

not having to rebase constantly, like we will have with the new workflow

Why would one need to rebase less with the new workflow? A merge conflict is a merge conflict, and the new workflow is not going to change that.

Granted, there will be as many merges as before; but unlike what we had with our patch queues those will be 3-way merges, so there will be better support from the revision control system, with less error-prone manual operations.

Cheers,

comment:14 Changed 8 years ago by jdemeyer

  • Merged in set to sage-5.13.beta1
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:15 Changed 8 years ago by darij

  • Cc bump added

I am CCing Daniel Bump and Mike Hansen; maybe they can shed more light on the question what exactly ended up merged from #5794.

So these seem to be the #5794-related commits in the log:

changeset:   13469:7d776d3652ea
user:        Nicolas M. Thiery <nthiery@users.sf.net>
date:        Thu Nov 19 12:23:11 2009 +0100
summary:     [mq]: trac_5794-long-time-nt.patch

[...]

changeset:   13368:2fcea95a7e9c
user:        Mike Hansen <mhansen@gmail.com>
date:        Thu Nov 19 08:26:08 2009 -0800
summary:     ReST fixes and improvements

changeset:   13367:4a11faf380b3
user:        Daniel Bump <bump@match.stanford.edu>
date:        Wed May 20 13:55:19 2009 -0700
summary:     Further exceptional branching rules

changeset:   13366:ffe6380fbc20
user:        Daniel Bump <bump@match.stanford.edu>
date:        Tue May 12 21:56:35 2009 -0700
summary:     trac_5794-exceptional.patch modified for combinat server

changeset:   13365:a28740f742ec
user:        Mike Hansen <mhansen@gmail.com>
date:        Thu Nov 19 08:26:00 2009 -0800
summary:     imported patch trac_5794-continued-combinat

changeset:   13364:e75cad2172eb
user:        Mike Hansen <mhansen@gmail.com>
date:        Thu Nov 19 08:25:57 2009 -0800
summary:     imported patch cartan_type_temporary-1.patch

changeset:   13363:359efb582d39
user:        Mike Hansen <mhansen@gmail.com>
date:        Thu Nov 19 08:25:56 2009 -0800
summary:     this temporary patch to be taken down when root system and 5794 patches stabilize.

changeset:   13362:3fef40a05bb4
user:        Daniel Bump <bump@match.stanford.edu>
date:        Wed May 06 13:17:39 2009 -0700
summary:     trac_5794-revised.patch modified for combinat server

I can tell that

changeset 13469 == trac_5794-long-time-nt.patch (modulo fuzz)

and

changeset 13368 == trac_5794-reviewer-nt.patch.

Furthermore,

changeset 13367 differs from trac_5794-more-exceptional.patch only in having is_irreducible and is_reducible in lieu of is_atomic and is_compound.

The difference between changeset 13366 and trac_5794-exceptional.patch is more substantial, and is what caused the bug in the present ticket. Someone else should look into the diff to check if this is the only issue caused!

The difference between changeset 13365 and trac_5794-continued.patch is again only in irreducible-vs-atomic and reducible-vs-compound.

Changeset 13364 is not an attachment on #5794 and all it does is replacing some "reducible" by "compound" resp. "irreducible" by "atomic".

Changeset 13363 ("this temporary patch to be taken down when root system and 5794 patches stabilize.") seems not to be from the #5794 attachments either, and I don't really understand what it does. I don't know if anyone has ever "taken it down" or reverted its edits.

Changeset 13362 has noticeable differences from trac_5794-revised.patch and maybe someone should look into that.

Version 0, edited 8 years ago by darij (next)
Note: See TracTickets for help on using tickets.