Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit 42046d0

Browse files
committed
use tensor letter for unicode of tensor symbol
1 parent 9d686f2 commit 42046d0

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

src/sage/categories/signed_tensor.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
66
- Travis Scrimshaw (2019-07): initial version
77
"""
8-
#*****************************************************************************
8+
# ****************************************************************************
99
# Copyright (C) 2019 Travis Scrimshaw <tcscrims at gamil.com>
1010
#
1111
# Distributed under the terms of the GNU General Public License (GPL)
1212
# http://www.gnu.org/licenses/
13-
#*****************************************************************************
13+
# ****************************************************************************
1414

1515
from sage.categories.covariant_functorial_construction import CovariantFunctorialConstruction, CovariantConstructionCategory
1616

17+
1718
class SignedTensorProductFunctor(CovariantFunctorialConstruction):
1819
"""
1920
A singleton class for the signed tensor functor.
@@ -51,6 +52,7 @@ class SignedTensorProductFunctor(CovariantFunctorialConstruction):
5152
_functor_name = "tensor"
5253
_functor_category = "SignedTensorProducts"
5354
symbol = " # "
55+
unicode_symbol = " ⨂ "
5456

5557
def _repr_(self):
5658
"""
@@ -64,8 +66,10 @@ def _repr_(self):
6466
# default _repr_
6567
return "The signed tensor functorial construction"
6668

69+
6770
tensor_signed = SignedTensorProductFunctor()
6871

72+
6973
class SignedTensorProductsCategory(CovariantConstructionCategory):
7074
r"""
7175
An abstract base class for all SignedTensorProducts's categories.
@@ -110,4 +114,3 @@ def base(self):
110114
Integer Ring
111115
"""
112116
return self.base_category().base()
113-

src/sage/categories/tensor.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
66
- Nicolas M. Thiery (2008-2010): initial revision and refactorization
77
"""
8-
#*****************************************************************************
8+
# ****************************************************************************
99
# Copyright (C) 2008-2010 Nicolas M. Thiery <nthiery at users.sf.net>
1010
#
1111
# Distributed under the terms of the GNU General Public License (GPL)
12-
# http://www.gnu.org/licenses/
13-
#*****************************************************************************
12+
# https://www.gnu.org/licenses/
13+
# ****************************************************************************
1414

1515
from sage.categories.covariant_functorial_construction import CovariantFunctorialConstruction, CovariantConstructionCategory
1616

17+
1718
class TensorProductFunctor(CovariantFunctorialConstruction):
1819
"""
1920
A singleton class for the tensor functor.
@@ -46,8 +47,12 @@ class TensorProductFunctor(CovariantFunctorialConstruction):
4647
_functor_name = "tensor"
4748
_functor_category = "TensorProducts"
4849
symbol = " # "
50+
unicode_symbol = " ⨂ "
51+
4952

5053
tensor = TensorProductFunctor()
54+
55+
5156
"""
5257
The tensor product functorial construction
5358
@@ -59,6 +64,7 @@ class TensorProductFunctor(CovariantFunctorialConstruction):
5964
The tensor functorial construction
6065
"""
6166

67+
6268
class TensorProductsCategory(CovariantConstructionCategory):
6369
r"""
6470
An abstract base class for all TensorProducts's categories
@@ -100,4 +106,3 @@ def base(self):
100106
Integer Ring
101107
"""
102108
return self.base_category().base()
103-

src/sage/combinat/free_module.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,8 @@ def __init__(self, modules, **options):
13111311
for module in modules]).map(tuple)
13121312
CombinatorialFreeModule.__init__(self, modules[0].base_ring(), indices, **options)
13131313
# 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)
1314+
if 'tensor_symbol' in options:
1315+
self._print_options['tensor_symbol'] = options['tensor_symbol']
13151316

13161317
def _repr_(self):
13171318
r"""
@@ -1381,7 +1382,7 @@ def _unicode_art_(self, term):
13811382
sage: R = NonCommutativeSymmetricFunctions(QQ).R()
13821383
sage: Partitions.options(diagram_str="#", convention="french")
13831384
sage: s = unicode_art(tensor((R[1,2], R[3,1,2]))); s
1384-
R # R
1385+
R R
13851386
┌┐ ┌┬┬┐
13861387
├┼┐ └┴┼┤
13871388
└┴┘ ├┼┐
@@ -1395,9 +1396,9 @@ def _unicode_art_(self, term):
13951396
if hasattr(self, "_print_options"):
13961397
symb = self._print_options['tensor_symbol']
13971398
if symb is None:
1398-
symb = tensor.symbol
1399+
symb = tensor.unicode_symbol
13991400
else:
1400-
symb = tensor.symbol
1401+
symb = tensor.unicode_symbol
14011402
return unicode_art(*(module._unicode_art_term(t)
14021403
for module, t in zip(self._sets, term)),
14031404
sep=UnicodeArt([symb], breakpoints=[len(symb)]))

src/sage/structure/indexed_generators.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,13 @@ class IndexedGenerators(object):
7373
7474
- ``tensor_symbol`` -- string or ``None`` (default: ``None``),
7575
string to use for tensor product in the print representation. If
76-
``None``, use ``sage.categories.tensor.symbol``.
76+
``None``, use ``sage.categories.tensor.symbol`` and
77+
``sage.categories.tensor.unicode_symbol``.
7778
7879
- ``sorting_key`` -- a key function (default: ``lambda x: x``),
7980
to use for sorting elements in the output of elements
8081
81-
- ``sorting_reverse`` -- bool (default: ``False``), if ``True``
82+
- ``sorting_reverse`` -- bool (default: ``False``), if ``True``
8283
sort elements in reverse order in the output of elements
8384
8485
- ``string_quotes`` -- bool (default: ``True``), if ``True`` then

0 commit comments

Comments
 (0)