passagemath-standard-no-symbolics 10.6.45__cp313-cp313-macosx_13_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- passagemath_standard_no_symbolics/__init__.py +1 -0
- passagemath_standard_no_symbolics-10.6.45.data/scripts/sage-grep +5 -0
- passagemath_standard_no_symbolics-10.6.45.data/scripts/sage-grepdoc +5 -0
- passagemath_standard_no_symbolics-10.6.45.data/scripts/sage-list-packages +103 -0
- passagemath_standard_no_symbolics-10.6.45.dist-info/METADATA +150 -0
- passagemath_standard_no_symbolics-10.6.45.dist-info/RECORD +83 -0
- passagemath_standard_no_symbolics-10.6.45.dist-info/WHEEL +6 -0
- passagemath_standard_no_symbolics-10.6.45.dist-info/top_level.txt +2 -0
- sage/all.py +207 -0
- sage/all_cmdline.py +36 -0
- sage/cli/__init__.py +61 -0
- sage/cli/__main__.py +5 -0
- sage/cli/eval_cmd.py +45 -0
- sage/cli/eval_cmd_test.py +25 -0
- sage/cli/interactive_shell_cmd.py +28 -0
- sage/cli/notebook_cmd.py +51 -0
- sage/cli/notebook_cmd_test.py +39 -0
- sage/cli/options.py +26 -0
- sage/cli/run_file_cmd.py +50 -0
- sage/cli/version_cmd.py +26 -0
- sage/databases/all.py +83 -0
- sage/databases/cubic_hecke_db.py +1527 -0
- sage/dynamics/all.py +31 -0
- sage/dynamics/surface_dynamics_deprecation.py +32 -0
- sage/ext_data/kenzo/CP2.txt +45 -0
- sage/ext_data/kenzo/CP3.txt +349 -0
- sage/ext_data/kenzo/CP4.txt +4774 -0
- sage/ext_data/kenzo/README.txt +49 -0
- sage/ext_data/kenzo/S4.txt +20 -0
- sage/ext_data/mwrank/PRIMES +1 -0
- sage/ext_data/nbconvert/postprocess.py +48 -0
- sage/ext_data/nbconvert/rst_sage.tpl +99 -0
- sage/ext_data/nodoctest +0 -0
- sage/ext_data/notebook-ipython/kernel.json.in +11 -0
- sage/ext_data/notebook-ipython/logo-64x64.png +0 -0
- sage/ext_data/notebook-ipython/logo.svg +352 -0
- sage/ext_data/valgrind/pyalloc.supp +58 -0
- sage/ext_data/valgrind/sage-additional.supp +417 -0
- sage/ext_data/valgrind/sage.supp +43 -0
- sage/ext_data/valgrind/valgrind-python.supp +480 -0
- sage/geometry/all.py +12 -0
- sage/groups/matrix_gps/pickling_overrides.py +110 -0
- sage/homology/tests.py +66 -0
- sage/interacts/algebra.py +20 -0
- sage/interacts/all.py +25 -0
- sage/interacts/calculus.py +24 -0
- sage/interacts/fractals.py +18 -0
- sage/interacts/geometry.py +19 -0
- sage/interacts/library.py +1950 -0
- sage/interacts/library_cython.cpython-313-darwin.so +0 -0
- sage/interacts/statistics.py +19 -0
- sage/interfaces/axiom.py +1002 -0
- sage/interfaces/kash.py +834 -0
- sage/interfaces/lie.py +950 -0
- sage/interfaces/matlab.py +413 -0
- sage/interfaces/mupad.py +686 -0
- sage/interfaces/octave.py +858 -0
- sage/interfaces/phc.py +943 -0
- sage/interfaces/psage.py +189 -0
- sage/interfaces/qsieve.py +4 -0
- sage/interfaces/r.py +2096 -0
- sage/interfaces/read_data.py +46 -0
- sage/interfaces/scilab.py +576 -0
- sage/interfaces/tests.py +81 -0
- sage/libs/all.py +11 -0
- sage/libs/cremona/__init__.py +0 -0
- sage/libs/mwrank/__init__.py +0 -0
- sage/logic/all.py +3 -0
- sage/logic/booleval.py +160 -0
- sage/logic/boolformula.py +1490 -0
- sage/logic/logic.py +856 -0
- sage/logic/logicparser.py +696 -0
- sage/logic/logictable.py +272 -0
- sage/logic/propcalc.py +311 -0
- sage/misc/all.py +28 -0
- sage/misc/lazy_attribute.pyi +11 -0
- sage/rings/all.py +48 -0
- sage/rings/commutative_algebra.py +38 -0
- sage/rings/finite_rings/all.py +21 -0
- sage/rings/numbers_abc.py +58 -0
- sage/rings/polynomial/all.py +22 -0
- sage/rings/polynomial/convolution.py +421 -0
- sage/symbolic/all__sagemath_standard_no_symbolics.py +0 -0
|
@@ -0,0 +1,1527 @@
|
|
|
1
|
+
r"""
|
|
2
|
+
Cubic Hecke database
|
|
3
|
+
|
|
4
|
+
This module contains the class :class:`CubicHeckeDataBase` which serves as an
|
|
5
|
+
interface to `Ivan Marin's data files
|
|
6
|
+
<http://www.lamfa.u-picardie.fr/marin/representationH4-en.html>`__
|
|
7
|
+
with respect to the cubic Hecke algebras. The data is available via a Python
|
|
8
|
+
wrapper as a pip installable package `database_cubic_hecke
|
|
9
|
+
<https://pypi.org/project/database-cubic-hecke/>`__.
|
|
10
|
+
For installation hints please see the documentation there.
|
|
11
|
+
All data needed for the cubic Hecke algebras on less than four strands is
|
|
12
|
+
included in this module for demonstration purpose (see for example
|
|
13
|
+
:func:`read_basis`, :func:`read_irr` , ... generated with the help of
|
|
14
|
+
:func:`create_demo_data`).
|
|
15
|
+
|
|
16
|
+
In addition to Ivan Marin's data the package contains a function
|
|
17
|
+
:func:`read_markov` to obtain the coefficients of Markov traces on the
|
|
18
|
+
cubic Hecke algebras. This data has been precomputed with the help of
|
|
19
|
+
``create_markov_trace_data.py`` in the `database_cubic_hecke repository
|
|
20
|
+
<https://github.com/soehms/database_cubic_hecke>`__.
|
|
21
|
+
Again, for less than four strands, this data is includes here for
|
|
22
|
+
demonstration purposes.
|
|
23
|
+
|
|
24
|
+
Furthermore, this module contains the class :class:`CubicHeckeFileCache`
|
|
25
|
+
that enables
|
|
26
|
+
:class:`~sage.algebras.hecke_algebras.cubic_hecke_algebras.CubicHeckeAlgebra`
|
|
27
|
+
to keep intermediate results of calculations in the file system.
|
|
28
|
+
|
|
29
|
+
The enum :class:`MarkovTraceModuleBasis` serves as basis for the submodule
|
|
30
|
+
of linear forms on the cubic Hecke algebra on at most four strands
|
|
31
|
+
satisfying the Markov trace condition for its cubic Hecke subalgebras.
|
|
32
|
+
|
|
33
|
+
To use the database, you need to install the optional
|
|
34
|
+
:ref:`database_cubic_hecke <spkg_database_cubic_hecke>` package by the Sage
|
|
35
|
+
command ::
|
|
36
|
+
|
|
37
|
+
sage -i database_cubic_hecke
|
|
38
|
+
|
|
39
|
+
EXAMPLES::
|
|
40
|
+
|
|
41
|
+
sage: # optional - database_cubic_hecke
|
|
42
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeDataBase
|
|
43
|
+
sage: cha_db = CubicHeckeDataBase()
|
|
44
|
+
sage: cha_db
|
|
45
|
+
<sage.databases.cubic_hecke_db.CubicHeckeDataBase object at ...>
|
|
46
|
+
|
|
47
|
+
AUTHORS:
|
|
48
|
+
|
|
49
|
+
- Sebastian Oehms (2020-05): initial version
|
|
50
|
+
- Sebastian Oehms (2022-03): PyPi version and Markov trace functionality
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
# ############################################################################
|
|
54
|
+
# Copyright (C) 2020 Sebastian Oehms <seb.oehms@gmail.com>
|
|
55
|
+
#
|
|
56
|
+
# This program is free software: you can redistribute it and/or modify
|
|
57
|
+
# it under the terms of the GNU General Public License as published by
|
|
58
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
59
|
+
# (at your option) any later version.
|
|
60
|
+
# https://www.gnu.org/licenses/
|
|
61
|
+
# ############################################################################
|
|
62
|
+
|
|
63
|
+
import os
|
|
64
|
+
from enum import Enum
|
|
65
|
+
|
|
66
|
+
from sage.structure.sage_object import SageObject
|
|
67
|
+
from sage.misc.persist import _base_dumps, load
|
|
68
|
+
from sage.misc.temporary_file import atomic_write
|
|
69
|
+
from sage.misc.verbose import verbose
|
|
70
|
+
from sage.matrix.constructor import matrix
|
|
71
|
+
from sage.rings.integer_ring import ZZ
|
|
72
|
+
from sage.algebras.hecke_algebras.cubic_hecke_base_ring import CubicHeckeExtensionRing
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# ------------------------------------------------------------------------------
|
|
76
|
+
# functions to convert matrices and ring elements to and from flat python
|
|
77
|
+
# dictionaries in order to save matrices avoiding compatibility problems with
|
|
78
|
+
# older or newer sage versions and to save disc space
|
|
79
|
+
# ------------------------------------------------------------------------------
|
|
80
|
+
def simplify(mat):
|
|
81
|
+
r"""
|
|
82
|
+
Convert a matrix to a dictionary consisting of flat Python objects.
|
|
83
|
+
|
|
84
|
+
INPUT:
|
|
85
|
+
|
|
86
|
+
- ``mat`` -- matrix to be converted into a ``dict``
|
|
87
|
+
|
|
88
|
+
OUTPUT:
|
|
89
|
+
|
|
90
|
+
A ``dict`` from which ``mat`` can be reconstructed via
|
|
91
|
+
element construction. The values of the dictionary may be
|
|
92
|
+
dictionaries of tuples of integers or strings.
|
|
93
|
+
|
|
94
|
+
EXAMPLES::
|
|
95
|
+
|
|
96
|
+
sage: from sage.databases.cubic_hecke_db import simplify
|
|
97
|
+
sage: import sage.algebras.hecke_algebras.cubic_hecke_base_ring as chbr
|
|
98
|
+
sage: ER.<a, b, c> = chbr.CubicHeckeExtensionRing()
|
|
99
|
+
sage: mat = matrix(ER, [[2*a, -3], [c, 4*b*~c]]); mat
|
|
100
|
+
[ 2*a -3]
|
|
101
|
+
[ c 4*b*c^-1]
|
|
102
|
+
sage: simplify(mat)
|
|
103
|
+
{(0, 0): {(1, 0, 0): {0: 2}},
|
|
104
|
+
(0, 1): {(0, 0, 0): {0: -3}},
|
|
105
|
+
(1, 0): {(0, 0, 1): {0: 1}},
|
|
106
|
+
(1, 1): {(0, 1, -1): {0: 4}}}
|
|
107
|
+
sage: mat == matrix(ER, _)
|
|
108
|
+
True
|
|
109
|
+
sage: F = ER.fraction_field()
|
|
110
|
+
sage: matf = mat.change_ring(F)
|
|
111
|
+
sage: simplify(matf)
|
|
112
|
+
{(0, 0): '2*a', (0, 1): '-3', (1, 0): 'c', (1, 1): '4*b/c'}
|
|
113
|
+
sage: matf == matrix(F, _)
|
|
114
|
+
True
|
|
115
|
+
"""
|
|
116
|
+
B = mat.base_ring()
|
|
117
|
+
d = mat.dict()
|
|
118
|
+
if isinstance(B, CubicHeckeExtensionRing):
|
|
119
|
+
# Laurent polynomial cannot be reconstructed from string
|
|
120
|
+
res = {k: {tuple(j): u.monomial_coefficients()
|
|
121
|
+
for j, u in v.monomial_coefficients().items()}
|
|
122
|
+
for k, v in d.items()}
|
|
123
|
+
else:
|
|
124
|
+
res = {k: str(v) for k, v in d.items()}
|
|
125
|
+
return res
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class CubicHeckeDataSection(Enum):
|
|
129
|
+
r"""
|
|
130
|
+
Enum for the different sections of the database.
|
|
131
|
+
|
|
132
|
+
The following choices are possible:
|
|
133
|
+
|
|
134
|
+
- ``basis`` -- list of basis elements
|
|
135
|
+
- ``reg_left_reprs`` -- data for the left regular representation
|
|
136
|
+
- ``reg_right_reprs`` -- data for the right regular representation
|
|
137
|
+
- ``irr_reprs`` -- data for the split irreducible representations
|
|
138
|
+
- ``markov_tr_cfs`` -- data for the coefficients of the formal Markov traces
|
|
139
|
+
|
|
140
|
+
EXAMPLES::
|
|
141
|
+
|
|
142
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeDataBase
|
|
143
|
+
sage: cha_db = CubicHeckeDataBase()
|
|
144
|
+
sage: cha_db.section
|
|
145
|
+
<enum 'CubicHeckeDataSection'>
|
|
146
|
+
"""
|
|
147
|
+
basis = 'basis'
|
|
148
|
+
regular_left = 'regular_left'
|
|
149
|
+
regular_right = 'regular_right'
|
|
150
|
+
split_irred = 'split_irred'
|
|
151
|
+
markov_tr_cfs = 'markov_tr_cfs'
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
# -------------------------------------------------------------------------------
|
|
155
|
+
# Class to supply data for the basis and matrix representation for the cubic
|
|
156
|
+
# Hecke algebra
|
|
157
|
+
# -------------------------------------------------------------------------------
|
|
158
|
+
class CubicHeckeDataBase(SageObject):
|
|
159
|
+
r"""
|
|
160
|
+
Database interface for
|
|
161
|
+
:class:`~sage.algebras.hecke_algebras.cubic_hecke_algebras.CubicHeckeAlgebra`
|
|
162
|
+
|
|
163
|
+
The original data are obtained from `Ivan Marin's web page
|
|
164
|
+
<http://www.lamfa.u-picardie.fr/marin/representationH4-en.html>`__
|
|
165
|
+
|
|
166
|
+
The data needed to work with the cubic Hecke algebras on less than 4 strands
|
|
167
|
+
is completely contained in this module. Data needed for the larger algebras
|
|
168
|
+
can be installed as an optional Sage package which comes as a ``pip`` installable
|
|
169
|
+
`Python wrapper <https://pypi.org/project/database-cubic-hecke/>`__ of
|
|
170
|
+
Ivan Marin's data. For more information see the `corresponding repository
|
|
171
|
+
<https://github.com/soehms/database_cubic_hecke>`__.
|
|
172
|
+
|
|
173
|
+
EXAMPLES::
|
|
174
|
+
|
|
175
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeDataBase
|
|
176
|
+
sage: cha_db = CubicHeckeDataBase()
|
|
177
|
+
sage: cha_db._feature
|
|
178
|
+
Feature('database_cubic_hecke')
|
|
179
|
+
"""
|
|
180
|
+
section = CubicHeckeDataSection
|
|
181
|
+
|
|
182
|
+
def __init__(self):
|
|
183
|
+
r"""
|
|
184
|
+
Initialize ``self``.
|
|
185
|
+
|
|
186
|
+
EXAMPLES::
|
|
187
|
+
|
|
188
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeDataBase
|
|
189
|
+
sage: cha_db = CubicHeckeDataBase()
|
|
190
|
+
sage: cha_db._data_library
|
|
191
|
+
{}
|
|
192
|
+
"""
|
|
193
|
+
from sage.features.databases import DatabaseCubicHecke
|
|
194
|
+
self._feature = DatabaseCubicHecke()
|
|
195
|
+
self._data_library = {}
|
|
196
|
+
self._demo = None
|
|
197
|
+
|
|
198
|
+
def version(self):
|
|
199
|
+
r"""
|
|
200
|
+
Return the current version of the database.
|
|
201
|
+
|
|
202
|
+
EXAMPLES::
|
|
203
|
+
|
|
204
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeDataBase
|
|
205
|
+
sage: cha_db = CubicHeckeDataBase()
|
|
206
|
+
sage: cha_db.version() > '2022.1.1' # optional - database_cubic_hecke
|
|
207
|
+
True
|
|
208
|
+
"""
|
|
209
|
+
self._feature.require()
|
|
210
|
+
from database_cubic_hecke import version
|
|
211
|
+
return version()
|
|
212
|
+
|
|
213
|
+
def demo_version(self):
|
|
214
|
+
r"""
|
|
215
|
+
Return whether the cubic Hecke database is installed completely or
|
|
216
|
+
just the demo version is used.
|
|
217
|
+
|
|
218
|
+
EXAMPLES::
|
|
219
|
+
|
|
220
|
+
sage: from sage.databases.knotinfo_db import KnotInfoDataBase
|
|
221
|
+
sage: ki_db = KnotInfoDataBase()
|
|
222
|
+
sage: ki_db.demo_version() # optional - database_knotinfo
|
|
223
|
+
False
|
|
224
|
+
"""
|
|
225
|
+
if self._demo is None:
|
|
226
|
+
if self._feature.is_present():
|
|
227
|
+
self._demo = False
|
|
228
|
+
else:
|
|
229
|
+
self._demo = True
|
|
230
|
+
return self._demo
|
|
231
|
+
|
|
232
|
+
# --------------------------------------------------------------------------
|
|
233
|
+
# read from an sobj-file obtained from Ivan Marin's database
|
|
234
|
+
# --------------------------------------------------------------------------
|
|
235
|
+
def read(self, section, variables=None, nstrands=4):
|
|
236
|
+
r"""
|
|
237
|
+
Access various static data libraries.
|
|
238
|
+
|
|
239
|
+
INPUT:
|
|
240
|
+
|
|
241
|
+
- ``section`` -- instance of enum :class:`CubicHeckeDataSection`
|
|
242
|
+
to select the data to be read in
|
|
243
|
+
|
|
244
|
+
OUTPUT: a dictionary containing the data corresponding to the section
|
|
245
|
+
|
|
246
|
+
EXAMPLES::
|
|
247
|
+
|
|
248
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeDataBase
|
|
249
|
+
sage: cha_db = CubicHeckeDataBase()
|
|
250
|
+
sage: basis = cha_db.read(cha_db.section.basis, nstrands=3)
|
|
251
|
+
sage: len(basis)
|
|
252
|
+
24
|
|
253
|
+
"""
|
|
254
|
+
if not isinstance(section, CubicHeckeDataSection):
|
|
255
|
+
raise TypeError('section must be an instance of enum %s' % CubicHeckeDataBase.section)
|
|
256
|
+
|
|
257
|
+
data_lib = self._data_library
|
|
258
|
+
|
|
259
|
+
nstrands = int(nstrands)
|
|
260
|
+
if (section, nstrands) in data_lib.keys():
|
|
261
|
+
return data_lib[(section, nstrands)]
|
|
262
|
+
|
|
263
|
+
verbose('loading data library %s for %s strands ...' % (section.value, nstrands))
|
|
264
|
+
|
|
265
|
+
from sage.algebras.hecke_algebras.cubic_hecke_matrix_rep import GenSign
|
|
266
|
+
|
|
267
|
+
if self.demo_version():
|
|
268
|
+
if nstrands >= 4:
|
|
269
|
+
self._feature.require()
|
|
270
|
+
from .cubic_hecke_db import read_basis, read_irr, read_regl, read_regr, read_markov
|
|
271
|
+
else:
|
|
272
|
+
from database_cubic_hecke import read_basis, read_irr, read_reg
|
|
273
|
+
from database_cubic_hecke.markov_trace_coeffs import read_markov
|
|
274
|
+
|
|
275
|
+
def read_regl(variables, num_strands):
|
|
276
|
+
return read_reg(variables, num_strands=num_strands)
|
|
277
|
+
|
|
278
|
+
def read_regr(variables, num_strands):
|
|
279
|
+
return read_reg(variables, right=True, num_strands=num_strands)
|
|
280
|
+
|
|
281
|
+
if section == CubicHeckeDataSection.basis:
|
|
282
|
+
data_lib[(section, nstrands)] = read_basis(nstrands)
|
|
283
|
+
elif section == CubicHeckeDataSection.markov_tr_cfs:
|
|
284
|
+
keys = [k for k in MarkovTraceModuleBasis if k.strands() <= nstrands]
|
|
285
|
+
res = {k: read_markov(k.name, variables, num_strands=nstrands) for k in keys}
|
|
286
|
+
data_lib[(section, nstrands)] = res
|
|
287
|
+
elif section == CubicHeckeDataSection.split_irred:
|
|
288
|
+
dim_list, repr_list, repr_list_inv = read_irr(variables, nstrands)
|
|
289
|
+
data_lib[(section, nstrands)] = {GenSign.pos: repr_list, GenSign.neg: repr_list_inv}
|
|
290
|
+
else:
|
|
291
|
+
if section == CubicHeckeDataSection.regular_right:
|
|
292
|
+
dim_list, repr_list, repr_list_inv = read_regr(variables, nstrands)
|
|
293
|
+
else:
|
|
294
|
+
dim_list, repr_list, repr_list_inv = read_regl(variables, nstrands)
|
|
295
|
+
data_lib[(section, nstrands)] = {GenSign.pos: repr_list, GenSign.neg: repr_list_inv}
|
|
296
|
+
|
|
297
|
+
verbose('... finished!')
|
|
298
|
+
return data_lib[(section, nstrands)]
|
|
299
|
+
|
|
300
|
+
# --------------------------------------------------------------------------
|
|
301
|
+
# matrix_reprs_from_file_cache_
|
|
302
|
+
# --------------------------------------------------------------------------
|
|
303
|
+
def read_matrix_representation(self, representation_type, gen_ind, nstrands, ring_of_definition):
|
|
304
|
+
r"""
|
|
305
|
+
Return the matrix representations from the database.
|
|
306
|
+
|
|
307
|
+
INPUT:
|
|
308
|
+
|
|
309
|
+
- ``representation_type`` -- an element of
|
|
310
|
+
:class:`~sage.algebras.hecke_algebras.cubic_hecke_matrix_rep.RepresentationType`
|
|
311
|
+
specifying the type of the representation
|
|
312
|
+
|
|
313
|
+
EXAMPLES::
|
|
314
|
+
|
|
315
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeDataBase
|
|
316
|
+
sage: CHA3 = algebras.CubicHecke(2)
|
|
317
|
+
sage: GER = CHA3.extension_ring(generic=True)
|
|
318
|
+
sage: cha_db = CHA3._database
|
|
319
|
+
sage: rt = CHA3.repr_type
|
|
320
|
+
sage: m1 =cha_db.read_matrix_representation(rt.SplitIrredMarin, 1, 3, GER)
|
|
321
|
+
sage: len(m1)
|
|
322
|
+
7
|
|
323
|
+
sage: GBR = CHA3.base_ring(generic=True)
|
|
324
|
+
sage: m1rl = cha_db.read_matrix_representation(rt.RegularLeft, 1, 3, GBR)
|
|
325
|
+
sage: m1rl[0].dimensions()
|
|
326
|
+
(24, 24)
|
|
327
|
+
"""
|
|
328
|
+
from sage.algebras.hecke_algebras.cubic_hecke_matrix_rep import RepresentationType, GenSign
|
|
329
|
+
if not isinstance(representation_type, RepresentationType):
|
|
330
|
+
raise TypeError('representation_type must be an instance of enum %s' % RepresentationType)
|
|
331
|
+
|
|
332
|
+
td = ring_of_definition.gens_dict_recursive()
|
|
333
|
+
if 'e3' in td.keys():
|
|
334
|
+
td['j'] = td['e3']
|
|
335
|
+
td.pop('e3')
|
|
336
|
+
v = tuple(td.values())
|
|
337
|
+
|
|
338
|
+
num_rep = representation_type.number_of_representations(nstrands)
|
|
339
|
+
rep_list = self.read(representation_type.data_section(), variables=v, nstrands=nstrands)
|
|
340
|
+
if gen_ind > 0:
|
|
341
|
+
rep_list = [rep_list[GenSign.pos][i] for i in range(num_rep)]
|
|
342
|
+
matrix_list = [matrix(ring_of_definition, rep[gen_ind-1], sparse=True) for rep in rep_list]
|
|
343
|
+
else:
|
|
344
|
+
# data of inverse of generators is stored under negative strand-index
|
|
345
|
+
rep_list = [rep_list[GenSign.neg][i] for i in range(num_rep)]
|
|
346
|
+
matrix_list = [matrix(ring_of_definition, rep[-gen_ind-1], sparse=True) for rep in rep_list]
|
|
347
|
+
for m in matrix_list:
|
|
348
|
+
m.set_immutable()
|
|
349
|
+
return matrix_list
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
class MarkovTraceModuleBasis(Enum):
|
|
353
|
+
r"""
|
|
354
|
+
Enum for the basis elements for the Markov trace module.
|
|
355
|
+
|
|
356
|
+
The choice of the basis elements doesn't have a systematically background
|
|
357
|
+
apart from generating the submodule of maximal rank in the module of linear
|
|
358
|
+
forms on the cubic Hecke algebra for which the Markov trace condition with
|
|
359
|
+
respect to its cubic Hecke subalgebras hold. The number of crossings in
|
|
360
|
+
the corresponding links is chosen as minimal as possible.
|
|
361
|
+
|
|
362
|
+
EXAMPLES::
|
|
363
|
+
|
|
364
|
+
sage: from sage.databases.cubic_hecke_db import MarkovTraceModuleBasis
|
|
365
|
+
sage: MarkovTraceModuleBasis.K92.description()
|
|
366
|
+
'knot 9_34'
|
|
367
|
+
"""
|
|
368
|
+
def __repr__(self):
|
|
369
|
+
r"""
|
|
370
|
+
Return a string representation of ``self``.
|
|
371
|
+
|
|
372
|
+
EXAMPLES::
|
|
373
|
+
|
|
374
|
+
sage: from sage.databases.cubic_hecke_db import MarkovTraceModuleBasis
|
|
375
|
+
sage: MarkovTraceModuleBasis.U2 # indirect doctest
|
|
376
|
+
U2
|
|
377
|
+
"""
|
|
378
|
+
return self.name
|
|
379
|
+
|
|
380
|
+
def __gt__(self, other):
|
|
381
|
+
r"""
|
|
382
|
+
Implement comparison of different items in order to have ``sorted`` work.
|
|
383
|
+
|
|
384
|
+
EXAMPLES::
|
|
385
|
+
|
|
386
|
+
sage: from sage.databases.cubic_hecke_db import MarkovTraceModuleBasis
|
|
387
|
+
sage: sorted(MarkovTraceModuleBasis)
|
|
388
|
+
[U1, U2, U3, K4, U4, K4U, K6, K7, K91, K92]
|
|
389
|
+
"""
|
|
390
|
+
if self.__class__ is other.__class__:
|
|
391
|
+
tups = (self.strands(), len(self.braid_tietze()), self.name)
|
|
392
|
+
tupo = (other.strands(), len(other.braid_tietze()), other.name)
|
|
393
|
+
return tups > tupo
|
|
394
|
+
return NotImplemented
|
|
395
|
+
|
|
396
|
+
def strands(self):
|
|
397
|
+
r"""
|
|
398
|
+
Return the number of strands of the minimal braid representative
|
|
399
|
+
of the link corresponding to ``self``.
|
|
400
|
+
|
|
401
|
+
EXAMPLES::
|
|
402
|
+
|
|
403
|
+
sage: from sage.databases.cubic_hecke_db import MarkovTraceModuleBasis
|
|
404
|
+
sage: MarkovTraceModuleBasis.K7.strands()
|
|
405
|
+
4
|
|
406
|
+
"""
|
|
407
|
+
return self.value[1]
|
|
408
|
+
|
|
409
|
+
def braid_tietze(self, strands_embed=None):
|
|
410
|
+
r"""
|
|
411
|
+
Return the Tietze representation of the braid corresponding to this basis
|
|
412
|
+
element.
|
|
413
|
+
|
|
414
|
+
INPUT:
|
|
415
|
+
|
|
416
|
+
- ``strands_embed`` -- (optional) the number of strands of the braid
|
|
417
|
+
if strands should be added
|
|
418
|
+
|
|
419
|
+
OUTPUT: a tuple representing the braid in Tietze form
|
|
420
|
+
|
|
421
|
+
EXAMPLES::
|
|
422
|
+
|
|
423
|
+
sage: from sage.databases.cubic_hecke_db import MarkovTraceModuleBasis
|
|
424
|
+
sage: MarkovTraceModuleBasis.U2.braid_tietze()
|
|
425
|
+
()
|
|
426
|
+
sage: MarkovTraceModuleBasis.U2.braid_tietze(strands_embed=4)
|
|
427
|
+
(2, 3)
|
|
428
|
+
"""
|
|
429
|
+
if not strands_embed:
|
|
430
|
+
strands_embed = self.strands()
|
|
431
|
+
|
|
432
|
+
if strands_embed > self.strands():
|
|
433
|
+
last_gen = strands_embed-1
|
|
434
|
+
return self.braid_tietze(strands_embed=last_gen) + (last_gen,)
|
|
435
|
+
|
|
436
|
+
return self.value[2]
|
|
437
|
+
|
|
438
|
+
def writhe(self):
|
|
439
|
+
r"""
|
|
440
|
+
Return the writhe of the link corresponding to this basis element.
|
|
441
|
+
|
|
442
|
+
EXAMPLES::
|
|
443
|
+
|
|
444
|
+
sage: from sage.databases.cubic_hecke_db import MarkovTraceModuleBasis
|
|
445
|
+
sage: MarkovTraceModuleBasis.K4.writhe()
|
|
446
|
+
0
|
|
447
|
+
sage: MarkovTraceModuleBasis.K6.writhe()
|
|
448
|
+
1
|
|
449
|
+
"""
|
|
450
|
+
from sage.functions.generalized import sign
|
|
451
|
+
return sum(sign(t) for t in self.braid_tietze())
|
|
452
|
+
|
|
453
|
+
def description(self):
|
|
454
|
+
r"""
|
|
455
|
+
Return a description of the link corresponding to this basis element.
|
|
456
|
+
|
|
457
|
+
In the case of knots it refers to the naming according to
|
|
458
|
+
`KnotInfo <https://knotinfo.math.indiana.edu/>`__.
|
|
459
|
+
|
|
460
|
+
EXAMPLES::
|
|
461
|
+
|
|
462
|
+
sage: from sage.databases.cubic_hecke_db import MarkovTraceModuleBasis
|
|
463
|
+
sage: MarkovTraceModuleBasis.U3.description()
|
|
464
|
+
'three unlinks'
|
|
465
|
+
"""
|
|
466
|
+
return self.value[0]
|
|
467
|
+
|
|
468
|
+
def link(self):
|
|
469
|
+
r"""
|
|
470
|
+
Return the :class:`Link` that represents this basis element.
|
|
471
|
+
|
|
472
|
+
EXAMPLES::
|
|
473
|
+
|
|
474
|
+
sage: from sage.databases.cubic_hecke_db import MarkovTraceModuleBasis
|
|
475
|
+
sage: MarkovTraceModuleBasis.U1.link()
|
|
476
|
+
Link with 1 component represented by 0 crossings
|
|
477
|
+
sage: MarkovTraceModuleBasis.K4.link()
|
|
478
|
+
Link with 1 component represented by 4 crossings
|
|
479
|
+
"""
|
|
480
|
+
from sage.knots.link import Link
|
|
481
|
+
pd_code = self.value[3]
|
|
482
|
+
if pd_code is not None:
|
|
483
|
+
# since :class:`Link` does not construct disjoint union of unlinks
|
|
484
|
+
# from the braid representation, we need a pd_code here
|
|
485
|
+
return Link(pd_code)
|
|
486
|
+
else:
|
|
487
|
+
from sage.groups.braid import BraidGroup
|
|
488
|
+
B = BraidGroup(self.strands())
|
|
489
|
+
return Link(B(self.braid_tietze()))
|
|
490
|
+
|
|
491
|
+
def regular_homfly_polynomial(self):
|
|
492
|
+
r"""
|
|
493
|
+
Return the regular variant of the HOMFLY-PT polynomial of the link that
|
|
494
|
+
represents this basis element.
|
|
495
|
+
|
|
496
|
+
This is the HOMFLY-PT polynomial renormalized by the writhe factor
|
|
497
|
+
such that it is an invariant of regular isotopy.
|
|
498
|
+
|
|
499
|
+
EXAMPLES::
|
|
500
|
+
|
|
501
|
+
sage: from sage.databases.cubic_hecke_db import MarkovTraceModuleBasis
|
|
502
|
+
sage: MarkovTraceModuleBasis.U1.regular_homfly_polynomial()
|
|
503
|
+
1
|
|
504
|
+
sage: u2 = MarkovTraceModuleBasis.U2.regular_homfly_polynomial(); u2
|
|
505
|
+
-L*M^-1 - L^-1*M^-1
|
|
506
|
+
sage: u2**2 == MarkovTraceModuleBasis.U3.regular_homfly_polynomial()
|
|
507
|
+
True
|
|
508
|
+
sage: u2**3 == MarkovTraceModuleBasis.U4.regular_homfly_polynomial()
|
|
509
|
+
True
|
|
510
|
+
"""
|
|
511
|
+
H = self.link().homfly_polynomial()
|
|
512
|
+
L, M = H.parent().gens()
|
|
513
|
+
return H * L**self.writhe()
|
|
514
|
+
|
|
515
|
+
def regular_kauffman_polynomial(self):
|
|
516
|
+
r"""
|
|
517
|
+
Return the regular variant of the Kauffman polynomial of the link that
|
|
518
|
+
represents this basis element.
|
|
519
|
+
|
|
520
|
+
This is the Kauffman polynomial renormalized by the writhe factor
|
|
521
|
+
such that it is an invariant of regular isotopy.
|
|
522
|
+
|
|
523
|
+
EXAMPLES::
|
|
524
|
+
|
|
525
|
+
sage: from sage.databases.cubic_hecke_db import MarkovTraceModuleBasis
|
|
526
|
+
sage: MarkovTraceModuleBasis.U1.regular_homfly_polynomial()
|
|
527
|
+
1
|
|
528
|
+
sage: u2 = MarkovTraceModuleBasis.U2.regular_kauffman_polynomial(); u2
|
|
529
|
+
a*z^-1 - 1 + a^-1*z^-1
|
|
530
|
+
sage: u2**2 == MarkovTraceModuleBasis.U3.regular_kauffman_polynomial()
|
|
531
|
+
True
|
|
532
|
+
sage: u2**3 == MarkovTraceModuleBasis.U4.regular_kauffman_polynomial()
|
|
533
|
+
True
|
|
534
|
+
"""
|
|
535
|
+
from sage.knots.knotinfo import KnotInfo
|
|
536
|
+
K = KnotInfo.L2a1_1.kauffman_polynomial().parent()
|
|
537
|
+
a, z = K.gens()
|
|
538
|
+
d = kauffman[self.name]
|
|
539
|
+
if d:
|
|
540
|
+
return K(d)*a**self.writhe()
|
|
541
|
+
U2rkp = MarkovTraceModuleBasis.U2.regular_kauffman_polynomial()
|
|
542
|
+
if self.name == 'K4U':
|
|
543
|
+
K4rkp = MarkovTraceModuleBasis.K4.regular_kauffman_polynomial()
|
|
544
|
+
return K4rkp * U2rkp
|
|
545
|
+
exp = self.strands() - 1
|
|
546
|
+
return U2rkp**exp
|
|
547
|
+
|
|
548
|
+
def links_gould_polynomial(self):
|
|
549
|
+
r"""
|
|
550
|
+
Return the Links-Gould polynomial of the link that represents this
|
|
551
|
+
basis element.
|
|
552
|
+
|
|
553
|
+
EXAMPLES::
|
|
554
|
+
|
|
555
|
+
sage: from sage.databases.cubic_hecke_db import MarkovTraceModuleBasis
|
|
556
|
+
sage: MarkovTraceModuleBasis.U1.links_gould_polynomial()
|
|
557
|
+
1
|
|
558
|
+
sage: MarkovTraceModuleBasis.U2.links_gould_polynomial()
|
|
559
|
+
0
|
|
560
|
+
sage: MarkovTraceModuleBasis.K4.links_gould_polynomial()
|
|
561
|
+
2*t0*t1 - 3*t0 - 3*t1 + t0*t1^-1 + 7 + t0^-1*t1
|
|
562
|
+
- 3*t1^-1 - 3*t0^-1 + 2*t0^-1*t1^-1
|
|
563
|
+
"""
|
|
564
|
+
from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing
|
|
565
|
+
R = LaurentPolynomialRing(ZZ, 't0, t1')
|
|
566
|
+
return R(links_gould[self.name])
|
|
567
|
+
|
|
568
|
+
U1 = ['one unlink', 1, (), []]
|
|
569
|
+
U2 = ['two unlinks', 2, (), [[3, 1, 4, 2], [4, 1, 3, 2]]]
|
|
570
|
+
U3 = ['three unlinks', 3, (), [[3, 7, 4, 8], [4, 7, 5, 8],
|
|
571
|
+
[5, 1, 6, 2], [6, 1, 3, 2]]]
|
|
572
|
+
U4 = ['four unlinks', 4, (), [[3, 9, 4, 10], [4, 9, 5, 10], [5, 11, 6, 12],
|
|
573
|
+
[6, 11, 7, 12], [7, 1, 8, 2], [8, 1, 3, 2]]]
|
|
574
|
+
K4U = ['knot 4_1 plus one unlink', 4, (1, -2, 1, -2),
|
|
575
|
+
[[3, 8, 4, 9], [9, 7, 10, 6], [7, 4, 8, 5], [5, 11, 6, 10],
|
|
576
|
+
[11, 1, 12, 2], [12, 1, 3, 2]]]
|
|
577
|
+
K4 = ['knot 4_1', 3, (1, -2, 1, -2), None]
|
|
578
|
+
K6 = ['knot 6_1', 4, (1, 1, 2, -1, -3, 2, -3), None]
|
|
579
|
+
K7 = ['knot 7_4', 4, (1, 1, 2, -1, 2, 2, 3, -2, 3), None]
|
|
580
|
+
K91 = ['knot 9_29', 4, (1, -2, -2, 3, -2, 1, -2, 3, -2), None]
|
|
581
|
+
K92 = ['knot 9_34', 4, (-1, 2, -1, 2, -3, 2, -1, 2, -3), None]
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
kauffman = {
|
|
585
|
+
'U1': 1,
|
|
586
|
+
'U2': {(1, -1): 1, (0, 0): -1, (-1, -1): 1},
|
|
587
|
+
'U3': None,
|
|
588
|
+
'U4': None,
|
|
589
|
+
'K4U': None,
|
|
590
|
+
'K4': {(2, 2): 1, (1, 3): 1, (2, 0): -1, (1, 1): -1, (0, 2): 2, (-1, 3): 1,
|
|
591
|
+
(0, 0): -1, (-1, 1): -1, (-2, 2): 1, (-2, 0): -1},
|
|
592
|
+
'K6': {(2, 2): 1, (1, 3): 1, (0, 4): 1, (-1, 5): 1, (2, 0): -1, (-1, 3): -2,
|
|
593
|
+
(-2, 4): 2, (-3, 5): 1, (-1, 1): 2, (-2, 2): -4, (-3, 3): -3, (-4, 4): 1,
|
|
594
|
+
(-2, 0): 1, (-3, 1): 2, (-4, 2): -3, (-4, 0): 1},
|
|
595
|
+
'K7': {(-2, 2): 1, (-3, 3): 2, (-4, 4): 3, (-5, 5): 2, (-6, 6): 1, (-4, 2): -4,
|
|
596
|
+
(-5, 3): -2, (-7, 5): 3, (-8, 6): 1, (-4, 0): 2, (-6, 2): -3, (-7, 3): -8,
|
|
597
|
+
(-8, 4): -3, (-9, 5): 1, (-7, 1): 4, (-8, 2): 2, (-9, 3): -4, (-8, 0): -1,
|
|
598
|
+
(-9, 1): 4},
|
|
599
|
+
'K91': {(7, 3): 1, (6, 4): 3, (5, 5): 6, (4, 6): 8, (3, 7): 6, (2, 8): 2,
|
|
600
|
+
(5, 3): -5, (4, 4): -13, (3, 5): -8, (2, 6): 6, (1, 7): 9, (0, 8): 2,
|
|
601
|
+
(5, 1): 2, (4, 2): 8, (3, 3): -1, (2, 4): -24, (1, 5): -24, (0, 6): -1,
|
|
602
|
+
(-1, 7): 3, (4, 0): -2, (3, 1): 2, (2, 2): 17, (1, 3): 14, (0, 4): -11,
|
|
603
|
+
(-1, 5): -10, (-2, 6): 1, (2, 0): -5, (1, 1): -1, (0, 2): 12, (-1, 3): 9,
|
|
604
|
+
(-2, 4): -3, (0, 0): -3, (-1, 1): -1, (-2, 2): 3, (-2, 0): -1},
|
|
605
|
+
'K92': {(5, 5): 1, (4, 6): 4, (3, 7): 6, (2, 8): 3, (5, 3): -1, (4, 4): -7,
|
|
606
|
+
(3, 5): -11, (2, 6): 5, (1, 7): 14, (0, 8): 3, (4, 2): 3, (3, 3): 5,
|
|
607
|
+
(2, 4): -19, (1, 5): -26, (0, 6): 9, (-1, 7): 8, (2, 2): 10, (1, 3): 12,
|
|
608
|
+
(0, 4): -23, (-1, 5): -10, (-2, 6): 8, (2, 0): -1, (1, 1): -1,
|
|
609
|
+
(0, 2): 11, (-1, 3): 4, (-2, 4): -10, (-3, 5): 4, (0, 0): -1,
|
|
610
|
+
(-1, 1): -1, (-2, 2): 4, (-3, 3): -2, (-4, 4): 1, (-2, 0): -1}}
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
links_gould = {
|
|
614
|
+
'U1': 1,
|
|
615
|
+
'U2': 0,
|
|
616
|
+
'U3': 0,
|
|
617
|
+
'U4': 0,
|
|
618
|
+
'K4U': 0,
|
|
619
|
+
'K4': {(1, 1): 2, (1, 0): -3, (0, 1): -3, (1, -1): 1, (0, 0): 7, (-1, 1): 1,
|
|
620
|
+
(0, -1): -3, (-1, 0): -3, (-1, -1): 2},
|
|
621
|
+
'K6': {(2, 2): 2, (2, 1): -3, (1, 2): -3, (2, 0): 1, (1, 1): 10, (0, 2): 1,
|
|
622
|
+
(1, 0): -10, (0, 1): -10, (1, -1): 3, (0, 0): 17, (-1, 1): 3, (0, -1): -7,
|
|
623
|
+
(-1, 0): -7, (-1, -1): 4},
|
|
624
|
+
'K7': {(4, 3): -1, (3, 4): -1, (4, 2): 1, (3, 3): 6, (2, 4): 1, (3, 2): -11,
|
|
625
|
+
(2, 3): -11, (3, 1): 6, (2, 2): 28, (1, 3): 6, (2, 1): -27, (1, 2): -27,
|
|
626
|
+
(2, 0): 9, (1, 1): 38, (0, 2): 9, (1, 0): -17, (0, 1): -17, (0, 0): 9},
|
|
627
|
+
'K91': {(2, 2): 6, (2, 1): -20, (1, 2): -20, (2, 0): 29, (1, 1): 76, (0, 2): 29,
|
|
628
|
+
(2, -1): -25, (1, 0): -123, (0, 1): -123, (-1, 2): -25, (2, -2): 14,
|
|
629
|
+
(1, -1): 116, (0, 0): 217, (-1, 1): 116, (-2, 2): 14, (2, -3): -5,
|
|
630
|
+
(1, -2): -71, (0, -1): -216, (-1, 0): -216, (-2, 1): -71, (-3, 2): -5,
|
|
631
|
+
(2, -4): 1, (1, -3): 27, (0, -2): 136, (-1, -1): 214, (-2, 0): 136,
|
|
632
|
+
(-3, 1): 27, (-4, 2): 1, (1, -4): -5, (0, -3): -50, (-1, -2): -122,
|
|
633
|
+
(-2, -1): -122, (-3, 0): -50, (-4, 1): -5, (0, -4): 8, (-1, -3): 37,
|
|
634
|
+
(-2, -2): 52, (-3, -1): 37, (-4, 0): 8, (-1, -4): -4, (-2, -3): -9,
|
|
635
|
+
(-3, -2): -9, (-4, -1): -4},
|
|
636
|
+
'K92': {(3, 1): 6, (2, 2): 12, (1, 3): 6, (3, 0): -15, (2, 1): -63, (1, 2): -63,
|
|
637
|
+
(0, 3): -15, (3, -1): 14, (2, 0): 112, (1, 1): 216, (0, 2): 112,
|
|
638
|
+
(-1, 3): 14, (3, -2): -6, (2, -1): -92, (1, 0): -334, (0, 1): -334,
|
|
639
|
+
(-1, 2): -92, (-2, 3): -6, (3, -3): 1, (2, -2): 37, (1, -1): 262,
|
|
640
|
+
(0, 0): 503, (-1, 1): 262, (-2, 2): 37, (-3, 3): 1, (2, -3): -6,
|
|
641
|
+
(1, -2): -104, (0, -1): -400, (-1, 0): -400, (-2, 1): -104, (-3, 2): -6,
|
|
642
|
+
(1, -3): 17, (0, -2): 162, (-1, -1): 330, (-2, 0): 162, (-3, 1): 17,
|
|
643
|
+
(0, -3): -27, (-1, -2): -136, (-2, -1): -136, (-3, 0): -27, (-1, -3): 22,
|
|
644
|
+
(-2, -2): 54, (-3, -1): 22, (-2, -3): -7, (-3, -2): -7}}
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
class CubicHeckeFileCache(SageObject):
|
|
648
|
+
"""
|
|
649
|
+
A class to cache calculations of
|
|
650
|
+
:class:`~sage.algebras.hecke_algebras.cubic_hecke_algebras.CubicHeckeAlgebra`
|
|
651
|
+
in the local file system.
|
|
652
|
+
"""
|
|
653
|
+
|
|
654
|
+
class section(Enum):
|
|
655
|
+
r"""
|
|
656
|
+
Enum for the different sections of file cache.
|
|
657
|
+
|
|
658
|
+
The following choices are possible:
|
|
659
|
+
|
|
660
|
+
- ``matrix_representations`` -- file cache for representation matrices
|
|
661
|
+
of basis elements
|
|
662
|
+
- ``braid_images`` -- file cache for images of braids
|
|
663
|
+
- ``basis_extensions`` -- file cache for a dynamical growing basis used
|
|
664
|
+
in the case of cubic Hecke algebras on more than 4 strands
|
|
665
|
+
- ``markov_trace`` -- file cache for intermediate results of long
|
|
666
|
+
calculations in order to recover the results already obtained by
|
|
667
|
+
previous attempts of calculation until the corresponding intermediate
|
|
668
|
+
step
|
|
669
|
+
|
|
670
|
+
EXAMPLES::
|
|
671
|
+
|
|
672
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeFileCache
|
|
673
|
+
sage: CHA2 = algebras.CubicHecke(2)
|
|
674
|
+
sage: cha_fc = CubicHeckeFileCache(CHA2)
|
|
675
|
+
sage: cha_fc.section
|
|
676
|
+
<enum 'section'>
|
|
677
|
+
"""
|
|
678
|
+
def filename(self, nstrands=None):
|
|
679
|
+
r"""
|
|
680
|
+
Return the file name under which the data of this file cache section
|
|
681
|
+
is stored as an sobj-file.
|
|
682
|
+
|
|
683
|
+
INPUT:
|
|
684
|
+
|
|
685
|
+
- ``nstrands`` -- (optional) :class:`Integer`; number of strands of
|
|
686
|
+
the underlying braid group if the data file depends on it
|
|
687
|
+
|
|
688
|
+
EXAMPLES::
|
|
689
|
+
|
|
690
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeFileCache
|
|
691
|
+
sage: CHA2 = algebras.CubicHecke(2)
|
|
692
|
+
sage: cha_fc = CubicHeckeFileCache(CHA2)
|
|
693
|
+
sage: cha_fc.section.matrix_representations.filename(2)
|
|
694
|
+
'matrix_representations_2.sobj'
|
|
695
|
+
sage: cha_fc.section.braid_images.filename(2)
|
|
696
|
+
'braid_images_2.sobj'
|
|
697
|
+
"""
|
|
698
|
+
if nstrands is None:
|
|
699
|
+
return '%s.sobj' % self.value
|
|
700
|
+
else:
|
|
701
|
+
return '%s_%s.sobj' % (self.value, nstrands)
|
|
702
|
+
|
|
703
|
+
matrix_representations = 'matrix_representations'
|
|
704
|
+
braid_images = 'braid_images'
|
|
705
|
+
basis_extensions = 'basis_extensions'
|
|
706
|
+
markov_trace = 'markov_trace'
|
|
707
|
+
|
|
708
|
+
def __init__(self, num_strands):
|
|
709
|
+
r"""
|
|
710
|
+
Initialize ``self``.
|
|
711
|
+
|
|
712
|
+
INPUT:
|
|
713
|
+
|
|
714
|
+
- ``num_strands`` -- integer giving the number of strands of the
|
|
715
|
+
corresponding cubic Hecke algebra
|
|
716
|
+
|
|
717
|
+
EXAMPLES::
|
|
718
|
+
|
|
719
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeFileCache
|
|
720
|
+
sage: cha_fc = CubicHeckeFileCache(2)
|
|
721
|
+
sage: cha_fc._file_cache_path.endswith('cubic_hecke')
|
|
722
|
+
True
|
|
723
|
+
"""
|
|
724
|
+
self._nstrands = num_strands
|
|
725
|
+
|
|
726
|
+
from sage.env import DOT_SAGE
|
|
727
|
+
self._file_cache_path = os.path.join(DOT_SAGE, 'cubic_hecke')
|
|
728
|
+
self._data_library = {}
|
|
729
|
+
os.makedirs(self._file_cache_path, exist_ok=True)
|
|
730
|
+
|
|
731
|
+
def _warn_incompatibility(self, fname):
|
|
732
|
+
"""
|
|
733
|
+
Warn the user that he has an incompatible file cache under ``Sage_DOT``
|
|
734
|
+
and move it away to another file (marked with timestamp).
|
|
735
|
+
|
|
736
|
+
EXAMPLES::
|
|
737
|
+
|
|
738
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeFileCache
|
|
739
|
+
sage: cha2_fc = CubicHeckeFileCache(2)
|
|
740
|
+
sage: path = cha2_fc._file_cache_path
|
|
741
|
+
sage: fname = os.path.join(path, 'test')
|
|
742
|
+
sage: os.system('touch %s' % fname)
|
|
743
|
+
0
|
|
744
|
+
sage: new_fname = cha2_fc._warn_incompatibility(fname)
|
|
745
|
+
doctest:...: UserWarning: incompatible file cache ...test has been saved to ...test_...
|
|
746
|
+
sage: os.remove(new_fname)
|
|
747
|
+
"""
|
|
748
|
+
from warnings import warn
|
|
749
|
+
from datetime import date
|
|
750
|
+
today = date.today()
|
|
751
|
+
new_fname = '%s_%s' % (fname, today)
|
|
752
|
+
os.rename(fname, new_fname)
|
|
753
|
+
warn('incompatible file cache %s has been saved to %s' % (fname, new_fname))
|
|
754
|
+
return new_fname
|
|
755
|
+
|
|
756
|
+
def reset_library(self, section=None):
|
|
757
|
+
r"""
|
|
758
|
+
Reset the file cache corresponding to the specified ``section``.
|
|
759
|
+
|
|
760
|
+
INPUT:
|
|
761
|
+
|
|
762
|
+
- ``section`` -- an element of :class:`CubicHeckeFileCache.section`
|
|
763
|
+
to select the section of the file cache or ``None`` (default)
|
|
764
|
+
meaning all sections
|
|
765
|
+
|
|
766
|
+
EXAMPLES::
|
|
767
|
+
|
|
768
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeFileCache
|
|
769
|
+
sage: cha2_fc = CubicHeckeFileCache(2)
|
|
770
|
+
sage: cha2_fc.reset_library(cha2_fc.section.braid_images)
|
|
771
|
+
sage: cha2_fc.read(cha2_fc.section.braid_images)
|
|
772
|
+
{}
|
|
773
|
+
sage: cha2_fc.reset_library(cha2_fc.section.matrix_representations)
|
|
774
|
+
sage: data_mat = cha2_fc.read(cha2_fc.section.matrix_representations)
|
|
775
|
+
sage: len(data_mat.keys())
|
|
776
|
+
4
|
|
777
|
+
"""
|
|
778
|
+
if section is None:
|
|
779
|
+
for sec in self.section:
|
|
780
|
+
self.reset_library(section=sec)
|
|
781
|
+
return
|
|
782
|
+
|
|
783
|
+
if not isinstance(section, CubicHeckeFileCache.section):
|
|
784
|
+
raise TypeError('section must be an instance of enum %s' % CubicHeckeFileCache.section)
|
|
785
|
+
|
|
786
|
+
from sage.algebras.hecke_algebras.cubic_hecke_matrix_rep import RepresentationType
|
|
787
|
+
data_lib = self._data_library
|
|
788
|
+
empty_dict = {}
|
|
789
|
+
if section == self.section.matrix_representations:
|
|
790
|
+
for rep_type in RepresentationType:
|
|
791
|
+
new_dict = {}
|
|
792
|
+
empty_dict.update({rep_type.name: new_dict})
|
|
793
|
+
elif section == self.section.basis_extensions:
|
|
794
|
+
empty_dict = []
|
|
795
|
+
data_lib.update({section: empty_dict})
|
|
796
|
+
|
|
797
|
+
def is_empty(self, section=None):
|
|
798
|
+
r"""
|
|
799
|
+
Return ``True`` if the cache of the given ``section`` is empty.
|
|
800
|
+
|
|
801
|
+
INPUT:
|
|
802
|
+
|
|
803
|
+
- ``section`` -- an element of :class:`CubicHeckeFileCache.section`
|
|
804
|
+
to select the section of the file cache or ``None`` (default)
|
|
805
|
+
meaning all sections
|
|
806
|
+
|
|
807
|
+
EXAMPLES::
|
|
808
|
+
|
|
809
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeFileCache
|
|
810
|
+
sage: cha2_fc = CubicHeckeFileCache(2)
|
|
811
|
+
sage: cha2_fc.reset_library()
|
|
812
|
+
sage: cha2_fc.is_empty()
|
|
813
|
+
True
|
|
814
|
+
"""
|
|
815
|
+
if section is None:
|
|
816
|
+
return all(self.is_empty(section=sec) for sec in self.section)
|
|
817
|
+
|
|
818
|
+
if not isinstance(section, CubicHeckeFileCache.section):
|
|
819
|
+
raise TypeError('section must be an instance of enum %s' % CubicHeckeFileCache.section)
|
|
820
|
+
|
|
821
|
+
self.read(section)
|
|
822
|
+
data_lib = self._data_library[section]
|
|
823
|
+
from sage.algebras.hecke_algebras.cubic_hecke_matrix_rep import RepresentationType
|
|
824
|
+
if section == self.section.matrix_representations:
|
|
825
|
+
for rep_type in RepresentationType:
|
|
826
|
+
if len(data_lib[rep_type.name]) > 0:
|
|
827
|
+
return False
|
|
828
|
+
return True
|
|
829
|
+
|
|
830
|
+
if section == self.section.basis_extensions and self._nstrands > 4:
|
|
831
|
+
# the new generators and their inverses are not counted
|
|
832
|
+
# since they are added during initialization
|
|
833
|
+
return len(data_lib) <= 2*(self._nstrands - 4)
|
|
834
|
+
return not data_lib
|
|
835
|
+
|
|
836
|
+
# --------------------------------------------------------------------------
|
|
837
|
+
# save data file system
|
|
838
|
+
# --------------------------------------------------------------------------
|
|
839
|
+
def write(self, section=None):
|
|
840
|
+
r"""
|
|
841
|
+
Write data from memory to the file system.
|
|
842
|
+
|
|
843
|
+
INPUT:
|
|
844
|
+
|
|
845
|
+
- ``section`` -- an element of :class:`CubicHeckeFileCache.section`
|
|
846
|
+
specifying the section where the corresponding cached data belong to;
|
|
847
|
+
if omitted, the data of all sections is written to the file system
|
|
848
|
+
|
|
849
|
+
EXAMPLES::
|
|
850
|
+
|
|
851
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeFileCache
|
|
852
|
+
sage: cha2_fc = CubicHeckeFileCache(2)
|
|
853
|
+
sage: cha2_fc.reset_library(cha2_fc.section.braid_images)
|
|
854
|
+
sage: cha2_fc.write(cha2_fc.section.braid_images)
|
|
855
|
+
"""
|
|
856
|
+
data_lib = self._data_library
|
|
857
|
+
lib_path = self._file_cache_path
|
|
858
|
+
|
|
859
|
+
if section is None:
|
|
860
|
+
for sec in self.section:
|
|
861
|
+
if sec in data_lib.keys():
|
|
862
|
+
self.write(section=sec)
|
|
863
|
+
return
|
|
864
|
+
|
|
865
|
+
if not isinstance(section, CubicHeckeFileCache.section):
|
|
866
|
+
raise TypeError('section must be an instance of enum %s' % CubicHeckeFileCache.section)
|
|
867
|
+
|
|
868
|
+
if section not in data_lib.keys():
|
|
869
|
+
raise ValueError("No data for file %s in memory" % section)
|
|
870
|
+
|
|
871
|
+
verbose('saving file cache %s ...' % section)
|
|
872
|
+
fname = os.path.join(lib_path, section.filename(self._nstrands))
|
|
873
|
+
with atomic_write(fname, binary=True) as f:
|
|
874
|
+
f.write(_base_dumps(data_lib[section]))
|
|
875
|
+
f.close()
|
|
876
|
+
|
|
877
|
+
# --------------------------------------------------------------------------
|
|
878
|
+
# read from file system
|
|
879
|
+
# --------------------------------------------------------------------------
|
|
880
|
+
def read(self, section):
|
|
881
|
+
r"""
|
|
882
|
+
Read data into memory from the file system.
|
|
883
|
+
|
|
884
|
+
INPUT:
|
|
885
|
+
|
|
886
|
+
- ``section`` -- an element of :class:`CubicHeckeFileCache.section`
|
|
887
|
+
specifying the section where the corresponding cached data belong to
|
|
888
|
+
|
|
889
|
+
OUTPUT:
|
|
890
|
+
|
|
891
|
+
Dictionary containing the data library corresponding to the section
|
|
892
|
+
of file cache
|
|
893
|
+
|
|
894
|
+
EXAMPLES::
|
|
895
|
+
|
|
896
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeFileCache
|
|
897
|
+
sage: cha2_fc = CubicHeckeFileCache(2)
|
|
898
|
+
sage: cha2_fc.reset_library(cha2_fc.section.braid_images)
|
|
899
|
+
sage: cha2_fc.read(cha2_fc.section.braid_images)
|
|
900
|
+
{}
|
|
901
|
+
"""
|
|
902
|
+
if not isinstance(section, CubicHeckeFileCache.section):
|
|
903
|
+
raise TypeError('section must be an instance of enum %s' % CubicHeckeFileCache.section)
|
|
904
|
+
|
|
905
|
+
data_lib = self._data_library
|
|
906
|
+
lib_path = self._file_cache_path
|
|
907
|
+
|
|
908
|
+
if section in data_lib.keys():
|
|
909
|
+
return data_lib[section]
|
|
910
|
+
|
|
911
|
+
verbose('loading file cache %s ...' % section)
|
|
912
|
+
fname = os.path.join(lib_path, section.filename(self._nstrands))
|
|
913
|
+
try:
|
|
914
|
+
data_lib[section] = load(fname)
|
|
915
|
+
verbose('... finished!')
|
|
916
|
+
except OSError:
|
|
917
|
+
self.reset_library(section)
|
|
918
|
+
verbose('... not found!')
|
|
919
|
+
except (ImportError, ModuleNotFoundError):
|
|
920
|
+
self._warn_incompatibility(fname)
|
|
921
|
+
self.reset_library(section)
|
|
922
|
+
|
|
923
|
+
return data_lib[section]
|
|
924
|
+
|
|
925
|
+
# --------------------------------------------------------------------------
|
|
926
|
+
# read matrix representation from file cache
|
|
927
|
+
# --------------------------------------------------------------------------
|
|
928
|
+
def read_matrix_representation(self, representation_type, monomial_tietze, ring_of_definition):
|
|
929
|
+
r"""
|
|
930
|
+
Return the matrix representations of the given monomial (in Tietze form)
|
|
931
|
+
if it has been stored in the file cache before.
|
|
932
|
+
INPUT:
|
|
933
|
+
|
|
934
|
+
- ``representation_type`` -- an element of
|
|
935
|
+
:class:`~sage.algebras.hecke_algebras.cubic_hecke_matrix_rep.RepresentationType`
|
|
936
|
+
specifying the type of the representation
|
|
937
|
+
- ``monomial_tietze`` -- tuple representing the braid in Tietze form
|
|
938
|
+
- ``ring_of_definition`` -- instance of
|
|
939
|
+
:class:`~sage.algebras.hecke_algebras.cubic_hecke_base_ring.CubicHeckeRingOfDefinition`
|
|
940
|
+
respectively
|
|
941
|
+
:class:`~sage.algebras.hecke_algebras.cubic_hecke_base_ring.CubicHeckeExtensionRing`
|
|
942
|
+
depending on whether ``representation_type`` is split or not
|
|
943
|
+
|
|
944
|
+
OUTPUT:
|
|
945
|
+
|
|
946
|
+
Dictionary containing all matrix representations of ``self`` of the
|
|
947
|
+
given ``representation_type`` which have been stored in the file cache.
|
|
948
|
+
Otherwise ``None`` is returned.
|
|
949
|
+
|
|
950
|
+
EXAMPLES::
|
|
951
|
+
|
|
952
|
+
sage: CHA2 = algebras.CubicHecke(2)
|
|
953
|
+
sage: R = CHA2.base_ring(generic=True)
|
|
954
|
+
sage: cha_fc = CHA2._filecache
|
|
955
|
+
sage: g, = CHA2.gens(); gt = g.Tietze()
|
|
956
|
+
sage: rt = CHA2.repr_type
|
|
957
|
+
sage: g.matrix(representation_type=rt.RegularLeft)
|
|
958
|
+
[ 0 -v 1]
|
|
959
|
+
[ 1 u 0]
|
|
960
|
+
[ 0 w 0]
|
|
961
|
+
sage: [_] == cha_fc.read_matrix_representation(rt.RegularLeft, gt, R)
|
|
962
|
+
True
|
|
963
|
+
sage: cha_fc.reset_library(cha_fc.section.matrix_representations)
|
|
964
|
+
sage: cha_fc.write(cha_fc.section.matrix_representations)
|
|
965
|
+
sage: cha_fc.read_matrix_representation(rt.RegularLeft, gt, R) == None
|
|
966
|
+
True
|
|
967
|
+
"""
|
|
968
|
+
from sage.algebras.hecke_algebras.cubic_hecke_matrix_rep import RepresentationType
|
|
969
|
+
if not isinstance(representation_type, RepresentationType):
|
|
970
|
+
raise TypeError('representation_type must be an instance of enum %s' % RepresentationType)
|
|
971
|
+
|
|
972
|
+
matrix_representations = self.read(self.section.matrix_representations)[representation_type.name]
|
|
973
|
+
if monomial_tietze in matrix_representations.keys():
|
|
974
|
+
matrix_list_dict = matrix_representations[monomial_tietze]
|
|
975
|
+
matrix_list = [matrix(ring_of_definition, mat_dict, sparse=True) for mat_dict in matrix_list_dict]
|
|
976
|
+
for m in matrix_list:
|
|
977
|
+
m.set_immutable()
|
|
978
|
+
return matrix_list
|
|
979
|
+
return None
|
|
980
|
+
|
|
981
|
+
# --------------------------------------------------------------------------
|
|
982
|
+
# matrix_representation to file cache
|
|
983
|
+
# --------------------------------------------------------------------------
|
|
984
|
+
def write_matrix_representation(self, representation_type, monomial_tietze, matrix_list):
|
|
985
|
+
r"""
|
|
986
|
+
Write the matrix representation of a monomial to the file cache.
|
|
987
|
+
|
|
988
|
+
INPUT:
|
|
989
|
+
|
|
990
|
+
- ``representation_type`` -- an element of
|
|
991
|
+
:class:`~sage.algebras.hecke_algebras.cubic_hecke_matrix_rep.RepresentationType`
|
|
992
|
+
specifying the type of the representation
|
|
993
|
+
- ``monomial_tietze`` -- tuple representing the braid in Tietze form
|
|
994
|
+
- ``matrix_list`` -- list of matrices corresponding to the irreducible
|
|
995
|
+
representations
|
|
996
|
+
|
|
997
|
+
EXAMPLES::
|
|
998
|
+
|
|
999
|
+
sage: CHA2 = algebras.CubicHecke(2)
|
|
1000
|
+
sage: R = CHA2.base_ring(generic=True)
|
|
1001
|
+
sage: cha_fc = CHA2._filecache
|
|
1002
|
+
sage: g, = CHA2.gens(); gi = ~g; git = gi.Tietze()
|
|
1003
|
+
sage: rt = CHA2.repr_type
|
|
1004
|
+
sage: m = gi.matrix(representation_type=rt.RegularRight)
|
|
1005
|
+
sage: cha_fc.read_matrix_representation(rt.RegularRight, git, R)
|
|
1006
|
+
[
|
|
1007
|
+
[ 0 1 (-u)/w]
|
|
1008
|
+
[ 0 0 1/w]
|
|
1009
|
+
[ 1 0 v/w]
|
|
1010
|
+
]
|
|
1011
|
+
sage: CHA2.reset_filecache(cha_fc.section.matrix_representations)
|
|
1012
|
+
sage: cha_fc.read_matrix_representation(rt.RegularLeft, git, R) == None
|
|
1013
|
+
True
|
|
1014
|
+
sage: cha_fc.write_matrix_representation(rt.RegularRight, git, [m])
|
|
1015
|
+
sage: [m] == cha_fc.read_matrix_representation(rt.RegularRight, git, R)
|
|
1016
|
+
True
|
|
1017
|
+
"""
|
|
1018
|
+
from sage.algebras.hecke_algebras.cubic_hecke_matrix_rep import RepresentationType
|
|
1019
|
+
if not isinstance(representation_type, RepresentationType):
|
|
1020
|
+
raise TypeError('representation_type must be an instance of enum %s' % RepresentationType)
|
|
1021
|
+
|
|
1022
|
+
sec = self.section.matrix_representations
|
|
1023
|
+
all_matrix_representations = self.read(sec)
|
|
1024
|
+
if representation_type.name not in all_matrix_representations.keys():
|
|
1025
|
+
# old file-cache is not compatible with current dictionary keys.
|
|
1026
|
+
fname = os.path.join(self._file_cache_path, sec.filename(self._nstrands))
|
|
1027
|
+
self._warn_incompatibility(fname)
|
|
1028
|
+
all_matrix_representations = self.read(sec)
|
|
1029
|
+
|
|
1030
|
+
matrix_representations = all_matrix_representations[representation_type.name]
|
|
1031
|
+
|
|
1032
|
+
if monomial_tietze in matrix_representations.keys():
|
|
1033
|
+
# entry already registered
|
|
1034
|
+
return
|
|
1035
|
+
|
|
1036
|
+
matrix_representation_dict = [simplify(mat) for mat in list(matrix_list)]
|
|
1037
|
+
matrix_representations[monomial_tietze] = matrix_representation_dict
|
|
1038
|
+
|
|
1039
|
+
self.write(sec)
|
|
1040
|
+
return
|
|
1041
|
+
|
|
1042
|
+
# --------------------------------------------------------------------------
|
|
1043
|
+
# read braid images from file cache
|
|
1044
|
+
# --------------------------------------------------------------------------
|
|
1045
|
+
def read_braid_image(self, braid_tietze, ring_of_definition):
|
|
1046
|
+
r"""
|
|
1047
|
+
Return the list of pre calculated braid images from file cache.
|
|
1048
|
+
|
|
1049
|
+
INPUT:
|
|
1050
|
+
|
|
1051
|
+
- ``braid_tietze`` -- tuple representing the braid in Tietze form
|
|
1052
|
+
- ``ring_of_definition`` -- a
|
|
1053
|
+
:class:`~sage.algebras.hecke_algebras.cubic_hecke_base_ring.CubicHeckeRingOfDefinition`
|
|
1054
|
+
|
|
1055
|
+
OUTPUT:
|
|
1056
|
+
|
|
1057
|
+
A dictionary containing the pre calculated braid image of the given
|
|
1058
|
+
braid.
|
|
1059
|
+
|
|
1060
|
+
EXAMPLES::
|
|
1061
|
+
|
|
1062
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeFileCache
|
|
1063
|
+
sage: CHA2 = algebras.CubicHecke(2)
|
|
1064
|
+
sage: ring_of_definition = CHA2.base_ring(generic=True)
|
|
1065
|
+
sage: cha_fc = CubicHeckeFileCache(2)
|
|
1066
|
+
sage: B2 = BraidGroup(2)
|
|
1067
|
+
sage: b, = B2.gens(); b2 = b**2
|
|
1068
|
+
sage: cha_fc.is_empty(CubicHeckeFileCache.section.braid_images)
|
|
1069
|
+
True
|
|
1070
|
+
sage: b2_img = CHA2(b2); b2_img
|
|
1071
|
+
w*c^-1 + u*c - v
|
|
1072
|
+
sage: cha_fc.write_braid_image(b2.Tietze(), b2_img.to_vector())
|
|
1073
|
+
sage: cha_fc.read_braid_image(b2.Tietze(), ring_of_definition)
|
|
1074
|
+
(-v, u, w)
|
|
1075
|
+
"""
|
|
1076
|
+
braid_images = self.read(self.section.braid_images)
|
|
1077
|
+
if braid_tietze in braid_images.keys():
|
|
1078
|
+
braid_image = braid_images[braid_tietze]
|
|
1079
|
+
result_list = [ring_of_definition(cf) for cf in list(braid_image)]
|
|
1080
|
+
from sage.modules.free_module_element import vector
|
|
1081
|
+
return vector(ring_of_definition, result_list)
|
|
1082
|
+
return None
|
|
1083
|
+
|
|
1084
|
+
# --------------------------------------------------------------------------
|
|
1085
|
+
# braid image to_file cache
|
|
1086
|
+
# --------------------------------------------------------------------------
|
|
1087
|
+
def write_braid_image(self, braid_tietze, braid_image_vect):
|
|
1088
|
+
r"""
|
|
1089
|
+
Write the braid image of the given braid to the file cache.
|
|
1090
|
+
|
|
1091
|
+
INPUT:
|
|
1092
|
+
|
|
1093
|
+
- ``braid_tietze`` -- tuple representing the braid in Tietze form
|
|
1094
|
+
- ``braid_image_vect`` -- image of the given braid as a vector with
|
|
1095
|
+
respect to the basis of the cubic Hecke algebra
|
|
1096
|
+
|
|
1097
|
+
EXAMPLES::
|
|
1098
|
+
|
|
1099
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeFileCache
|
|
1100
|
+
sage: CHA2 = algebras.CubicHecke(2)
|
|
1101
|
+
sage: ring_of_definition = CHA2.base_ring(generic=True)
|
|
1102
|
+
sage: cha_fc = CubicHeckeFileCache(2)
|
|
1103
|
+
sage: B2 = BraidGroup(2)
|
|
1104
|
+
sage: b, = B2.gens(); b3 = b**3
|
|
1105
|
+
sage: b3_img = CHA2(b3); b3_img
|
|
1106
|
+
u*w*c^-1 + (u^2-v)*c - (u*v-w)
|
|
1107
|
+
sage: cha_fc.write_braid_image(b3.Tietze(), b3_img.to_vector())
|
|
1108
|
+
sage: cha_fc.read_braid_image(b3.Tietze(), ring_of_definition)
|
|
1109
|
+
(-u*v + w, u^2 - v, u*w)
|
|
1110
|
+
sage: cha_fc.reset_library(CubicHeckeFileCache.section.braid_images)
|
|
1111
|
+
sage: cha_fc.write(CubicHeckeFileCache.section.braid_images)
|
|
1112
|
+
sage: cha_fc.is_empty(CubicHeckeFileCache.section.braid_images)
|
|
1113
|
+
True
|
|
1114
|
+
"""
|
|
1115
|
+
braid_images = self.read(self.section.braid_images)
|
|
1116
|
+
|
|
1117
|
+
if braid_tietze in braid_images.keys():
|
|
1118
|
+
# entry already registered
|
|
1119
|
+
return
|
|
1120
|
+
|
|
1121
|
+
braid_image_dict = [str(cf) for cf in list(braid_image_vect)]
|
|
1122
|
+
braid_images[braid_tietze] = braid_image_dict
|
|
1123
|
+
|
|
1124
|
+
self.write(self.section.braid_images)
|
|
1125
|
+
return
|
|
1126
|
+
|
|
1127
|
+
# --------------------------------------------------------------------------
|
|
1128
|
+
# basis to file cache
|
|
1129
|
+
# --------------------------------------------------------------------------
|
|
1130
|
+
def update_basis_extensions(self, new_basis_extensions):
|
|
1131
|
+
r"""
|
|
1132
|
+
Update the file cache for basis extensions for cubic Hecke algebras on
|
|
1133
|
+
more than 4 strands according to the given ``new_basis_extensions``.
|
|
1134
|
+
|
|
1135
|
+
INPUT:
|
|
1136
|
+
|
|
1137
|
+
- ``new_basis_extensions`` -- list of additional (to the static basis)
|
|
1138
|
+
basis elements which should replace the former such list in the file
|
|
1139
|
+
|
|
1140
|
+
EXAMPLES::
|
|
1141
|
+
|
|
1142
|
+
sage: from sage.databases.cubic_hecke_db import CubicHeckeFileCache
|
|
1143
|
+
sage: CHA2 = algebras.CubicHecke(2)
|
|
1144
|
+
sage: cha_fc = CubicHeckeFileCache(2)
|
|
1145
|
+
sage: cha_fc.is_empty(CubicHeckeFileCache.section.basis_extensions)
|
|
1146
|
+
True
|
|
1147
|
+
sage: cha_fc.update_basis_extensions([(1,), (-1,)])
|
|
1148
|
+
sage: cha_fc.read(CubicHeckeFileCache.section.basis_extensions)
|
|
1149
|
+
[(1,), (-1,)]
|
|
1150
|
+
sage: cha_fc.reset_library(CubicHeckeFileCache.section.basis_extensions)
|
|
1151
|
+
sage: cha_fc.write(CubicHeckeFileCache.section.basis_extensions)
|
|
1152
|
+
sage: cha_fc.is_empty(CubicHeckeFileCache.section.basis_extensions)
|
|
1153
|
+
True
|
|
1154
|
+
"""
|
|
1155
|
+
self._data_library.update({self.section.basis_extensions: new_basis_extensions})
|
|
1156
|
+
self.write(self.section.basis_extensions)
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
# -----------------------------------------------------------------------------
|
|
1160
|
+
# Demo data section
|
|
1161
|
+
# -----------------------------------------------------------------------------
|
|
1162
|
+
|
|
1163
|
+
func_name = 'read_%s'
|
|
1164
|
+
|
|
1165
|
+
var_decl = "\n %s = variables"
|
|
1166
|
+
var_doc_input = "\n - ``variables`` -- tuple containing the indeterminates of the representation"
|
|
1167
|
+
var_doc_decl = "\n sage: L.<%s> = LaurentPolynomialRing(ZZ)"
|
|
1168
|
+
|
|
1169
|
+
template = """def %s(%snum_strands=3):
|
|
1170
|
+
%s%s
|
|
1171
|
+
data = {}
|
|
1172
|
+
data[2] = %s
|
|
1173
|
+
data[3] = %s
|
|
1174
|
+
return data[num_strands]
|
|
1175
|
+
"""
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
doc = r"""{}
|
|
1179
|
+
Return precomputed data of Ivan Marin.
|
|
1180
|
+
|
|
1181
|
+
This code was generated by :func:`create_demo_data`, please do not edit.
|
|
1182
|
+
|
|
1183
|
+
INPUT:
|
|
1184
|
+
%s
|
|
1185
|
+
- ``num_strands`` -- integer; number of strands of the cubic Hecke algebra
|
|
1186
|
+
|
|
1187
|
+
EXAMPLES::
|
|
1188
|
+
|
|
1189
|
+
{}age: from sage.databases.cubic_hecke_db import %s%s
|
|
1190
|
+
{}age: %s(%s2)
|
|
1191
|
+
{}
|
|
1192
|
+
""".format('r"""', 's', 's', '"""') # s in the middle to hide these lines from _test_enough_doctests
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
def create_demo_data(filename='demo_data.py'):
|
|
1196
|
+
r"""
|
|
1197
|
+
Generate code for the functions inserted below to access the
|
|
1198
|
+
small cases of less than 4 strands as demonstration cases.
|
|
1199
|
+
|
|
1200
|
+
The code is written to a file with the given name from where
|
|
1201
|
+
it can be copied into this source file (in case a change is needed).
|
|
1202
|
+
|
|
1203
|
+
EXAMPLES::
|
|
1204
|
+
|
|
1205
|
+
sage: from sage.databases.cubic_hecke_db import create_demo_data
|
|
1206
|
+
sage: create_demo_data() # not tested
|
|
1207
|
+
"""
|
|
1208
|
+
# ---------------------------------------------------------------
|
|
1209
|
+
# preparations
|
|
1210
|
+
# ---------------------------------------------------------------
|
|
1211
|
+
def create_repr_func(name, variables, data2, data3):
|
|
1212
|
+
fname = func_name % name
|
|
1213
|
+
if variables:
|
|
1214
|
+
v = str(variables)
|
|
1215
|
+
vars2 = v + ', '
|
|
1216
|
+
decl = var_decl % v
|
|
1217
|
+
doc_dec = var_doc_decl % v[1: len(v)-1]
|
|
1218
|
+
doc_str = doc % (var_doc_input, fname, doc_dec, fname, vars2)
|
|
1219
|
+
res = template % (fname, 'variables, ', doc_str, decl, data2, data3)
|
|
1220
|
+
else:
|
|
1221
|
+
doc_str = doc % ('', fname, '', fname, '')
|
|
1222
|
+
res = template % (fname, '', doc_str, '', data2, data3)
|
|
1223
|
+
return res
|
|
1224
|
+
|
|
1225
|
+
from textwrap import fill
|
|
1226
|
+
|
|
1227
|
+
def fl(s):
|
|
1228
|
+
return fill(str(s), subsequent_indent=' ')
|
|
1229
|
+
|
|
1230
|
+
from sympy import var
|
|
1231
|
+
from database_cubic_hecke import read_basis, read_irr, read_reg
|
|
1232
|
+
|
|
1233
|
+
vari = var('a, b, c, j')
|
|
1234
|
+
varr = var('u, v, w')
|
|
1235
|
+
|
|
1236
|
+
# ---------------------------------------------------------------
|
|
1237
|
+
# read data
|
|
1238
|
+
# ---------------------------------------------------------------
|
|
1239
|
+
bas2 = fl(read_basis(num_strands=2))
|
|
1240
|
+
bas3 = fl(read_basis(num_strands=3))
|
|
1241
|
+
|
|
1242
|
+
irr2 = fl(read_irr(variables=vari, num_strands=2))
|
|
1243
|
+
irr3 = fl(read_irr(variables=vari, num_strands=3))
|
|
1244
|
+
|
|
1245
|
+
regl2 = fl(read_reg(variables=varr, num_strands=2))
|
|
1246
|
+
regl3 = fl(read_reg(variables=varr, num_strands=3))
|
|
1247
|
+
|
|
1248
|
+
regr2 = fl(read_reg(variables=varr, num_strands=2, right=True))
|
|
1249
|
+
regr3 = fl(read_reg(variables=varr, num_strands=3, right=True))
|
|
1250
|
+
|
|
1251
|
+
# ---------------------------------------------------------------
|
|
1252
|
+
# create functions and write them to file
|
|
1253
|
+
# ---------------------------------------------------------------
|
|
1254
|
+
bas = create_repr_func('basis', '', bas2, bas3)
|
|
1255
|
+
irr = create_repr_func('irr', vari, irr2, irr3)
|
|
1256
|
+
regl = create_repr_func('regl', varr, regl2, regl3)
|
|
1257
|
+
regr = create_repr_func('regr', varr, regr2, regr3)
|
|
1258
|
+
|
|
1259
|
+
with open(filename, 'w') as f:
|
|
1260
|
+
f.write(bas)
|
|
1261
|
+
f.write(irr)
|
|
1262
|
+
f.write(regl)
|
|
1263
|
+
f.write(regr)
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
def read_basis(num_strands=3):
|
|
1267
|
+
r"""
|
|
1268
|
+
Return precomputed data of Ivan Marin.
|
|
1269
|
+
|
|
1270
|
+
This code was generated by :func:`create_demo_data`, please do not edit.
|
|
1271
|
+
|
|
1272
|
+
INPUT:
|
|
1273
|
+
|
|
1274
|
+
- ``num_strands`` -- integer; number of strands of the cubic Hecke algebra
|
|
1275
|
+
|
|
1276
|
+
EXAMPLES::
|
|
1277
|
+
|
|
1278
|
+
sage: from sage.databases.cubic_hecke_db import read_basis
|
|
1279
|
+
sage: read_basis(2)
|
|
1280
|
+
[[], [1], [-1]]
|
|
1281
|
+
"""
|
|
1282
|
+
data = {}
|
|
1283
|
+
data[2] = [[], [1], [-1]]
|
|
1284
|
+
data[3] = [[], [1], [-1], [2], [-2], [1, 2], [1, -2], [-1, 2], [-1, -2], [1, 2,
|
|
1285
|
+
1], [1, 2, -1], [-1, 2, 1], [-1, 2, -1], [1, -2, 1], [-1, -2,
|
|
1286
|
+
1], [2, 1], [-2, 1], [2, -1], [-2, -1], [1, -2, -1], [-1, -2,
|
|
1287
|
+
-1], [2, -1, 2], [1, 2, -1, 2], [-1, 2, -1, 2]]
|
|
1288
|
+
return data[num_strands]
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
def read_irr(variables, num_strands=3):
|
|
1292
|
+
r"""
|
|
1293
|
+
Return precomputed data of Ivan Marin.
|
|
1294
|
+
|
|
1295
|
+
This code was generated by :func:`create_demo_data`, please do not edit.
|
|
1296
|
+
|
|
1297
|
+
INPUT:
|
|
1298
|
+
|
|
1299
|
+
- ``variables`` -- tuple containing the indeterminates of the representation
|
|
1300
|
+
- ``num_strands`` -- integer; number of strands of the cubic Hecke algebra
|
|
1301
|
+
|
|
1302
|
+
EXAMPLES::
|
|
1303
|
+
|
|
1304
|
+
sage: from sage.databases.cubic_hecke_db import read_irr
|
|
1305
|
+
sage: L.<a, b, c, j> = LaurentPolynomialRing(ZZ)
|
|
1306
|
+
sage: read_irr((a, b, c, j), 2)
|
|
1307
|
+
([1, 1, 1],
|
|
1308
|
+
[[{(0, 0): a}], [{(0, 0): c}], [{(0, 0): b}]],
|
|
1309
|
+
[[{(0, 0): a^-1}], [{(0, 0): c^-1}], [{(0, 0): b^-1}]])
|
|
1310
|
+
"""
|
|
1311
|
+
(a, b, c, j) = variables
|
|
1312
|
+
data = {}
|
|
1313
|
+
data[2] = ([1, 1, 1], [[{(0, 0): a}], [{(0, 0): c}], [{(0, 0): b}]], [[{(0, 0):
|
|
1314
|
+
1/a}], [{(0, 0): 1/c}], [{(0, 0): 1/b}]])
|
|
1315
|
+
data[3] = ([1, 1, 1, 2, 2, 2, 3], [[{(0, 0): a}, {(0, 0): a}], [{(0, 0): c},
|
|
1316
|
+
{(0, 0): c}], [{(0, 0): b}, {(0, 0): b}], [{(0, 0): b, (1, 0):
|
|
1317
|
+
b*c, (1, 1): c}, {(0, 0): c, (0, 1): -1, (1, 1): b}], [{(0,
|
|
1318
|
+
0): a, (1, 0): a*b, (1, 1): b}, {(0, 0): b, (0, 1): -1, (1,
|
|
1319
|
+
1): a}], [{(0, 0): a, (1, 0): a*c, (1, 1): c}, {(0, 0): c, (0,
|
|
1320
|
+
1): -1, (1, 1): a}], [{(0, 0): c, (1, 0): a*c + b**2, (1, 1):
|
|
1321
|
+
b, (2, 0): b, (2, 1): 1, (2, 2): a}, {(0, 0): a, (0, 1): -1,
|
|
1322
|
+
(0, 2): b, (1, 1): b, (1, 2): -a*c - b**2, (2, 2): c}]],
|
|
1323
|
+
[[{(0, 0): 1/a}, {(0, 0): 1/a}], [{(0, 0): 1/c}, {(0, 0):
|
|
1324
|
+
1/c}], [{(0, 0): 1/b}, {(0, 0): 1/b}], [{(0, 0): 1/b, (1, 0):
|
|
1325
|
+
-1, (1, 1): 1/c}, {(0, 0): 1/c, (0, 1): 1/(b*c), (1, 1):
|
|
1326
|
+
1/b}], [{(0, 0): 1/a, (1, 0): -1, (1, 1): 1/b}, {(0, 0): 1/b,
|
|
1327
|
+
(0, 1): 1/(a*b), (1, 1): 1/a}], [{(0, 0): 1/a, (1, 0): -1, (1,
|
|
1328
|
+
1): 1/c}, {(0, 0): 1/c, (0, 1): 1/(a*c), (1, 1): 1/a}], [{(0,
|
|
1329
|
+
0): 1/c, (1, 0): -a/b - b/c, (1, 1): 1/b, (2, 0): 1/b, (2, 1):
|
|
1330
|
+
-1/(a*b), (2, 2): 1/a}, {(0, 0): 1/a, (0, 1): 1/(a*b), (0, 2):
|
|
1331
|
+
1/b, (1, 1): 1/b, (1, 2): a/b + b/c, (2, 2): 1/c}]])
|
|
1332
|
+
return data[num_strands]
|
|
1333
|
+
|
|
1334
|
+
|
|
1335
|
+
def read_regl(variables, num_strands=3):
|
|
1336
|
+
r"""
|
|
1337
|
+
Return precomputed data of Ivan Marin.
|
|
1338
|
+
|
|
1339
|
+
This code was generated by :func:`create_demo_data`, please do not edit.
|
|
1340
|
+
|
|
1341
|
+
INPUT:
|
|
1342
|
+
|
|
1343
|
+
- ``variables`` -- tuple containing the indeterminates of the representation
|
|
1344
|
+
- ``num_strands`` -- integer; number of strands of the cubic Hecke algebra
|
|
1345
|
+
|
|
1346
|
+
EXAMPLES::
|
|
1347
|
+
|
|
1348
|
+
sage: from sage.databases.cubic_hecke_db import read_regl
|
|
1349
|
+
sage: L.<u, v, w> = LaurentPolynomialRing(ZZ)
|
|
1350
|
+
sage: read_regl((u, v, w), 2)
|
|
1351
|
+
([3],
|
|
1352
|
+
[[{(0, 1): -v, (0, 2): 1, (1, 0): 1, (1, 1): u, (2, 1): w}]],
|
|
1353
|
+
[[{(0, 1): 1, (0, 2): -u*w^-1, (1, 2): w^-1, (2, 0): 1, (2, 2): v*w^-1}]])
|
|
1354
|
+
"""
|
|
1355
|
+
(u, v, w) = variables
|
|
1356
|
+
data = {}
|
|
1357
|
+
data[2] = ([3], [[{(0, 1): -v, (0, 2): 1, (1, 0): 1, (1, 1): u, (2, 1): w}]],
|
|
1358
|
+
[[{(0, 1): 1, (0, 2): -u/w, (1, 2): 1/w, (2, 0): 1, (2, 2):
|
|
1359
|
+
v/w}]])
|
|
1360
|
+
data[3] = ([24], [[{(0, 1): -v, (0, 2): 1, (1, 0): 1, (1, 1): u, (2, 1): w, (3,
|
|
1361
|
+
5): -v, (3, 7): 1, (4, 6): -v, (4, 8): 1, (5, 3): 1, (5, 5):
|
|
1362
|
+
u, (6, 4): 1, (6, 6): u, (7, 5): w, (8, 6): w, (9, 9): u, (9,
|
|
1363
|
+
15): 1, (10, 10): u, (10, 17): 1, (11, 9): w, (12, 10): w,
|
|
1364
|
+
(13, 13): u, (13, 16): 1, (14, 13): w, (15, 9): -v, (15, 11):
|
|
1365
|
+
1, (16, 13): -v, (16, 14): 1, (17, 10): -v, (17, 12): 1, (18,
|
|
1366
|
+
19): -v, (18, 20): 1, (19, 18): 1, (19, 19): u, (20, 19): w,
|
|
1367
|
+
(21, 22): -v, (21, 23): 1, (22, 21): 1, (22, 22): u, (23, 22):
|
|
1368
|
+
w}, {(0, 3): -v, (0, 4): 1, (1, 15): -v, (1, 16): 1, (1, 22):
|
|
1369
|
+
-v, (1, 23): u*v/w, (2, 17): -v, (2, 18): 1, (2, 23): v*(u*v -
|
|
1370
|
+
w)/w, (3, 0): 1, (3, 3): u, (4, 3): w, (5, 9): -v, (5, 10): 1,
|
|
1371
|
+
(5, 12): -u/w, (5, 22): u, (5, 23): -u**2/w, (6, 11): -v, (6,
|
|
1372
|
+
22): w, (6, 23): -u, (7, 12): -u*v/w, (7, 13): -v, (7, 19): 1,
|
|
1373
|
+
(7, 21): -v, (7, 23): -u**2*v/w, (8, 12): -v, (8, 14): -v, (8,
|
|
1374
|
+
20): 1, (8, 23): -u*v, (9, 5): 1, (9, 9): u, (9, 23): u/w,
|
|
1375
|
+
(10, 9): w, (10, 11): -u, (11, 6): 1, (11, 11): u, (11, 13):
|
|
1376
|
+
u, (12, 13): w, (12, 23): -v, (13, 23): 1, (14, 8): 1, (14,
|
|
1377
|
+
14): u, (14, 23): v, (15, 1): 1, (15, 12): u/w, (15, 15): u,
|
|
1378
|
+
(16, 11): v, (16, 15): w, (16, 23): -u, (17, 2): 1, (17, 12):
|
|
1379
|
+
u*v/w, (17, 17): u, (18, 12): v, (18, 17): w, (19, 21): w,
|
|
1380
|
+
(19, 23): v, (20, 14): w, (21, 7): 1, (21, 21): u, (21, 23):
|
|
1381
|
+
u*v/w, (22, 11): 1, (23, 12): 1, (23, 23): u}]], [[{(0, 1): 1,
|
|
1382
|
+
(0, 2): -u/w, (1, 2): 1/w, (2, 0): 1, (2, 2): v/w, (3, 5): 1,
|
|
1383
|
+
(3, 7): -u/w, (4, 6): 1, (4, 8): -u/w, (5, 7): 1/w, (6, 8):
|
|
1384
|
+
1/w, (7, 3): 1, (7, 7): v/w, (8, 4): 1, (8, 8): v/w, (9, 11):
|
|
1385
|
+
1/w, (10, 12): 1/w, (11, 11): v/w, (11, 15): 1, (12, 12): v/w,
|
|
1386
|
+
(12, 17): 1, (13, 14): 1/w, (14, 14): v/w, (14, 16): 1, (15,
|
|
1387
|
+
9): 1, (15, 11): -u/w, (16, 13): 1, (16, 14): -u/w, (17, 10):
|
|
1388
|
+
1, (17, 12): -u/w, (18, 19): 1, (18, 20): -u/w, (19, 20): 1/w,
|
|
1389
|
+
(20, 18): 1, (20, 20): v/w, (21, 22): 1, (21, 23): -u/w, (22,
|
|
1390
|
+
23): 1/w, (23, 21): 1, (23, 23): v/w}, {(0, 3): 1, (0, 4):
|
|
1391
|
+
-u/w, (1, 15): 1, (1, 16): -u/w, (1, 22): u*v/w, (1, 23):
|
|
1392
|
+
-u/w, (2, 17): 1, (2, 18): -u/w, (3, 4): 1/w, (4, 0): 1, (4,
|
|
1393
|
+
4): v/w, (5, 9): 1, (5, 10): -u/w, (5, 13): -u/w, (5, 22):
|
|
1394
|
+
-u**2/w, (6, 11): 1, (6, 12): -u/w, (6, 13): -u*v/w, (6, 22):
|
|
1395
|
+
-u, (7, 19): -u/w, (7, 21): 1, (8, 13): -v, (8, 14): 1, (8,
|
|
1396
|
+
20): -u/w, (9, 10): 1/w, (9, 22): u/w, (10, 5): 1, (10, 6):
|
|
1397
|
+
-u/w, (10, 10): v/w, (10, 13): -u**2/w, (10, 23): u/w, (11,
|
|
1398
|
+
22): 1, (12, 13): -u, (12, 23): 1, (13, 12): 1/w, (13, 13):
|
|
1399
|
+
v/w, (14, 20): 1/w, (15, 13): u/w, (15, 16): 1/w, (15, 22):
|
|
1400
|
+
-v/w, (16, 1): 1, (16, 6): v/w, (16, 13): u*v/w, (16, 16):
|
|
1401
|
+
v/w, (17, 13): u*v/w, (17, 18): 1/w, (17, 23): -v/w, (18, 2):
|
|
1402
|
+
1, (18, 13): v, (18, 18): v/w, (18, 23): -v**2/w, (19, 7): 1,
|
|
1403
|
+
(19, 12): v/w, (19, 19): v/w, (19, 23): u*v/w, (20, 8): 1,
|
|
1404
|
+
(20, 20): v/w, (20, 23): v, (21, 13): -v/w, (21, 19): 1/w,
|
|
1405
|
+
(22, 6): 1/w, (22, 13): u/w, (22, 22): v/w, (23, 13): 1}]])
|
|
1406
|
+
return data[num_strands]
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
def read_regr(variables, num_strands=3):
|
|
1410
|
+
r"""
|
|
1411
|
+
Return precomputed data of Ivan Marin.
|
|
1412
|
+
|
|
1413
|
+
This code was generated by :func:`create_demo_data`, please do not edit.
|
|
1414
|
+
|
|
1415
|
+
INPUT:
|
|
1416
|
+
|
|
1417
|
+
- ``variables`` -- tuple containing the indeterminates of the representation
|
|
1418
|
+
- ``num_strands`` -- integer; number of strands of the cubic Hecke algebra
|
|
1419
|
+
|
|
1420
|
+
EXAMPLES::
|
|
1421
|
+
|
|
1422
|
+
sage: from sage.databases.cubic_hecke_db import read_regr
|
|
1423
|
+
sage: L.<u, v, w> = LaurentPolynomialRing(ZZ)
|
|
1424
|
+
sage: read_regr((u, v, w), 2)
|
|
1425
|
+
([3],
|
|
1426
|
+
[[{(0, 1): -v, (0, 2): 1, (1, 0): 1, (1, 1): u, (2, 1): w}]],
|
|
1427
|
+
[[{(0, 1): 1, (0, 2): -u*w^-1, (1, 2): w^-1, (2, 0): 1, (2, 2): v*w^-1}]])
|
|
1428
|
+
"""
|
|
1429
|
+
(u, v, w) = variables
|
|
1430
|
+
data = {}
|
|
1431
|
+
data[2] = ([3], [[{(0, 1): -v, (0, 2): 1, (1, 0): 1, (1, 1): u, (2, 1): w}]],
|
|
1432
|
+
[[{(0, 1): 1, (0, 2): -u/w, (1, 2): 1/w, (2, 0): 1, (2, 2):
|
|
1433
|
+
v/w}]])
|
|
1434
|
+
data[3] = ([24], [[{(0, 1): -v, (0, 2): 1, (1, 0): 1, (1, 1): u, (2, 1): w, (3,
|
|
1435
|
+
15): -v, (3, 17): 1, (4, 16): -v, (4, 18): 1, (4, 22): v**2,
|
|
1436
|
+
(4, 23): -v, (5, 9): -v, (5, 10): 1, (6, 13): -v, (6, 19): 1,
|
|
1437
|
+
(6, 21): -v, (6, 22): -u*v, (7, 11): -v, (7, 12): 1, (8, 14):
|
|
1438
|
+
-v, (8, 20): 1, (8, 22): -v*w, (9, 5): 1, (9, 9): u, (9, 23):
|
|
1439
|
+
u/w, (10, 9): w, (10, 21): -u, (10, 22): -u**2, (11, 7): 1,
|
|
1440
|
+
(11, 11): u, (11, 21): u, (11, 23): u*v/w, (12, 11): w, (12,
|
|
1441
|
+
22): -u*w, (13, 6): 1, (13, 13): u, (13, 22): v, (14, 8): 1,
|
|
1442
|
+
(14, 14): u, (14, 23): v, (15, 3): 1, (15, 15): u, (15, 22):
|
|
1443
|
+
u, (15, 23): -u**2/w, (16, 4): 1, (16, 16): u, (16, 21): v,
|
|
1444
|
+
(17, 15): w, (17, 22): u*v, (17, 23): -u, (18, 16): w, (19,
|
|
1445
|
+
13): w, (20, 14): w, (21, 22): -v, (21, 23): 1, (22, 21): 1,
|
|
1446
|
+
(22, 22): u, (23, 22): w}, {(0, 3): -v, (0, 4): 1, (1, 5): -v,
|
|
1447
|
+
(1, 6): 1, (2, 7): -v, (2, 8): 1, (3, 0): 1, (3, 3): u, (4,
|
|
1448
|
+
3): w, (5, 1): 1, (5, 5): u, (6, 5): w, (7, 2): 1, (7, 7): u,
|
|
1449
|
+
(8, 7): w, (9, 9): u, (9, 15): 1, (10, 13): u, (10, 16): 1,
|
|
1450
|
+
(10, 22): -v, (11, 9): w, (12, 13): w, (12, 23): -v, (13, 23):
|
|
1451
|
+
1, (14, 21): w, (14, 23): v, (15, 9): -v, (15, 11): 1, (16,
|
|
1452
|
+
22): w, (16, 23): -u, (17, 13): -v, (17, 14): 1, (17, 21): -v,
|
|
1453
|
+
(18, 19): -v, (18, 20): 1, (19, 18): 1, (19, 19): u, (20, 19):
|
|
1454
|
+
w, (21, 17): 1, (21, 21): u, (22, 10): 1, (22, 22): u, (23,
|
|
1455
|
+
12): 1, (23, 23): u}]], [[{(0, 1): 1, (0, 2): -u/w, (1, 2):
|
|
1456
|
+
1/w, (2, 0): 1, (2, 2): v/w, (3, 15): 1, (3, 17): -u/w, (3,
|
|
1457
|
+
23): u*(u*v - w)/w**2, (4, 16): 1, (4, 18): -u/w, (4, 22): -v,
|
|
1458
|
+
(4, 23): u*v/w, (5, 9): 1, (5, 10): -u/w, (5, 21): -u/w, (5,
|
|
1459
|
+
22): -u**2/w, (5, 23): -u*v/w**2, (6, 13): 1, (6, 19): -u/w,
|
|
1460
|
+
(6, 23): -v/w, (7, 11): 1, (7, 12): -u/w, (7, 21): -u*v/w, (7,
|
|
1461
|
+
22): -u, (7, 23): -u*v**2/w**2, (8, 14): 1, (8, 20): -u/w, (8,
|
|
1462
|
+
21): -v, (8, 23): -v**2/w, (9, 10): 1/w, (9, 22): u/w, (10,
|
|
1463
|
+
5): 1, (10, 10): v/w, (10, 22): u*v/w, (11, 12): 1/w, (11,
|
|
1464
|
+
23): u/w, (12, 7): 1, (12, 12): v/w, (12, 23): u*v/w, (13,
|
|
1465
|
+
19): 1/w, (14, 20): 1/w, (15, 17): 1/w, (15, 21): u/w, (16,
|
|
1466
|
+
18): 1/w, (17, 3): 1, (17, 17): v/w, (17, 21): u*v/w, (18, 4):
|
|
1467
|
+
1, (18, 18): v/w, (18, 21): v, (19, 6): 1, (19, 19): v/w, (19,
|
|
1468
|
+
22): v, (20, 8): 1, (20, 20): v/w, (20, 23): v, (21, 22): 1,
|
|
1469
|
+
(21, 23): -u/w, (22, 23): 1/w, (23, 21): 1, (23, 23): v/w},
|
|
1470
|
+
{(0, 3): 1, (0, 4): -u/w, (1, 5): 1, (1, 6): -u/w, (2, 7): 1,
|
|
1471
|
+
(2, 8): -u/w, (3, 4): 1/w, (4, 0): 1, (4, 4): v/w, (5, 6):
|
|
1472
|
+
1/w, (6, 1): 1, (6, 6): v/w, (7, 8): 1/w, (8, 2): 1, (8, 8):
|
|
1473
|
+
v/w, (9, 11): 1/w, (10, 13): -u**2/w, (10, 16): -u/w, (10,
|
|
1474
|
+
22): 1, (11, 11): v/w, (11, 15): 1, (12, 13): -u, (12, 23): 1,
|
|
1475
|
+
(13, 12): 1/w, (13, 13): v/w, (14, 12): v/w, (14, 14): v/w,
|
|
1476
|
+
(14, 17): 1, (15, 9): 1, (15, 11): -u/w, (16, 10): 1, (16,
|
|
1477
|
+
12): -u/w, (16, 16): v/w, (17, 13): u*v/w, (17, 14): -u/w,
|
|
1478
|
+
(17, 21): 1, (18, 19): 1, (18, 20): -u/w, (19, 20): 1/w, (20,
|
|
1479
|
+
18): 1, (20, 20): v/w, (21, 13): -v/w, (21, 14): 1/w, (22,
|
|
1480
|
+
13): u/w, (22, 16): 1/w, (23, 13): 1}]])
|
|
1481
|
+
return data[num_strands]
|
|
1482
|
+
|
|
1483
|
+
|
|
1484
|
+
# generated data function for cubic Hecke algebra
|
|
1485
|
+
def read_markov(bas_ele, variables, num_strands=4):
|
|
1486
|
+
r"""
|
|
1487
|
+
Return precomputed Markov trace coefficients.
|
|
1488
|
+
|
|
1489
|
+
This code was generated by ``create_markov_trace_data.py`` (from
|
|
1490
|
+
the ``database_cubic_hecke`` repository), please do not edit.
|
|
1491
|
+
|
|
1492
|
+
INPUT:
|
|
1493
|
+
|
|
1494
|
+
- ``bas_ele`` -- an element of :class:`MarkovTraceModuleBasis`
|
|
1495
|
+
- ``variables`` -- tuple consisting of the variables used in
|
|
1496
|
+
the coefficients
|
|
1497
|
+
- ``num_strands`` -- integer (default: 4); the number of strands
|
|
1498
|
+
|
|
1499
|
+
OUTPUT:
|
|
1500
|
+
|
|
1501
|
+
A list of the coefficients. The i'th member corresponds to the i'th
|
|
1502
|
+
basis element.
|
|
1503
|
+
|
|
1504
|
+
EXAMPLES::
|
|
1505
|
+
|
|
1506
|
+
sage: # needs sympy
|
|
1507
|
+
sage: from sage.databases.cubic_hecke_db import read_markov
|
|
1508
|
+
sage: from sympy import var
|
|
1509
|
+
sage: u, v, w, s = var('u, v, w, s')
|
|
1510
|
+
sage: variables = (u, v, w, s)
|
|
1511
|
+
sage: read_markov('U2', variables, num_strands=3)
|
|
1512
|
+
[0, s, 1/s, s, 1/s, 0, 0, 0, 0, -s*v, s, s, -s*u/w, -v/s, 1/s,
|
|
1513
|
+
0, 0, 0, 0, 1/s, -u/(s*w), -v/s, 0, 0]
|
|
1514
|
+
"""
|
|
1515
|
+
u, v, w, s = variables
|
|
1516
|
+
data = {}
|
|
1517
|
+
data[2] = {'U1': [0, s, 1/s], 'U2': [1, 0, 0]}
|
|
1518
|
+
data[3] = {'U1': [0, 0, 0, 0, 0, s**2, 1, 1, 1/s**2, u*s**2 + w, 0, 0, (s**2 +
|
|
1519
|
+
v)/w, (u*s**2 + w)/s**2, 0, s**2, 1, 1, 1/s**2, 0, (s**2 +
|
|
1520
|
+
v)/(w*s**2), (u*s**2 + w)/s**2, s**2, 0], 'U2': [0, s, 1/s, s,
|
|
1521
|
+
1/s, 0, 0, 0, 0, -v*s, s, s, (-u*s)/w, (-v)/s, 1/s, 0, 0, 0,
|
|
1522
|
+
0, 1/s, (-u)/(w*s), (-v)/s, 0, 0], 'U3': [1, 0, 0, 0, 0, 0, 0,
|
|
1523
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'K4': [0,
|
|
1524
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
1525
|
+
0, 1]}
|
|
1526
|
+
|
|
1527
|
+
return data[num_strands][bas_ele]
|