@@ -351,7 +351,7 @@ def element_class(self):
351351 'sage.combinat.free_module'
352352 """
353353 return self .__make_element_class__ (self .Element ,
354- name = "%s.element_class" % self .__class__ .__name__ ,
354+ name = "%s.element_class" % self .__class__ .__name__ ,
355355 module = self .__class__ .__module__ ,
356356 inherit = True )
357357
@@ -669,7 +669,7 @@ def _element_constructor_(self, x):
669669 if x == 0 :
670670 return self .zero ()
671671 else :
672- raise TypeError ("do not know how to make x (= %s) an element of %s" % (x , self ))
672+ raise TypeError ("do not know how to make x (= %s) an element of %s" % (x , self ))
673673 #x is an element of the basis enumerated set;
674674 # This is a very ugly way of testing this
675675 elif ((hasattr (self ._indices , 'element_class' ) and
@@ -685,7 +685,7 @@ def _element_constructor_(self, x):
685685 return self ._coerce_end (x )
686686 except TypeError :
687687 pass
688- raise TypeError ("do not know how to make x (= %s) an element of self (=%s)" % (x ,self ))
688+ raise TypeError ("do not know how to make x (= %s) an element of self (=%s)" % (x , self ))
689689
690690 def _convert_map_from_ (self , S ):
691691 """
@@ -1297,21 +1297,20 @@ def __classcall_private__(cls, modules, **options):
12971297 options ['category' ] = options ['category' ].FiniteDimensional ()
12981298 return super (CombinatorialFreeModule .Tensor , cls ).__classcall__ (cls , modules , ** options )
12991299
1300-
13011300 def __init__ (self , modules , ** options ):
13021301 """
13031302 TESTS::
13041303
13051304 sage: F = CombinatorialFreeModule(ZZ, [1,2]); F
13061305 F
13071306 """
1308- from sage .categories .tensor import tensor
13091307 self ._sets = modules
13101308 indices = CartesianProduct_iters (* [module .basis ().keys ()
13111309 for module in modules ]).map (tuple )
13121310 CombinatorialFreeModule .__init__ (self , modules [0 ].base_ring (), indices , ** options )
13131311 # the following is not the best option, but it's better than nothing.
1314- self ._print_options ['tensor_symbol' ] = options .get ('tensor_symbol' , tensor .symbol )
1312+ if 'tensor_symbol' in options :
1313+ self ._print_options ['tensor_symbol' ] = options ['tensor_symbol' ]
13151314
13161315 def _repr_ (self ):
13171316 r"""
@@ -1381,7 +1380,7 @@ def _unicode_art_(self, term):
13811380 sage: R = NonCommutativeSymmetricFunctions(QQ).R()
13821381 sage: Partitions.options(diagram_str="#", convention="french")
13831382 sage: s = unicode_art(tensor((R[1,2], R[3,1,2]))); s
1384- R # R
1383+ R ⨂ R
13851384 ┌┐ ┌┬┬┐
13861385 ├┼┐ └┴┼┤
13871386 └┴┘ ├┼┐
@@ -1395,9 +1394,9 @@ def _unicode_art_(self, term):
13951394 if hasattr (self , "_print_options" ):
13961395 symb = self ._print_options ['tensor_symbol' ]
13971396 if symb is None :
1398- symb = tensor .symbol
1397+ symb = tensor .unicode_symbol
13991398 else :
1400- symb = tensor .symbol
1399+ symb = tensor .unicode_symbol
14011400 return unicode_art (* (module ._unicode_art_term (t )
14021401 for module , t in zip (self ._sets , term )),
14031402 sep = UnicodeArt ([symb ], breakpoints = [len (symb )]))
@@ -1495,10 +1494,11 @@ def tensor_constructor(self, modules):
14951494 # a list l such that l[i] is True if modules[i] is readily a tensor product
14961495 is_tensor = [isinstance (module , CombinatorialFreeModule_Tensor ) for module in modules ]
14971496 # the tensor_constructor, on basis elements
1498- result = self .monomial * CartesianProductWithFlattening (is_tensor ) #.
1497+ result = self .monomial * CartesianProductWithFlattening (is_tensor )
14991498 # TODO: make this into an element of Hom( A x B, C ) when those will exist
1500- for i in range (0 , len (modules )):
1501- result = modules [i ]._module_morphism (result , position = i , codomain = self )
1499+ for i in range (len (modules )):
1500+ result = modules [i ]._module_morphism (result , position = i ,
1501+ codomain = self )
15021502 return result
15031503
15041504 def _tensor_of_elements (self , elements ):
@@ -1593,6 +1593,7 @@ def _coerce_map_from_(self, R):
15931593
15941594 return super (CombinatorialFreeModule_Tensor , self )._coerce_map_from_ (R )
15951595
1596+
15961597class CartesianProductWithFlattening (object ):
15971598 """
15981599 A class for Cartesian product constructor, with partial flattening
@@ -1754,7 +1755,7 @@ def cartesian_embedding(self, i):
17541755 """
17551756 assert i in self ._sets_keys ()
17561757 return self ._sets [i ]._module_morphism (lambda t : self .monomial ((i , t )),
1757- codomain = self )
1758+ codomain = self )
17581759
17591760 summand_embedding = cartesian_embedding
17601761
@@ -1785,7 +1786,7 @@ def cartesian_projection(self, i):
17851786 """
17861787 assert i in self ._sets_keys ()
17871788 module = self ._sets [i ]
1788- return self ._module_morphism (lambda j_t : module .monomial (j_t [1 ]) if i == j_t [0 ] else module .zero (), codomain = module )
1789+ return self ._module_morphism (lambda j_t : module .monomial (j_t [1 ]) if i == j_t [0 ] else module .zero (), codomain = module )
17891790
17901791 summand_projection = cartesian_projection
17911792
@@ -1831,4 +1832,5 @@ def cartesian_factors(self):
18311832 class Element (CombinatorialFreeModule .Element ): # TODO: get rid of this inheritance
18321833 pass
18331834
1835+
18341836CombinatorialFreeModule .CartesianProduct = CombinatorialFreeModule_CartesianProduct
0 commit comments