On Friday, February 14, 2014 9:06:35 PM UTC-8, John H Palmieri wrote:
>
>
>
> On Friday, February 14, 2014 6:18:42 PM UTC-8, Mark Shimozono wrote:
>>
>> Nicolas, 
>>
>> > In your case, to implement the smash product, you probably want to 
>> > implement a subclass of CombinatorialFreeModuleTensor, set its 
>> > category to the join of ModulesWithBasis(QQ).TensorProducts() and 
>> > AlgebrasWithBasis(QQ), and implement the product similarly to what's 
>> > done for tensor products of algebras with basis. 
>>
>> I would dearly love to be able to construct elements in my class in an 
>> automatically multilinear way, using the _tensor_of_elements method 
>> for tensor products of modules. However sage won't let me. 
>> Basically it has an overly restrictive type check which fails. 
>>
>> Here is a toy version of my class: 
>>
>> class MyTensorProductOfAlgebras(CombinatorialFreeModule_Tensor): 
>>     def __init__(self, A, B): 
>>         R = A.base_ring() 
>>         CombinatorialFreeModule_Tensor.__init__(self, [A,B], \ 
>> category=Category.join((AlgebrasWithBasis(R),ModulesWithBasis(R).TensorProducts())))
>>  
>>
>>
>> The code calling the _element_tensor method for the 
>> vanilla instance T: 
>>
>> sage: L = CartanType(['A',2]).root_system().weight_lattice() 
>> sage: A = L.algebra(ZZ) 
>> sage: a = A.an_element() 
>> sage: T = tensor([A,A]) 
>> sage: T._tensor_of_elements([a,a]) 
>> B[2*Lambda[1] + 2*Lambda[2]] # B[2*Lambda[1] + 2*Lambda[2]] 
>>
>> and the custom class TT: 
>>
>> sage: TT = MyTensorProductOfAlgebras(A,A) 
>> TT._tensor_of_elements([a,a]) 
>>
>> AssertionError 
>>
>> and the offending line is: 
>>
>> assert(sage.categories.tensor.tensor(modules) == self) 
>>
>> where "modules" is the list of modules to be tensored and "self" 
>> is the instance that is invoking _tensor_of_elements. 
>>
>> Note that 
>>
>> sage: T 
>>
>> and 
>>
>> sage: TT 
>>
>> give the same exact description string. 
>>
>> Any solutions/workarounds? Surely there is no need to reimplement the 
>> multilinearity! 
>>
>> --Mark 
>>
>
> You could reimplement the 'tensor_constructor' method for your class: just 
> copy over the one from CombinatorialFreeModule_Tensor in 
> combinat/free_module.py, but delete the line
>
>             assert(sage.categories.tensor.tensor(modules) == self)
>
> Or you could patch free_module.py, adding an optional argument, say 
> "type_check=True", to both tensor_constructor and _tensor_of_elements, and 
> only do this assertion if type_check is True.
>

Oh, heh, if you go this route, then you actually have to use the optional 
argument somehow. Maybe instead you should define an attribute 
self._type_check and set it when you initialize an instance of the class. 
The default value would be True, but when you initialize your version, you 
would set it to False.

-- 
John

>

-- 
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 http://groups.google.com/group/sage-combinat-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to