Ticket #14402: trac_14402-tensor_product_infinite_crystals-ts.patch
File trac_14402-tensor_product_infinite_crystals-ts.patch, 56.9 KB (added by , 7 years ago) |
---|
-
sage/categories/crystals.py
# HG changeset patch # User Travis Scrimshaw <tscrim@ucdavis.edur> # Date 1368775183 25200 # Node ID 42389e41b4091efdca2104bfb6bb880688b8277d # Parent e78698946e4e570ca3f752c57de66f9d8e019997 #14402: Change tensor product of crystals to work with infinite crystals diff --git a/sage/categories/crystals.py b/sage/categories/crystals.py
a b class Crystals(Category_singleton): 1118 1118 from sage.categories.highest_weight_crystals import HighestWeightCrystals 1119 1119 if index_set is None: 1120 1120 if HighestWeightCrystals() not in self.parent().categories(): 1121 raise ValueError , "This is not a highest weight crystals!"1121 raise ValueError("This is not a highest weight crystals!") 1122 1122 index_set = self.index_set() 1123 1123 for i in index_set: 1124 if self.epsilon(i) <> 0:1125 self = self.e(i)1126 hw = self.to_highest_weight(index_set = index_set)1124 next = self.e(i) 1125 if next is not None: 1126 hw = next.to_highest_weight(index_set = index_set) 1127 1127 return [hw[0], [i] + hw[1]] 1128 1128 return [self, []] 1129 1129 … … class Crystals(Category_singleton): 1162 1162 raise ValueError, "This is not a highest weight crystals!" 1163 1163 index_set = self.index_set() 1164 1164 for i in index_set: 1165 if self.phi(i) <> 0:1166 self = self.f(i)1167 lw = self.to_lowest_weight(index_set = index_set)1165 next = self.f(i) 1166 if next is not None: 1167 lw = next.to_lowest_weight(index_set = index_set) 1168 1168 return [lw[0], [i] + lw[1]] 1169 1169 return [self, []] 1170 1170 -
sage/combinat/crystals/generalized_young_walls.py
diff --git a/sage/combinat/crystals/generalized_young_walls.py b/sage/combinat/crystals/generalized_young_walls.py
a b Generalized Young walls are certain gene 13 13 introduced in [KS10]_ and designed to be a realization of the crystals 14 14 `\mathcal{B}(\infty)` and `\mathcal{B}(\lambda)` in type `A_n^{(1)}`. 15 15 16 .. WARNING::17 18 Does not work with :func:`TensorProductOfCrystals`.19 20 16 REFERENCES: 21 17 22 18 .. [KS10] J.-A. Kim and D.-U. Shin. -
sage/combinat/crystals/highest_weight_crystals.py
diff --git a/sage/combinat/crystals/highest_weight_crystals.py b/sage/combinat/crystals/highest_weight_crystals.py
a b from sage.categories.classical_crystals 21 21 from sage.structure.parent import Parent 22 22 from sage.combinat.root_system.cartan_type import CartanType 23 23 from sage.combinat.crystals.letters import CrystalOfLetters 24 from sage.combinat.crystals.tensor_product import TensorProductOfCrystals, CrystalOfWords 24 from sage.combinat.crystals.tensor_product import TensorProductOfCrystals, \ 25 TensorProductOfRegularCrystalsElement 25 26 from sage.combinat.crystals.littelmann_path import CrystalOfLSPaths 26 27 27 28 … … def HighestWeightCrystal(dominant_weight 100 101 else: 101 102 raise NotImplementedError 102 103 103 class FiniteDimensionalHighestWeightCrystal_TypeE( CrystalOfWords):104 class FiniteDimensionalHighestWeightCrystal_TypeE(TensorProductOfCrystals): 104 105 """ 105 106 Commonalities for all finite dimensional type E highest weight crystals 106 107 … … class FiniteDimensionalHighestWeightCrys 132 133 Parent.__init__(self, category = ClassicalCrystals()) 133 134 self.module_generators = [self.module_generator()] 134 135 136 Element = TensorProductOfRegularCrystalsElement 135 137 136 138 def module_generator(self): 137 139 """ -
sage/combinat/crystals/tensor_product.py
diff --git a/sage/combinat/crystals/tensor_product.py b/sage/combinat/crystals/tensor_product.py
a b Tensor Products of Crystals 3 3 4 4 Main entry points: 5 5 6 - : func:`TensorProductOfCrystals`6 - :class:`TensorProductOfCrystals` 7 7 - :class:`CrystalOfTableaux` 8 8 9 AUTHORS: 10 11 - Anne Schilling, Nicolas Thiery (2007): Initial version 12 - Ben Salisbury, Travis Scrimshaw (2013): Refactored tensor products to handle 13 non-regular crystals and created new subclass to take advantage of 14 the regularity 9 15 """ 10 16 #***************************************************************************** 11 17 # Copyright (C) 2007 Anne Schilling <anne at math.ucdavis.edu> … … Main entry points: 25 31 26 32 import operator 27 33 from sage.misc.latex import latex 28 from sage.misc.cachefunc import cached_method 34 from sage.misc.cachefunc import cached_method, cached_in_parent_method 29 35 from sage.structure.parent import Parent 30 36 from sage.structure.element import Element, parent 37 from sage.structure.global_options import GlobalOptions 31 38 from sage.categories.category import Category 32 39 from sage.categories.classical_crystals import ClassicalCrystals 40 from sage.categories.regular_crystals import RegularCrystals 33 41 from sage.combinat.root_system.cartan_type import CartanType 34 42 from sage.combinat.cartesian_product import CartesianProduct 35 43 from sage.combinat.combinat import CombinatorialObject … … class ImmutableListWithParent(Combinator 215 223 l[k] = value 216 224 return self.sibling(l) 217 225 218 def TensorProductOfCrystals(*crystals, **options):219 r"""220 Tensor product of crystals.221 222 Given two crystals `B` and `B'` of the same type,223 one can form the tensor product `B \otimes B'`. As a set224 `B \otimes B'` is the Cartesian product225 `B \times B'`. The crystal operators `f_i` and226 `e_i` act on `b \otimes b' \in B \otimes B'` as227 follows:228 229 .. math::230 231 f_i(b \otimes b') = \begin{cases}232 f_i(b) \otimes b' & \text{if $\varepsilon_i(b) \ge \varphi_i(b')$}\\233 b \otimes f_i(b') & \text{otherwise}234 \end{cases}235 236 and237 238 .. math::239 240 e_i(b \otimes b') = \begin{cases}241 b \otimes e_i(b') & \text{if $\varepsilon_i(b) \le \varphi_i(b')$}\\242 e_i(b) \otimes b' & \text{otherwise.}243 \end{cases}244 245 Note that this is the opposite of Kashiwara's convention for tensor246 products of crystals.247 248 EXAMPLES:249 250 We construct the type `A_2`-crystal generated by `2 \otimes 1 \otimes 1`::251 252 sage: C = CrystalOfLetters(['A',2])253 sage: T = TensorProductOfCrystals(C,C,C,generators=[[C(2),C(1),C(1)]])254 255 It has `8` elements::256 257 sage: T.list()258 [[2, 1, 1], [2, 1, 2], [2, 1, 3], [3, 1, 3], [3, 2, 3], [3, 1, 1], [3, 1, 2], [3, 2, 2]]259 260 One can also check the Cartan type of the crystal::261 262 sage: T.cartan_type()263 ['A', 2]264 265 Other examples include crystals of tableaux (which internally are represented as tensor products266 obtained by reading the tableaux columnwise)::267 268 sage: C = CrystalOfTableaux(['A',3], shape=[1,1,0])269 sage: D = CrystalOfTableaux(['A',3], shape=[1,0,0])270 sage: T = TensorProductOfCrystals(C,D, generators=[[C(rows=[[1], [2]]), D(rows=[[1]])], [C(rows=[[2], [3]]), D(rows=[[1]])]])271 sage: T.cardinality()272 24273 sage: TestSuite(T).run()274 sage: T.module_generators275 [[[[1], [2]], [[1]]], [[[2], [3]], [[1]]]]276 sage: [x.weight() for x in T.module_generators]277 [(2, 1, 0, 0), (1, 1, 1, 0)]278 279 If no module generators are specified, we obtain the full tensor280 product::281 282 sage: C=CrystalOfLetters(['A',2])283 sage: T=TensorProductOfCrystals(C,C)284 sage: T.list()285 [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]286 sage: T.cardinality()287 9288 289 For a tensor product of crystals without module generators, the290 default implementation of module_generators contains all elements291 in the tensor product of the crystals. If there is a subset of292 elements in the tensor product that still generates the crystal,293 this needs to be implemented for the specific crystal separately::294 295 sage: T.module_generators.list()296 [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]297 298 For classical highest weight crystals, it is also possible to list299 all highest weight elements::300 301 sage: C = CrystalOfLetters(['A',2])302 sage: T = TensorProductOfCrystals(C,C,C,generators=[[C(2),C(1),C(1)],[C(1),C(2),C(1)]])303 sage: T.highest_weight_vectors()304 [[2, 1, 1], [1, 2, 1]]305 """306 crystals = tuple(crystals)307 if "cartan_type" in options:308 cartan_type = CartanType(options["cartan_type"])309 else:310 if len(crystals) == 0:311 raise ValueError, "you need to specify the Cartan type if the tensor product list is empty"312 else:313 cartan_type = crystals[0].cartan_type()314 315 if "generators" in options:316 generators = tuple(tuple(x) if isinstance(x, list) else x for x in options["generators"])317 return TensorProductOfCrystalsWithGenerators(crystals, generators=generators, cartan_type = cartan_type)318 else:319 return FullTensorProductOfCrystals(crystals, cartan_type = cartan_type)320 321 322 226 class CrystalOfWords(UniqueRepresentation, Parent): 323 227 """ 324 228 Auxiliary class to provide a call method to create tensor product elements. … … class CrystalOfWords(UniqueRepresentatio 393 297 return sum(q**(c[0].energy_function())*B.sum(B(P0(b.weight())) for b in c) for c in C) 394 298 return B.sum(q**(b.energy_function())*B(P0(b.weight())) for b in self) 395 299 300 TensorProductOfCrystalsOptions=GlobalOptions(name='tensor_product_of_crystals', 301 doc=r""" 302 Sets the global options for tensor products of crystals. The default is to 303 use the anti-Kashiwara convention. 396 304 397 class TensorProductOfCrystalsWithGenerators(CrystalOfWords): 305 There are two conventions for how `e_i` and `f_i` act on tensor products, 306 and the difference between the two is the order of the tensor factors 307 are reversed. This affects both the input and output. See the example 308 below. 309 """, 310 end_doc=r""" 398 311 312 .. NOTE:: 313 314 Changing the ``convention`` also changes how the input is handled. 315 316 .. WARNING:: 317 318 Internally, the crystals are always stored using the anti-Kashiwara 319 convention. 320 321 If no parameters are set, then the function returns a copy of the 322 options dictionary. 323 324 EXAMPLES:: 325 326 sage: C = CrystalOfLetters(['A',2]) 327 sage: T = TensorProductOfCrystals(C,C) 328 sage: elt = T(C(1), C(2)); elt 329 [1, 2] 330 sage: TensorProductOfCrystals.global_options['convention'] = "Kashiwara" 331 sage: elt 332 [2, 1] 333 sage: T(C(1), C(2)) == elt 334 False 335 sage: T(C(2), C(1)) == elt 336 True 337 sage: TensorProductOfCrystals.global_options.reset() 338 """, 339 convention=dict(default="antiKashiwara", 340 description='Sets the convention used for displaying/inputting tensor product of crystals', 341 values=dict(antiKashiwara='use the anti-Kashiwara convention', 342 Kashiwara='use the Kashiwara convention'), 343 alias=dict(anti="antiKashiwara", opposite="antiKashiwara"), 344 case_sensitive=False) 345 ) 346 347 class TensorProductOfCrystals(CrystalOfWords): 348 r""" 349 Tensor product of crystals. 350 351 Given two crystals `B` and `B'` of the same Cartan type, 352 one can form the tensor product `B \otimes B^{\prime}`. As a set 353 `B \otimes B^{\prime}` is the Cartesian product 354 `B \times B^{\prime}`. The crystal operators `f_i` and 355 `e_i` act on `b \otimes b^{\prime} \in B \otimes B^{\prime}` as 356 follows: 357 358 .. MATH:: 359 360 f_i(b \otimes b^{\prime}) = \begin{cases} 361 f_i(b) \otimes b^{\prime} & \text{if } \varepsilon_i(b) \geq 362 \varphi_i(b^{\prime}) \\ 363 b \otimes f_i(b^{\prime}) & \text{otherwise} 364 \end{cases} 365 366 and 367 368 .. MATH:: 369 370 e_i(b \otimes b^{\prime}) = \begin{cases} 371 e_i(b) \otimes b^{\prime} & \text{if } \varepsilon_i(b) > 372 \varphi_i(b^{\prime}) \\ 373 b \otimes e_i(b^{\prime}) & \text{otherwise.} 374 \end{cases} 375 376 We also define: 377 378 .. MATH:: 379 380 \begin{aligned} 381 \varphi_i(b \otimes b^{\prime}) & = \max\left( \varphi_i(b), 382 \varphi_i(b) + \varphi_i(b^{\prime}) - \varepsilon_i(b) \right) 383 \\ \varepsilon_i(b \otimes b^{\prime}) & = \max\left( 384 \varepsilon_i(b^{\prime}), \varepsilon_i(b^{\prime}) + 385 \varepsilon_i(b) - \varphi_i(b^{\prime}) \right). 386 \end{aligned} 387 388 .. NOTE:: 389 390 This is the opposite of Kashiwara's convention for tensor 391 products of crystals. 392 393 Since tensor products are associative `(\mathcal{B} \otimes \mathcal{C}) 394 \otimes \mathcal{D} \cong \mathcal{B} \otimes (\mathcal{C} \otimes 395 \mathcal{D})` via the natural isomorphism `(b \otimes c) \otimes d \mapsto 396 b \otimes (c \otimes d)`, we can generalizing this to arbitrary tensor 397 products. Thus consider `B_N \otimes \cdots \otimes B_1`, where each 398 `B_k` is an abstract crystal. The underlying set of the tensor product is 399 `B_N \times \cdots \times B_1`, while the crystal structure is given 400 as follows. Let `I` be the index set, and fix some `i \in I` and `b_N 401 \otimes \cdots \otimes b_1 \in B_N \otimes \cdots \otimes B_1`. Define 402 403 .. MATH:: 404 405 a_i(k) := \varepsilon_i(b_k) - \sum_{j=1}^{k-1} \langle 406 \alpha_i^{\vee}, \mathrm{wt}(b_j) \rangle. 407 408 Then 409 410 .. MATH:: 411 412 \begin{aligned} 413 \mathrm{wt}(b_N \otimes \cdots \otimes b_1) &= 414 \mathrm{wt}(b_N) + \cdots + \mathrm{wt}(b_1), 415 \\ \varepsilon_i(b_N \otimes \cdots \otimes b_1) &= \max_{1 \leq k 416 \leq n}\left( \sum_{j=1}^k \varepsilon_i(b_j) - \sum_{j=1}^{k-1} 417 \varphi_i(b_j) \right) 418 \\ & = \max_{1 \leq k \leq N}\bigl( a_i(k) \bigr), 419 \\ \varphi_i(b_N \otimes \cdots \otimes b_1) &= \max_{1 \leq k \leq N} 420 \left( \varphi_i(b_N) + \sum_{j=k}^{N-1} \big( \varphi_i(b_j) - 421 \varepsilon_i(b_{j+1}) \big) \right) 422 \\ & = \max_{1 \leq k \leq N}\bigl( \lambda_i + a_i(k) \bigr) 423 \end{aligned} 424 425 where `\lambda_i = \langle \alpha_i^{\vee}, \mathrm{wt}(b_N \otimes \cdots 426 \otimes b_1) \rangle`. Then for `k = 1, \ldots, N` the action of the 427 Kashiwara operators is determined as follows. 428 429 - If `a_i(k) > a_i(j)` for `1 \leq j < k` and `a_i(k) \geq a_i(j)` 430 for `k < j \leq N`: 431 432 .. MATH:: 433 434 e_i(b_N \otimes \cdots \otimes b_1) = b_N \otimes \cdots \otimes 435 e_i b_k \otimes \cdots \otimes b_1. 436 437 - If `a_i(k) \geq a_i(j)` for `1 \leq j < k` and `a_i(k) > a_i(j)` 438 for `k < j \leq N`: 439 440 .. MATH:: 441 442 f_i(b_N \otimes \cdots \otimes b_1) = b_N \otimes \cdots \otimes 443 f_i b_k \otimes \cdots \otimes b_1. 444 445 Note that this is just recursively applying the definition of the tensor 446 product on two crystals. Recall that `\langle \alpha_i^{\vee}, 447 \mathrm{wt}(b_j) \rangle = \varphi_i(b_j) - \varepsilon_i(b_j)` by the 448 definition of a crystal. 449 450 .. RUBRIC:: Regular crystals 451 452 Now if all crystals `B_k` are regular crystals, all `\varepsilon_i` and 453 `\varphi_i` are non-negative and we can 454 define tensor product by the *signature rule*. We start by writing a word 455 in `+` and `-` as follows: 456 457 .. MATH:: 458 459 \underbrace{- \cdots -}_{\varphi_i(b_N) \text{ times}} \quad 460 \underbrace{+ \cdots +}_{\varepsilon_i(b_N) \text{ times}} 461 \quad \cdots \quad 462 \underbrace{- \cdots -}_{\varphi_i(b_1) \text{ times}} \quad 463 \underbrace{+ \cdots +}_{\varepsilon_i(b_1) \text{ times}}, 464 465 and then canceling ordered pairs of `+-` until the word is in the reduced 466 form: 467 468 .. MATH:: 469 470 \underbrace{- \cdots -}_{\varphi_i \text{ times}} \quad 471 \underbrace{+ \cdots +}_{\varepsilon_i \text{ times}}. 472 473 Here `e_i` acts on the factor corresponding to the leftmost `+` and `f_i` 474 on the factor corresponding to the rightmost `-`. If there is no `+` or 475 `-` respectively, then the result is `0` (``None``). 476 477 EXAMPLES: 478 479 We construct the type `A_2`-crystal generated by `2 \otimes 1 \otimes 1`:: 480 481 sage: C = CrystalOfLetters(['A',2]) 482 sage: T = TensorProductOfCrystals(C,C,C,generators=[[C(2),C(1),C(1)]]) 483 484 It has `8` elements:: 485 486 sage: T.list() 487 [[2, 1, 1], [2, 1, 2], [2, 1, 3], [3, 1, 3], [3, 2, 3], [3, 1, 1], [3, 1, 2], [3, 2, 2]] 488 489 One can also check the Cartan type of the crystal:: 490 491 sage: T.cartan_type() 492 ['A', 2] 493 494 Other examples include crystals of tableaux (which internally are 495 represented as tensor products obtained by reading the tableaux 496 columnwise):: 497 498 sage: C = CrystalOfTableaux(['A',3], shape=[1,1,0]) 499 sage: D = CrystalOfTableaux(['A',3], shape=[1,0,0]) 500 sage: T = TensorProductOfCrystals(C,D, generators=[[C(rows=[[1], [2]]), D(rows=[[1]])], [C(rows=[[2], [3]]), D(rows=[[1]])]]) 501 sage: T.cardinality() 502 24 503 sage: TestSuite(T).run() 504 sage: T.module_generators 505 [[[[1], [2]], [[1]]], [[[2], [3]], [[1]]]] 506 sage: [x.weight() for x in T.module_generators] 507 [(2, 1, 0, 0), (1, 1, 1, 0)] 508 509 If no module generators are specified, we obtain the full tensor 510 product:: 511 512 sage: C = CrystalOfLetters(['A',2]) 513 sage: T = TensorProductOfCrystals(C,C) 514 sage: T.list() 515 [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]] 516 sage: T.cardinality() 517 9 518 519 For a tensor product of crystals without module generators, the 520 default implementation of ``module_generators`` contains all elements 521 in the tensor product of the crystals. If there is a subset of 522 elements in the tensor product that still generates the crystal, 523 this needs to be implemented for the specific crystal separately:: 524 525 sage: T.module_generators.list() 526 [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]] 527 528 For classical highest weight crystals, it is also possible to list 529 all highest weight elements:: 530 531 sage: C = CrystalOfLetters(['A',2]) 532 sage: T = TensorProductOfCrystals(C,C,C,generators=[[C(2),C(1),C(1)],[C(1),C(2),C(1)]]) 533 sage: T.highest_weight_vectors() 534 [[2, 1, 1], [1, 2, 1]] 535 536 Examples with non-regular and infinite crystals (these did not work 537 before :trac:`14402`):: 538 539 sage: B = InfinityCrystalOfTableaux(['D',10]) 540 sage: T = TensorProductOfCrystals(B,B) 541 sage: T 542 Full tensor product of the crystals 543 [The infinity crystal of tableaux of type ['D', 10], 544 The infinity crystal of tableaux of type ['D', 10]] 545 546 sage: B = CrystalOfGeneralizedYoungWalls(15) 547 sage: T = TensorProductOfCrystals(B,B,B) 548 sage: T 549 Full tensor product of the crystals 550 [Crystal of generalized Young walls of type ['A', 15, 1], 551 Crystal of generalized Young walls of type ['A', 15, 1], 552 Crystal of generalized Young walls of type ['A', 15, 1]] 553 554 sage: La = RootSystem(['A',2,1]).weight_lattice().fundamental_weights() 555 sage: B = HighestWeightCrystalOfGYW(2,La[0]+La[1]) 556 sage: C = HighestWeightCrystalOfGYW(2,2*La[2]) 557 sage: D = HighestWeightCrystalOfGYW(2,3*La[0]+La[2]) 558 sage: T = TensorProductOfCrystals(B,C,D) 559 sage: T 560 Full tensor product of the crystals 561 [Highest weight crystal of generalized Young walls of Cartan type ['A', 2, 1] and highest weight Lambda[0] + Lambda[1]., 562 Highest weight crystal of generalized Young walls of Cartan type ['A', 2, 1] and highest weight 2*Lambda[2]., 563 Highest weight crystal of generalized Young walls of Cartan type ['A', 2, 1] and highest weight 3*Lambda[0] + Lambda[2].] 564 565 There is also a global option for setting the convention (by default Sage 566 uses anti-Kashiwara):: 567 568 sage: C = CrystalOfLetters(['A',2]) 569 sage: T = TensorProductOfCrystals(C,C) 570 sage: elt = T(C(1), C(2)); elt 571 [1, 2] 572 sage: TensorProductOfCrystals.global_options['convention'] = "Kashiwara" 573 sage: elt 574 [2, 1] 575 sage: TensorProductOfCrystals.global_options.reset() 576 """ 577 @staticmethod 578 def __classcall_private__(cls, *crystals, **options): 579 """ 580 Create the correct parent object. 581 582 EXAMPLES:: 583 584 sage: C = CrystalOfLetters(['A',2]) 585 sage: T = TensorProductOfCrystals(C, C) 586 sage: T2 = TensorProductOfCrystals(C, C) 587 sage: T is T2 588 True 589 sage: B = InfinityCrystalOfTableaux(['A',2]) 590 sage: T = TensorProductOfCrystals(B, B) 591 """ 592 crystals = tuple(crystals) 593 if "cartan_type" in options: 594 cartan_type = CartanType(options["cartan_type"]) 595 else: 596 if len(crystals) == 0: 597 raise ValueError("you need to specify the Cartan type if the tensor product list is empty") 598 else: 599 cartan_type = crystals[0].cartan_type() 600 601 if "generators" in options: 602 generators = tuple(tuple(x) if isinstance(x, list) else x for x in options["generators"]) 603 604 if all(c in RegularCrystals() for c in crystals): 605 return TensorProductOfRegularCrystalsWithGenerators(crystals, generators, cartan_type) 606 return TensorProductOfCrystalsWithGenerators(crystals, generators, cartan_type) 607 608 if all(c in RegularCrystals() for c in crystals): 609 return FullTensorProductOfRegularCrystals(crystals, cartan_type=cartan_type) 610 return FullTensorProductOfCrystals(crystals, cartan_type=cartan_type) 611 612 global_options = TensorProductOfCrystalsOptions 613 614 def _element_constructor_(self, *crystalElements): 615 """ 616 EXAMPLES:: 617 618 sage: C = CrystalOfLetters(['A',2]) 619 sage: T = TensorProductOfCrystals(C,C) 620 sage: T(1,1) 621 [1, 1] 622 sage: _.parent() 623 Full tensor product of the crystals [The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2]] 624 sage: T = TensorProductOfCrystals(C,C,C,generators=[[C(2),C(1),C(1)]]) 625 sage: T(C(2), C(1), C(1)) 626 [2, 1, 1] 627 """ 628 if self.global_options['convention'] == "Kashiwara": 629 crystalElements = reversed(crystalElements) 630 return self.element_class(self, list(crystalElements)) 631 632 class TensorProductOfCrystalsWithGenerators(TensorProductOfCrystals): 633 """ 634 Tensor product of crystals with a generating set. 635 """ 399 636 def __init__(self, crystals, generators, cartan_type): 400 637 """ 401 638 EXAMPLES:: … … class TensorProductOfCrystalsWithGenerat 408 645 assert isinstance(generators, tuple) 409 646 category = Category.meet([crystal.category() for crystal in crystals]) 410 647 Parent.__init__(self, category = category) 411 self.rename("The tensor product of the crystals %s"%(crystals,))412 648 self.crystals = crystals 413 649 self._cartan_type = cartan_type 414 650 self.module_generators = [ self(*x) for x in generators ] 415 651 652 def _repr_(self): 653 """ 654 Return a string representation of ``self``. 416 655 417 class FullTensorProductOfCrystals(CrystalOfWords): 656 EXAMPLES:: 657 658 sage: C = CrystalOfLetters(['A',2]) 659 sage: TensorProductOfCrystals(C,C,generators=[[C(2),C(1)]]) 660 The tensor product of the crystals [The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2]] 661 """ 662 if self.global_options['convention'] == "Kashiwara": 663 st = repr(list(reversed(self.crystals))) 664 else: 665 st = repr(list(self.crystals)) 666 return "The tensor product of the crystals %s"%st 667 668 class FullTensorProductOfCrystals(TensorProductOfCrystals): 669 """ 670 Full tensor product of crystals. 671 """ 418 672 def __init__(self, crystals, **options): 419 673 """ 420 674 TESTS:: … … class FullTensorProductOfCrystals(Crysta 429 683 crystals = list(crystals) 430 684 category = Category.meet([crystal.category() for crystal in crystals]) 431 685 Parent.__init__(self, category = category) 432 self.rename("Full tensor product of the crystals %s"%(crystals,))433 686 self.crystals = crystals 434 687 if options.has_key('cartan_type'): 435 688 self._cartan_type = CartanType(options['cartan_type']) … … class FullTensorProductOfCrystals(Crysta 441 694 self.cartesian_product = CartesianProduct(*self.crystals) 442 695 self.module_generators = self 443 696 697 def _repr_(self): 698 """ 699 Return a string representation of ``self``. 700 701 EXAMPLES:: 702 703 sage: C = CrystalOfLetters(['A',2]) 704 sage: TensorProductOfCrystals(C,C) 705 Full tensor product of the crystals [The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2]] 706 """ 707 if self.global_options['convention'] == "Kashiwara": 708 st = repr(reversed(self.crystals)) 709 else: 710 st = repr(self.crystals) 711 return "Full tensor product of the crystals %s"%st 712 444 713 # TODO: __iter__ and cardinality should be inherited from EnumeratedSets().CartesianProducts() 445 714 def __iter__(self): 446 715 """ … … class FullTensorProductOfCrystals(Crysta 460 729 461 730 def cardinality(self): 462 731 """ 732 Return the cardinality of ``self``. 733 463 734 EXAMPLES:: 464 735 465 736 sage: C = CrystalOfLetters(['A',2]) … … class FullTensorProductOfCrystals(Crysta 469 740 """ 470 741 return self.cartesian_product.cardinality() 471 742 472 473 474 743 class TensorProductOfCrystalsElement(ImmutableListWithParent): 475 744 r""" 476 A class for elements of tensor products of crystals 745 A class for elements of tensor products of crystals. 477 746 """ 747 def _repr_(self): 748 """ 749 Return a string representation of ``self``. 750 751 EXAMPLES:: 752 753 sage: C = CrystalOfLetters(['A',3]) 754 sage: T = TensorProductOfCrystals(C,C) 755 sage: T(C(1),C(2)) 756 [1, 2] 757 """ 758 if self.parent().global_options['convention'] == "Kashiwara": 759 return repr(list(reversed(self._list))) 760 return repr(self._list) 761 762 def _latex_(self): 763 r""" 764 Return latex code for ``self``. 765 766 EXAMPLES:: 767 768 sage: C = CrystalOfLetters(["A",2]) 769 sage: D = CrystalOfTableaux(["A",2], shape=[2]) 770 sage: E = TensorProductOfCrystals(C,D) 771 sage: latex(E.module_generators[0]) 772 1 \otimes {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} 773 \raisebox{-.6ex}{$\begin{array}[b]{*{2}c}\cline{1-2} 774 \lr{1}&\lr{1}\\\cline{1-2} 775 \end{array}$} 776 } 777 """ 778 return ' \otimes '.join(latex(c) for c in self) 478 779 479 780 def __lt__(self, other): 480 781 """ 481 782 Non elements of the crystal are incomparable with elements of the crystal 482 (or should it return NotImplemented?) 783 (or should it return NotImplemented?). 483 784 484 785 Comparison of two elements of this crystal: 485 - different length: incomparable 486 - otherwise lexicographicaly, considering self[i] and other[i] 487 as incomparable if self[i] < other[i] returns NotImplemented 786 787 - different length: incomparable 788 - otherwise lexicographicaly, considering ``self[i]`` and ``other[i]`` 789 as incomparable if ``self[i] < other[i]`` returns NotImplemented 488 790 """ 489 791 if parent(self) is not parent(other): 490 792 return False … … class TensorProductOfCrystalsElement(Imm 497 799 return False 498 800 return False 499 801 802 def weight(self): 803 r""" 804 Return the weight of ``self``. 805 806 EXAMPLES:: 807 808 sage: B = InfinityCrystalOfTableaux("A3") 809 sage: T = TensorProductOfCrystals(B,B) 810 sage: b1 = B.highest_weight_vector().f_string([2,1,3]) 811 sage: b2 = B.highest_weight_vector().f(1) 812 sage: t = T(b2, b1) 813 sage: t 814 [[[1, 1, 1, 2], [2, 2], [3]], [[1, 1, 1, 1, 2], [2, 2, 4], [3]]] 815 sage: t.weight() 816 -2*alpha[1] - alpha[2] - alpha[3] 817 """ 818 return sum(self[i].weight() for i in range(len(self))) 819 820 def epsilon(self, i): 821 r""" 822 Return `\varepsilon_i` of ``self``. 823 824 INPUT: 825 826 - ``i`` -- An element of the index set 827 828 EXAMPLES:: 829 830 sage: B = InfinityCrystalOfTableaux("G2") 831 sage: T = TensorProductOfCrystals(B,B) 832 sage: b1 = B.highest_weight_vector().f(2) 833 sage: b2 = B.highest_weight_vector().f_string([2,2,1]) 834 sage: t = T(b2, b1) 835 sage: [t.epsilon(i) for i in B.index_set()] 836 [0, 3] 837 """ 838 return max(self._sig(i, k) for k in range(1, len(self)+1)) 839 840 def phi(self, i): 841 r""" 842 Return `\varphi_i` of ``self``. 843 844 INPUT: 845 846 - ``i`` -- An element of the index set 847 848 EXAMPLES:: 849 850 sage: La = RootSystem(['A',2,1]).weight_lattice().fundamental_weights() 851 sage: B = HighestWeightCrystalOfGYW(2,La[0]+La[1]) 852 sage: T = TensorProductOfCrystals(B,B) 853 sage: b1 = B.highest_weight_vector().f_string([1,0]) 854 sage: b2 = B.highest_weight_vector().f_string([0,1]) 855 sage: t = T(b2, b1) 856 sage: [t.phi(i) for i in B.index_set()] 857 [1, 1, 4] 858 """ 859 P = self[-1].parent().weight_lattice_realization() 860 h = P.simple_coroots() 861 omega = P(self.weight()).scalar(h[i]) 862 return max([omega + self._sig(i, k) for k in range(len(self))]) 863 864 @cached_in_parent_method 865 def _sig(self,i,k): 866 r""" 867 Return `a_i(k)` of ``self``. 868 869 The value `a_i(k)` of a crystal `b = b_N \otimes \cdots \otimes b_1` 870 is defined as: 871 872 .. MATH:: 873 874 a_i(k) = \varepsilon_i(b_k) - \sum_{j=1}^{k-1} \langle h_i, 875 \mathrm{wt}(b_j) \rangle 876 877 where `\mathrm{wt}` is the :meth:`weight` of `b_j`. 878 879 INPUT: 880 881 - ``i`` -- An element of the index set 882 883 - ``k`` -- The (1-based) index of the tensor factor of ``self`` 884 885 EXAMPLES:: 886 887 sage: B = CrystalOfGeneralizedYoungWalls(3) 888 sage: T = TensorProductOfCrystals(B,B) 889 sage: b1 = B.highest_weight_vector().f_string([0,3,1]) 890 sage: b2 = B.highest_weight_vector().f_string([3,2,1,0,2,3]) 891 sage: t = T(b1, b2) 892 sage: [[t._sig(i,k) for k in range(1,len(t)+1)] for i in B.index_set()] 893 [[0, -1], [0, 0], [0, 1], [1, 2]] 894 """ 895 if k == 1: 896 return self[-1].epsilon(i) 897 return self._sig(i, k-1) + self[-k].epsilon(i) - self[-k+1].phi(i) 898 899 def e(self,i): 900 r""" 901 Return the action of `e_i` on ``self``. 902 903 INPUT: 904 905 - ``i`` -- An element of the index set 906 907 EXAMPLES:: 908 909 sage: B = InfinityCrystalOfTableaux("D4") 910 sage: T = TensorProductOfCrystals(B,B) 911 sage: b1 = B.highest_weight_vector().f_string([1,4,3]) 912 sage: b2 = B.highest_weight_vector().f_string([2,2,3,1,4]) 913 sage: t = T(b2, b1) 914 sage: t.e(1) 915 [[[1, 1, 1, 1, 1], [2, 2, 3, -3], [3]], [[1, 1, 1, 1, 2], [2, 2, 2], [3, -3]]] 916 sage: t.e(2) 917 sage: t.e(3) 918 [[[1, 1, 1, 1, 1, 2], [2, 2, 3, -4], [3]], [[1, 1, 1, 1, 2], [2, 2, 2], [3, -3]]] 919 sage: t.e(4) 920 [[[1, 1, 1, 1, 1, 2], [2, 2, 3, 4], [3]], [[1, 1, 1, 1, 2], [2, 2, 2], [3, -3]]] 921 """ 922 N = len(self) + 1 923 for k in range(1, N): 924 if all(self._sig(i,k) > self._sig(i,j) for j in range(1, k)) and \ 925 all(self._sig(i,k) >= self._sig(i,j) for j in range(k+1, N)): 926 crystal = self[-k].e(i) 927 if crystal is None: 928 return None 929 return self.set_index(-k, crystal) 930 return None 931 932 def f(self,i): 933 r""" 934 Return the action of `f_i` on ``self``. 935 936 INPUT: 937 938 - ``i`` -- An element of the index set 939 940 EXAMPLES:: 941 942 sage: La = RootSystem(['A',3,1]).weight_lattice().fundamental_weights() 943 sage: B = HighestWeightCrystalOfGYW(3,La[0]) 944 sage: T = TensorProductOfCrystals(B,B,B) 945 sage: b1 = B.highest_weight_vector().f_string([0,3]) 946 sage: b2 = B.highest_weight_vector().f_string([0]) 947 sage: b3 = B.highest_weight_vector() 948 sage: t = T(b3, b2, b1) 949 sage: t.f(0) 950 [[[0]], [[0]], [[0, 3]]] 951 sage: t.f(1) 952 [[], [[0]], [[0, 3], [1]]] 953 sage: t.f(2) 954 [[], [[0]], [[0, 3, 2]]] 955 sage: t.f(3) 956 [[], [[0, 3]], [[0, 3]]] 957 """ 958 N = len(self) + 1 959 for k in range(1, N): 960 if all(self._sig(i,k) >= self._sig(i,j) for j in range(1, k)) and \ 961 all(self._sig(i,k) > self._sig(i,j) for j in range(k+1, N)): 962 crystal = self[-k].f(i) 963 if crystal is None: 964 return None 965 return self.set_index(-k, crystal) 966 return None 967 968 class TensorProductOfRegularCrystalsElement(TensorProductOfCrystalsElement): 969 """ 970 Element class for a tensor product of regular crystals. 971 972 TESTS:: 973 974 sage: C = CrystalOfLetters(['A',2]) 975 sage: T = TensorProductOfCrystals(C, C) 976 sage: elt = T(C(1), C(2)) 977 sage: from sage.combinat.crystals.tensor_product import TensorProductOfRegularCrystalsElement 978 sage: isinstance(elt, TensorProductOfRegularCrystalsElement) 979 True 980 """ 500 981 def e(self, i): 501 982 """ 502 Return s the action of `e_i` on self.983 Return the action of `e_i` on ``self``. 503 984 504 985 EXAMPLES:: 505 986 … … class TensorProductOfCrystalsElement(Imm 512 993 sage: T(C(2),C(2)).e(1) == T(C(1),C(2)) 513 994 True 514 995 """ 515 assert i in self.index_set() 996 if i not in self.index_set(): 997 raise ValueError("i must be in the index set") 516 998 position = self.positions_of_unmatched_plus(i) 517 999 if position == []: 518 1000 return None … … class TensorProductOfCrystalsElement(Imm 521 1003 522 1004 def weight(self): 523 1005 """ 524 Return s the weight of self.1006 Return the weight of ``self``. 525 1007 526 1008 EXAMPLES:: 527 1009 … … class TensorProductOfCrystalsElement(Imm 537 1019 538 1020 def f(self, i): 539 1021 """ 540 Return s the action of `f_i` on self.1022 Return the action of `f_i` on ``self``. 541 1023 542 1024 EXAMPLES:: 543 1025 … … class TensorProductOfCrystalsElement(Imm 550 1032 sage: T(C(2),C(1)).f(1) is None 551 1033 True 552 1034 """ 553 assert i in self.index_set() 1035 if i not in self.index_set(): 1036 raise ValueError("i must be in the index set") 554 1037 position = self.positions_of_unmatched_minus(i) 555 1038 if position == []: 556 1039 return None … … class TensorProductOfCrystalsElement(Imm 558 1041 return self.set_index(k, self[k].f(i)) 559 1042 560 1043 def phi(self, i): 561 """ 1044 r""" 1045 Return `\varphi_i` of ``self``. 1046 562 1047 EXAMPLES:: 563 1048 564 1049 sage: C = CrystalOfLetters(['A',5]) … … class TensorProductOfCrystalsElement(Imm 582 1067 return height 583 1068 584 1069 def epsilon(self, i): 585 """ 1070 r""" 1071 Return `\varepsilon_i` of ``self``. 1072 586 1073 EXAMPLES:: 587 1074 588 1075 sage: C = CrystalOfLetters(['A',5]) … … class TensorProductOfCrystalsElement(Imm 654 1141 l.reverse() 655 1142 return [len(self)-1-l[j] for j in range(len(l))] 656 1143 657 def _latex_(self):658 """659 Returns latex code for self.660 661 EXAMPLES::662 663 sage: C = CrystalOfLetters(["A",2])664 sage: D = CrystalOfTableaux(["A",2], shape=[2])665 sage: E = TensorProductOfCrystals(C,D)666 sage: print E.module_generators[0]._latex_()667 1\otimes{\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}668 \raisebox{-.6ex}{$\begin{array}[b]{*{2}c}\cline{1-2}669 \lr{1}&\lr{1}\\\cline{1-2}670 \end{array}$}671 }672 """673 return '\otimes'.join(latex(c) for c in self)674 675 1144 def energy_function(self): 676 1145 r""" 677 Return s the energy function of `self`.1146 Return the energy function of ``self``. 678 1147 679 1148 INPUT: 680 1149 … … class TensorProductOfCrystalsElement(Imm 688 1157 689 1158 REFERENCES: 690 1159 691 .. [SchillingTingley2011] A. Schilling, P. Tingley. 692 Demazure crystals, Kirillov-Reshetikhin crystals, and the energy function. 693 preprint arXiv:1104.2359 1160 .. [SchillingTingley2011] A. Schilling, P. Tingley. 1161 Demazure crystals, Kirillov-Reshetikhin crystals, and the energy 1162 function. Electronic Journal of Combinatorics. **19(2)**. 2012. 1163 :arXiv:`1104.2359` 694 1164 695 1165 EXAMPLES:: 696 1166 … … class TensorProductOfCrystalsElement(Imm 727 1197 sage: t.energy_function() 728 1198 Traceback (most recent call last): 729 1199 ... 730 AssertionError: All crystals in the tensor product need to be perfect of the same level1200 ValueError: All crystals in the tensor product need to be perfect of the same level 731 1201 """ 732 1202 C = self.parent().crystals[0] 733 1203 ell = ceil(C.s()/C.cartan_type().c()[C.r()]) 734 assert all(ell == K.s()/K.cartan_type().c()[K.r()] for K in self.parent().crystals), \735 "All crystals in the tensor product need to be perfect of the same level"1204 if any(ell != K.s()/K.cartan_type().c()[K.r()] for K in self.parent().crystals): 1205 raise ValueError("All crystals in the tensor product need to be perfect of the same level") 736 1206 t = self.parent()(*[K.module_generator() for K in self.parent().crystals]) 737 1207 d = t.affine_grading() 738 1208 return d - self.affine_grading() … … class TensorProductOfCrystalsElement(Imm 823 1293 sage: y.e_string_to_ground_state() 824 1294 () 825 1295 """ 826 assert self.parent().crystals[0].__module__ == 'sage.combinat.crystals.kirillov_reshetikhin', \827 "All crystals in the tensor product need to be Kirillov-Reshetikhin crystals"1296 if self.parent().crystals[0].__module__ != 'sage.combinat.crystals.kirillov_reshetikhin': 1297 raise ValueError("All crystals in the tensor product need to be Kirillov-Reshetikhin crystals") 828 1298 I = self.index_set() 829 1299 I.remove(0) 830 1300 ell = max(ceil(K.s()/K.cartan_type().c()[K.r()]) for K in self.parent().crystals) … … class TensorProductOfCrystalsElement(Imm 837 1307 838 1308 CrystalOfWords.Element = TensorProductOfCrystalsElement 839 1309 1310 class FullTensorProductOfRegularCrystals(FullTensorProductOfCrystals): 1311 """ 1312 Full tensor product of regular crystals. 1313 """ 1314 Element = TensorProductOfRegularCrystalsElement 1315 1316 class TensorProductOfRegularCrystalsWithGenerators(TensorProductOfCrystalsWithGenerators): 1317 """ 1318 Tensor product of regular crystals with a generating set. 1319 """ 1320 Element = TensorProductOfRegularCrystalsElement 1321 1322 ######################################################### 1323 ## Crystal of tableaux 840 1324 841 1325 class CrystalOfTableaux(CrystalOfWords): 842 1326 r""" … … class CrystalOfTableaux(CrystalOfWords): 844 1328 845 1329 INPUT: 846 1330 847 848 849 1331 - ``cartan_type`` -- a Cartan type 1332 - ``shape`` -- a partition of length at most ``cartan_type.rank()`` 1333 - ``shapes`` -- a list of such partitions 850 1334 851 1335 This constructs a classical crystal with the given Cartan type and 852 1336 highest weight(s) corresponding to the given shape(s). 853 1337 854 1338 If the type is `D_r`, the shape is permitted to have a negative 855 value in the `r`-th position. Thus if shape=`[s_1,\dots,s_r]` then856 `s_r` may be negative but in any case `s_1 \ge \cdots \ges_{r-1}857 \ge |s_r|`. This crystal is related to that of shape858 `[s_1,\ dots,|s_r|]` by the outer automorphism of `SO(2r)`.1339 value in the `r`-th position. Thus if the shape equals `[s_1,\ldots,s_r]`, 1340 then `s_r` may be negative but in any case `s_1 \geq \cdots \geq s_{r-1} 1341 \geq |s_r|`. This crystal is related to that of shape 1342 `[s_1,\ldots,|s_r|]` by the outer automorphism of `SO(2r)`. 859 1343 860 1344 If the type is `D_r` or `B_r`, the shape is permitted to be of 861 1345 length `r` with all parts of half integer value. This corresponds … … class CrystalOfTableaux(CrystalOfWords): 864 1348 have this property. 865 1349 866 1350 Crystals of tableaux are constructed using an embedding into 867 tensor products following Kashiwara and Nakashima [Kashiwara, 868 Masaki; Nakashima, Toshiki, *Crystal graphs for representations of 869 the q-analogue of classical Lie algebras*, J. Algebra 165 (1994), 870 no. 2, 295-345.]. Sage's tensor product rule for crystals differs 871 from that of Kashiwara and Nakashima by reversing the order of the 872 tensor factors. Sage produces the same crystals of tableaux as 873 Kashiwara and Nakashima. With Sage's convention, the tensor 874 product of crystals is the same as the monoid operation on 1351 tensor products following Kashiwara and Nakashima [KN94]_. Sage's tensor 1352 product rule for crystals differs from that of Kashiwara and Nakashima 1353 by reversing the order of the tensor factors. Sage produces the same 1354 crystals of tableaux as Kashiwara and Nakashima. With Sage's convention, 1355 the tensor product of crystals is the same as the monoid operation on 875 1356 tableaux and hence the plactic monoid. 876 1357 877 .. seealso:: :mod:`sage.combinat.crystals.crystals` for general help on 878 crystals, and in particular plotting and LaTeX output. 1358 .. SEEALSO:: 1359 1360 :mod:`sage.combinat.crystals.crystals` for general help on 1361 crystals, and in particular plotting and `\LaTeX` output. 879 1362 880 1363 EXAMPLES: 881 1364 882 1365 We create the crystal of tableaux for type `A_2`, with 883 highest weight given by the partition [2,1,1]::1366 highest weight given by the partition `[2,1,1]`:: 884 1367 885 1368 sage: T = CrystalOfTableaux(['A',3], shape = [2,1,1]) 886 1369 … … class CrystalOfTableaux(CrystalOfWords): 912 1395 sage: Tab(columns=[[3,1],[4,2]]) 913 1396 [[1, 2], [3, 4]] 914 1397 915 FIXME:1398 .. TODO:: 916 1399 917 - do we want to specify the columns increasingly or 918 decreasingly. That is, should this be Tab(columns = [[1,3],[2,4]]) 919 - make this fully consistent with :func:`~sage.combinat.tableau.Tableau`! 1400 FIXME: 1401 1402 - Do we want to specify the columns increasingly or 1403 decreasingly? That is, should this be 1404 ``Tab(columns = [[1,3],[2,4]])``? 1405 - Make this fully consistent with 1406 :func:`~sage.combinat.tableau.Tableau`! 920 1407 921 1408 We illustrate the use of a shape with a negative last entry in 922 1409 type `D`:: … … class CrystalOfTableaux(CrystalOfWords): 1031 1518 # integer partitions of length the rank for type B and D. In 1032 1519 # particular, for type D, the spins all have to be plus or all 1033 1520 # minus spins 1034 assert all(len(sh) == n for sh in shapes), \1035 "the length of all half-integer partition shapes should be the rank"1036 assert all(2*i % 2 == 1 for shape in spin_shapes for i in shape), \1037 "shapes should be either all partitions or all half-integer partitions"1521 if any(len(sh) != n for sh in shapes): 1522 raise ValueError("the length of all half-integer partition shapes should be the rank") 1523 if any(2*i % 2 != 1 for shape in spin_shapes for i in shape): 1524 raise ValueError("shapes should be either all partitions or all half-integer partitions") 1038 1525 if cartan_type.type() == 'D': 1039 1526 if all( i >= 0 for shape in spin_shapes for i in shape): 1040 1527 S = CrystalOfSpinsPlus(cartan_type) 1041 1528 elif all(shape[-1]<0 for shape in spin_shapes): 1042 1529 S = CrystalOfSpinsMinus(cartan_type) 1043 1530 else: 1044 raise ValueError , "In type D spins should all be positive or negative"1531 raise ValueError("In type D spins should all be positive or negative") 1045 1532 else: 1046 assert all( i >= 0 for shape in spin_shapes for i in shape), \1047 "shapes should all be partitions"1533 if any( i < 0 for shape in spin_shapes for i in shape): 1534 raise ValueError("shapes should all be partitions") 1048 1535 S = CrystalOfSpins(cartan_type) 1049 1536 B = CrystalOfTableaux(cartan_type, shapes = shapes) 1050 1537 T = TensorProductOfCrystals(S,B, generators=[[S.module_generators[0],x] for x in B.module_generators]) … … class CrystalOfTableaux(CrystalOfWords): 1058 1545 Construct the crystal of all tableaux of the given shapes 1059 1546 1060 1547 INPUT: 1061 - ``cartan_type`` - (data coercible into) a cartan type 1062 - ``shapes`` - a list (or iterable) of shapes 1063 - ``shape` ` - a shape 1548 1549 - ``cartan_type`` - (data coercible into) a cartan type 1550 - ``shapes`` - a list (or iterable) of shapes 1551 - ``shape` ` - a shape 1064 1552 1065 1553 shapes themselves are lists (or iterable) of integers 1066 1554 … … class CrystalOfTableaux(CrystalOfWords): 1141 1629 1142 1630 1143 1631 1144 class CrystalOfTableauxElement(TensorProductOfCrystalsElement): 1632 class CrystalOfTableauxElement(TensorProductOfRegularCrystalsElement): 1633 """ 1634 Element in a crystal of tableaux. 1635 """ 1145 1636 def __init__(self, parent, *args, **options): 1146 1637 """ 1147 1638 There are several ways to input tableaux, by rows, … … class CrystalOfTableauxElement(TensorPro 1217 1708 list+=col 1218 1709 else: 1219 1710 list = [i for i in args] 1220 TensorProductOf CrystalsElement.__init__(self, parent, map(parent.letters, list))1711 TensorProductOfRegularCrystalsElement.__init__(self, parent, map(parent.letters, list)) 1221 1712 1222 1713 def _repr_(self): 1223 1714 """ -
sage/combinat/rigged_configurations/kr_tableaux.py
diff --git a/sage/combinat/rigged_configurations/kr_tableaux.py b/sage/combinat/rigged_configurations/kr_tableaux.py
a b from sage.rings.integer import Integer 49 49 from sage.combinat.crystals.letters import CrystalOfLetters 50 50 from sage.combinat.root_system.cartan_type import CartanType 51 51 from sage.combinat.crystals.tensor_product import CrystalOfWords 52 from sage.combinat.crystals.tensor_product import TensorProductOf CrystalsElement52 from sage.combinat.crystals.tensor_product import TensorProductOfRegularCrystalsElement 53 53 from sage.combinat.crystals.kirillov_reshetikhin import horizontal_dominoes_removed, \ 54 54 KirillovReshetikhinCrystal, KirillovReshetikhinGenericCrystalElement 55 55 from sage.combinat.partition import Partition … … class KRTableauxSpin(KRTableauxRectangle 477 477 # shapes = [Partition(map(lambda x: Integer(x*2), shape)).conjugate() for shape in shapes] 478 478 # self.module_generators = tuple(self._fill(Partition(shape).conjugate()) for shape in shapes) 479 479 480 class KirillovReshetikhinTableauxElement(TensorProductOf CrystalsElement):480 class KirillovReshetikhinTableauxElement(TensorProductOfRegularCrystalsElement): 481 481 r""" 482 482 A Kirillov-Reshetikhin tableau. 483 483 … … class KirillovReshetikhinTableauxElement 499 499 # Make sure we are a list of letters 500 500 if list != [] and type(list[0]) is not CrystalOfLetters: 501 501 list = [parent.letters(x) for x in list] 502 TensorProductOf CrystalsElement.__init__(self, parent, list)502 TensorProductOfRegularCrystalsElement.__init__(self, parent, list) 503 503 504 504 def _repr_(self): 505 505 """ … … class KirillovReshetikhinTableauxElement 690 690 if ret is None: 691 691 return None 692 692 return ret.to_Kirillov_Reshetikhin_tableau() 693 return TensorProductOf CrystalsElement.e(self, i)693 return TensorProductOfRegularCrystalsElement.e(self, i) 694 694 695 695 def f(self, i): 696 696 """ … … class KirillovReshetikhinTableauxElement 711 711 if ret is None: 712 712 return None 713 713 return ret.to_Kirillov_Reshetikhin_tableau() 714 return TensorProductOf CrystalsElement.f(self, i)714 return TensorProductOfRegularCrystalsElement.f(self, i) 715 715 716 716 KirillovReshetikhinTableaux.Element = KirillovReshetikhinTableauxElement 717 717 … … class KRTableauxSpinElement(KirillovResh 733 733 [[1], [3], [-4], [-2]] 734 734 sage: KRT([-1, -4, 3, 2]).e(3) 735 735 """ 736 half = TensorProductOf CrystalsElement.e(self, i)736 half = TensorProductOfRegularCrystalsElement.e(self, i) 737 737 if half is None: 738 738 return None 739 return TensorProductOf CrystalsElement.e(half, i)739 return TensorProductOfRegularCrystalsElement.e(half, i) 740 740 741 741 def f(self, i): 742 742 r""" … … class KRTableauxSpinElement(KirillovResh 749 749 sage: KRT([-1, -4, 3, 2]).f(3) 750 750 [[2], [4], [-3], [-1]] 751 751 """ 752 half = TensorProductOf CrystalsElement.f(self, i)752 half = TensorProductOfRegularCrystalsElement.f(self, i) 753 753 if half is None: 754 754 return None 755 755 756 return TensorProductOf CrystalsElement.f(half, i)756 return TensorProductOfRegularCrystalsElement.f(half, i) 757 757 758 758 def epsilon(self, i): 759 759 r""" … … class KRTableauxSpinElement(KirillovResh 767 767 sage: KRT([-1, -4, 3, 2]).epsilon(3) 768 768 0 769 769 """ 770 return TensorProductOf CrystalsElement.epsilon(self, i) / 2770 return TensorProductOfRegularCrystalsElement.epsilon(self, i) / 2 771 771 772 772 def phi(self, i): 773 773 r""" … … class KRTableauxSpinElement(KirillovResh 781 781 sage: KRT([-1, -4, 3, 2]).phi(3) 782 782 1 783 783 """ 784 return TensorProductOf CrystalsElement.phi(self, i) / 2784 return TensorProductOfRegularCrystalsElement.phi(self, i) / 2 785 785 786 786 @cached_method 787 787 def to_array(self, rows=True): -
sage/combinat/rigged_configurations/rigged_configurations.py
diff --git a/sage/combinat/rigged_configurations/rigged_configurations.py b/sage/combinat/rigged_configurations/rigged_configurations.py
a b class AbstractRiggedConfigurations(Uniqu 436 436 raise ValueError("Incorrect bijection image.") 437 437 return lst[0].to_rigged_configuration() 438 438 439 from sage.combinat.crystals.tensor_product import TensorProductOf CrystalsElement440 if isinstance(lst[0], TensorProductOf CrystalsElement):439 from sage.combinat.crystals.tensor_product import TensorProductOfRegularCrystalsElement 440 if isinstance(lst[0], TensorProductOfRegularCrystalsElement): 441 441 lst = lst[0] 442 442 from sage.combinat.crystals.kirillov_reshetikhin import KirillovReshetikhinGenericCrystalElement 443 443 if isinstance(lst[0], KirillovReshetikhinGenericCrystalElement): -
sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py
diff --git a/sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py b/sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py
a b Type `D_n^{(1)}` examples:: 67 67 from sage.misc.cachefunc import cached_method 68 68 from sage.misc.lazy_attribute import lazy_attribute 69 69 70 from sage.combinat.crystals.tensor_product import FullTensorProductOf Crystals70 from sage.combinat.crystals.tensor_product import FullTensorProductOfRegularCrystals 71 71 from sage.combinat.crystals.letters import CrystalOfLetters 72 72 from sage.combinat.root_system.cartan_type import CartanType 73 73 … … from sage.combinat.rigged_configurations 76 76 77 77 from sage.rings.integer import Integer 78 78 79 class AbstractTensorProductOfKRTableaux(FullTensorProductOf Crystals):79 class AbstractTensorProductOfKRTableaux(FullTensorProductOfRegularCrystals): 80 80 r""" 81 81 Abstract class for all of tensor product of KR tableaux of a given Cartan type. 82 82 … … class AbstractTensorProductOfKRTableaux( 115 115 tensorProd.append(KirillovReshetikhinTableaux( 116 116 self.letters.cartan_type(), 117 117 rectDims[0], rectDims[1])) 118 FullTensorProductOf Crystals.__init__(self, tuple(tensorProd))118 FullTensorProductOfRegularCrystals.__init__(self, tuple(tensorProd)) 119 119 120 120 def _highest_weight_iter(self): 121 121 r""" … … class AbstractTensorProductOfKRTableaux( 159 159 if isinstance(path[0], KirillovReshetikhinGenericCrystalElement): 160 160 return self.element_class(self, *[x.to_Kirillov_Reshetikhin_tableau() for x in path]) 161 161 162 from sage.combinat.crystals.tensor_product import TensorProductOf CrystalsElement163 if isinstance(path[0], TensorProductOf CrystalsElement) and \162 from sage.combinat.crystals.tensor_product import TensorProductOfRegularCrystalsElement 163 if isinstance(path[0], TensorProductOfRegularCrystalsElement) and \ 164 164 isinstance(path[0][0], KirillovReshetikhinGenericCrystalElement): 165 165 return self.element_class(self, *[x.to_Kirillov_Reshetikhin_tableau() for x in path[0]]) 166 166 … … class TensorProductOfKirillovReshetikhin 564 564 sage: T is KRT.tensor_product_of_Kirillov_Reshetikhin_crystals() 565 565 True 566 566 """ 567 return FullTensorProductOf Crystals(tuple(x.Kirillov_Reshetikhin_crystal() for x in self.crystals),567 return FullTensorProductOfRegularCrystals(tuple(x.Kirillov_Reshetikhin_crystal() for x in self.crystals), 568 568 cartan_type=self.affine_ct) 569 569 570 570 TensorProductOfKirillovReshetikhinTableaux.Element = TensorProductOfKirillovReshetikhinTableauxElement -
sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py
diff --git a/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py b/sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py
a b Type `D_n^{(1)}` examples:: 96 96 #***************************************************************************** 97 97 98 98 from sage.combinat.root_system.cartan_type import CartanType 99 from sage.combinat.crystals.tensor_product import TensorProductOf CrystalsElement99 from sage.combinat.crystals.tensor_product import TensorProductOfRegularCrystalsElement 100 100 from sage.combinat.rigged_configurations.bijection import KRTToRCBijection 101 101 102 class TensorProductOfKirillovReshetikhinTableauxElement(TensorProductOf CrystalsElement):102 class TensorProductOfKirillovReshetikhinTableauxElement(TensorProductOfRegularCrystalsElement): 103 103 """ 104 104 An element in a tensor product of Kirillov-Reshetikhin tableaux. 105 105 … … class TensorProductOfKirillovReshetikhin 134 134 135 135 if "pathlist" in options: 136 136 pathlist = options["pathlist"] 137 TensorProductOf CrystalsElement.__init__(self, parent,137 TensorProductOfRegularCrystalsElement.__init__(self, parent, 138 138 [parent.crystals[i](list(tab)) for i, tab in enumerate(pathlist)]) 139 139 elif "list" in options: 140 TensorProductOf CrystalsElement.__init__(self, parent, **options)140 TensorProductOfRegularCrystalsElement.__init__(self, parent, **options) 141 141 else: 142 TensorProductOf CrystalsElement.__init__(self, parent, list(path))142 TensorProductOfRegularCrystalsElement.__init__(self, parent, list(path)) 143 143 144 144 def _repr_(self): 145 145 """ … … class TensorProductOfKirillovReshetikhin 170 170 [[2], [4]] 171 171 """ 172 172 if i != 0: 173 return TensorProductOf CrystalsElement.e(self, i)173 return TensorProductOfRegularCrystalsElement.e(self, i) 174 174 175 175 return None 176 176 … … class TensorProductOfKirillovReshetikhin 187 187 [[-4], [4]] 188 188 """ 189 189 if i != 0: 190 return TensorProductOf CrystalsElement.f(self, i)190 return TensorProductOfRegularCrystalsElement.f(self, i) 191 191 192 192 return None 193 193 -
sage/doctest/sources.py
diff --git a/sage/doctest/sources.py b/sage/doctest/sources.py
a b class FileDocTestSource(DocTestSource): 674 674 ....: FDS._test_enough_doctests(verbose=False) 675 675 There are 18 tests in sage/combinat/partition.py that are not being run 676 676 There are 18 tests in sage/combinat/tableau.py that are not being run 677 There are 8 tests in sage/combinat/crystals/tensor_product.py that are not being run 677 678 There are 15 tests in sage/combinat/root_system/cartan_type.py that are not being run 678 679 There are 8 tests in sage/combinat/root_system/type_A.py that are not being run 679 680 There are 8 tests in sage/combinat/root_system/type_G.py that are not being run