Thanks Travis! Obviously I didn't read the documentation well enough as I 
thought `Facade` was `False` by default -- so I'd tried setting 
`Facade=True` with no joy.

Cheers,
Andrew

pd. I will have a look at your ticket.

On Thursday, 16 February 2017 13:52:22 UTC+11, Travis Scrimshaw wrote:
>
> Hey Andrew,
>    Well, I've recently been looking at DisjointUnionEnumeratedSets (see 
> https://trac.sagemath.org/ticket/22382) and came across this problem. The 
> first issue is that DisjointUnionEnumeratedSets does not behave like an 
> actual facade parent like it claims to be (at least with default values). 
> The second is that __call__ calls a morphism, which in turn calls 
> _element_constructor_ and expects a subclass of element to be returned. 
> Thus for facade parents that want to return a tuple, this causes a problem 
> (see the ticket).
>
>    Actually, looking at what you want more closely now, you want this to 
> be a proper parent, so just pass the facade=False. This works with the 
> current Sage:
>
> sage: tabs = DisjointUnionEnumeratedSets(Family(Partitions(3), lambda mu: 
> cartesian_product([mu.standard_tableaux(),mu.standard_tableaux()])), 
> facade=False)
> sage: s = StandardTableau([[1,2],[3]])
> sage: (s,s) in tabs
> True
> sage: tabs((s,s))
> ([[1, 2], [3]], [[1, 2], [3]])
>
> Best,
> Travis
>
> On Wednesday, February 15, 2017 at 6:01:17 PM UTC-6, Andrew wrote:
>>
>> I am working with disjoint enumerated sets like the following
>>
>> sage: tabs = DisjointUnionEnumeratedSets(Family(Partitions(3), lambda mu: 
>> cartesian_product([mu.standard_tableaux(),mu.standard_tableaux()])))
>> sage: tabs[:]
>> [([[1, 2, 3]], [[1, 2, 3]]),
>>  ([[1, 3], [2]], [[1, 3], [2]]),
>>  ([[1, 3], [2]], [[1, 2], [3]]),
>>  ([[1, 2], [3]], [[1, 3], [2]]),
>>  ([[1, 2], [3]], [[1, 2], [3]]),
>>  ([[1], [2], [3]], [[1], [2], [3]])]
>>
>> I need to be able to construct elements of this set from a tuple of 
>> elements in the underlying sets but I can't work out a nice way to do this. 
>> I thought that the following would work but it doesn't:
>>
>> sage: s = StandardTableau([[1,2],[3]])
>> sage: (s, s) in tabs
>> True
>> sage: tabs( (s,s) )
>>
>> ---------------------------------------------------------------------------
>> NotImplementedError                       Traceback (most recent call 
>> last)
>> <ipython-input-67-3fe9605dd49e> in <module>()
>> ----> 1 tabs( (s,s) )
>>
>> /usr/local/src/sage/src/sage/structure/parent.pyx in sage.structure.
>> parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:9584)()
>>     934                 self._element_init_pass_parent = 
>> guess_pass_parent(self, self._element_constructor)
>>     935             except (AttributeError, AssertionError):
>> --> 936                 raise NotImplementedError
>>     937         cdef Py_ssize_t i
>>     938         cdef R = parent_c(x)
>>
>> NotImplementedError:
>>
>> One way around this is the following, but I would guess that this is far 
>> too inefficient to use inside an element_constructor method:
>>
>> sage: ss = tabs.unrank( tabs.rank( (s,s) ) )
>> sage: type(ss)
>> <class 
>> 'sage.sets.cartesian_product.CartesianProduct_with_category.element_class'
>> >
>>
>> Is there a better way to do his?
>>
>> Andrew
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-combinat-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to