Opened 8 years ago

Last modified 5 weeks ago

#17010 new defect

Random failure in diagram algebras

Reported by: vbraun Owned by:
Priority: major Milestone:
Component: combinatorics Keywords: random_fail
Cc: SimonKing Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


I've seen this more than once on the buildbot...

sage -t --long src/sage/combinat/
File "src/sage/combinat/", line 696, in sage.combinat.diagram_algebras.SubPartitionAlgebra.__init__
Failed example:

Change History (7)

comment:1 Changed 8 years ago by vbraun

Cc: SimonKing added

Something related to the coercion is getting garbage collected during the execution of the command. On my desktop (a fast computer with gobs of RAM) I always get the right answer. But if I use the trace hook to force run a garbage collection between each Python command:

def trace_gc(frame, event, arg):
    import gc

then a) everything gets dog slow, about 5 mins for the lines below, and b) I get the wrong answer:

sage: sys.settrace(trace_gc)
sage: R.<x> = QQ[]
sage: BA = BrauerAlgebra(2, x, R)
sage: BA.ambient().has_coerce_map_from(BA)

comment:2 Changed 8 years ago by SimonKing

I suppose the problem comes from __init_extra__, which for algebras is supposed to register the coercion from the base ring.

comment:3 Changed 8 years ago by SimonKing

I found that we are in a rare case. This

                has_custom_conversion = self.category().parent_class.from_base_ring.__func__ is not self.from_base_ring.__func__
            except AttributeError:
                # Sometimes from_base_ring is a lazy attribute
                has_custom_conversion = True

ends up in "except AttributeError". So, the question is if it is really the case here that from_base_ring exists as lazy attribute, or the attribute error came from a different reason.

comment:4 Changed 8 years ago by SimonKing

Yes, it is a lazy attribute of the parent class.

comment:5 Changed 8 years ago by tscrim

I'm thinking the problem is coming from line 700-1:

self.module_morphism(self.lift, codomain=amb,

and is similar to what I posted on #16532, as a reference to the ambient partition algebra is not held by the subpartition algebra.

I'm thinking the easiest fix would be to actually just store a reference to the ambient algebra in the subpartition algebra. The best fix would probably be to add a _coerce_map_from_ in PartitionAlgebra which checks if the parent is an instance of SubPartitionAlgebra and returns the lift module morphism. Both fixes are easy, which do you think we should do?

comment:6 Changed 8 years ago by vbraun

I don't see how storing a reference to ambient is going to help, the call to has_coerce_map_from in the ticket description already holds a reference to ambient (== self)

comment:7 Changed 5 weeks ago by mkoeppe

Milestone: sage-6.4
Note: See TracTickets for help on using tickets.