Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*- r""" PBW Data
This contains helper classes and functions which encode PBW data in finite type.
AUTHORS:
- Dinakar Muthiah (2015-05): initial version - Travis Scrimshaw (2016-06): simplfied code and converted to Cython """
#***************************************************************************** # Copyright (C) 2015 Dinakar Muthiah <muthiah at ualberta.ca> # Travis Scrimshaw <tscrimsh at umn.edu> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # http://www.gnu.org/licenses/ #***************************************************************************** from __future__ import absolute_import
#from sage.misc.lazy_attribute import lazy_attribute from sage.misc.cachefunc import cached_method from sage.combinat.root_system.cartan_type import CartanType from sage.combinat.root_system.coxeter_group import CoxeterGroup from sage.combinat.root_system.root_system import RootSystem from sage.combinat.root_system.braid_move_calculator import BraidMoveCalculator
cimport cython
class PBWDatum(object): """ Helper class which represents a PBW datum. """ def __init__(self, parent, long_word, lusztig_datum): """ Initialize ``self``.
EXAMPLES::
sage: from sage.combinat.crystals.pbw_datum import PBWData, PBWDatum sage: P = PBWData("A2") sage: L = PBWDatum(P, (1,2,1), (1,4,7)) sage: TestSuite(L).run(skip="_test_pickling") """
def __repr__(self): """ Return a string representation of ``self``.
EXAMPLES::
sage: from sage.combinat.crystals.pbw_datum import PBWData, PBWDatum sage: P = PBWData("A2") sage: PBWDatum(P, (1,2,1), (1,4,7)) PBW Datum element of type ['A', 2] with long word (1, 2, 1) and Lusztig datum (1, 4, 7) """
def __eq__(self, other_PBWDatum): """ Check equality.
EXAMPLES::
sage: from sage.combinat.crystals.pbw_datum import PBWData, PBWDatum sage: P = PBWData("A2") sage: L1 = PBWDatum(P, (1,2,1), (1,4,7)) sage: L2 = PBWDatum(P, (1,2,1), (1,4,7)) sage: L1 == L2 True """
def is_equivalent_to(self, other_pbw_datum): r""" Return whether ``self`` is equivalent to ``other_pbw_datum``. modulo the tropical Plücker relations.
EXAMPLES::
sage: from sage.combinat.crystals.pbw_datum import PBWData, PBWDatum sage: P = PBWData("A2") sage: L1 = PBWDatum(P, (1,2,1), (1,0,1)) sage: L2 = PBWDatum(P, (2,1,2), (0,1,0)) sage: L1.is_equivalent_to(L2) True sage: L1 == L2 False """
def convert_to_long_word_with_first_letter(self, i): r""" Return a new PBWDatum equivalent to ``self`` whose long word begins with ``i``.
EXAMPLES::
sage: from sage.combinat.crystals.pbw_datum import PBWData, PBWDatum sage: P = PBWData("A3") sage: datum = PBWDatum(P, (1,2,1,3,2,1), (1,0,1,4,2,3)) sage: datum.convert_to_long_word_with_first_letter(1) PBW Datum element of type ['A', 3] with long word (1, 2, 3, 1, 2, 1) and Lusztig datum (1, 0, 4, 1, 2, 3) sage: datum.convert_to_long_word_with_first_letter(2) PBW Datum element of type ['A', 3] with long word (2, 1, 2, 3, 2, 1) and Lusztig datum (0, 1, 0, 4, 2, 3) sage: datum.convert_to_long_word_with_first_letter(3) PBW Datum element of type ['A', 3] with long word (3, 1, 2, 3, 1, 2) and Lusztig datum (8, 1, 0, 4, 1, 2) """
def convert_to_new_long_word(self, new_long_word): r""" Return a new PBWDatum equivalent to ``self`` whose long word is ``new_long_word``.
EXAMPLES::
sage: from sage.combinat.crystals.pbw_datum import PBWData, PBWDatum sage: P = PBWData("A2") sage: datum = PBWDatum(P, (1,2,1), (1,0,1)) sage: new_datum = datum.convert_to_new_long_word((2,1,2)) sage: new_datum.long_word (2, 1, 2) sage: new_datum.lusztig_datum (0, 1, 0) """
def weight(self): """ Return the weight of ``self``.
EXAMPLES::
sage: from sage.combinat.crystals.pbw_datum import PBWData, PBWDatum sage: P = PBWData("A2") sage: L = PBWDatum(P, (1,2,1), (1,1,1)) sage: L.weight() -2*alpha[1] - 2*alpha[2] """
def star(self): """ Return the starred version of ``self``, i.e., with reversed `long_word` and `lusztig_datum`
EXAMPLES::
sage: from sage.combinat.crystals.pbw_datum import PBWData, PBWDatum sage: P = PBWData("A2") sage: L1 = PBWDatum(P, (1,2,1), (1,2,3)) sage: L1.star() == PBWDatum(P, (2,1,2), (3,2,1)) True """
class PBWData(object): # UniqueRepresentation? """ Helper class for the set of PBW data. """ def __init__(self, cartan_type): """ Initialize ``self``.
EXAMPLES::
sage: from sage.combinat.crystals.pbw_datum import PBWData sage: P = PBWData(["A",2]) sage: TestSuite(P).run(skip="_test_pickling") """
def convert_to_new_long_word(self, pbw_datum, new_long_word): """ Convert the PBW datum ``pbw_datum`` from its long word to ``new_long_word``.
EXAMPLES::
sage: from sage.combinat.crystals.pbw_datum import PBWData, PBWDatum sage: P = PBWData("A2") sage: datum = PBWDatum(P, (1,2,1), (1,0,1)) sage: new_datum = P.convert_to_new_long_word(datum,(2,1,2)) sage: new_datum PBW Datum element of type ['A', 2] with long word (2, 1, 2) and Lusztig datum (0, 1, 0) sage: new_datum.long_word (2, 1, 2) sage: new_datum.lusztig_datum (0, 1, 0) """
@cached_method def _root_list_from(self, reduced_word): """ Return the list of positive roots in the order determined by ``reduced_word``.
.. WARNING::
No error checking is done to verify that ``reduced_word`` is reduced.
INPUT:
- ``reduced_word`` -- a tuple corresponding to a reduced word
EXAMPLES::
sage: from sage.combinat.crystals.pbw_datum import PBWData sage: P = PBWData(["A",2]) sage: P._root_list_from((1,2,1)) [alpha[1], alpha[1] + alpha[2], alpha[2]] """
@cached_method def _long_word_begin_with(self, i): """ Return a reduced expression of the long word which begins with ``i``.
EXAMPLES::
sage: from sage.combinat.crystals.pbw_datum import PBWData sage: P = PBWData(["C",3]) sage: P._long_word_begin_with(1) (1, 3, 2, 3, 1, 2, 3, 1, 2) sage: P._long_word_begin_with(2) (2, 3, 2, 3, 1, 2, 3, 2, 1) sage: P._long_word_begin_with(3) (3, 2, 3, 1, 2, 3, 1, 2, 1) """
#enhanced_braid_chain is an ugly data structure. @cython.boundscheck(False) @cython.wraparound(False) cpdef tuple compute_new_lusztig_datum(list enhanced_braid_chain, initial_lusztig_datum): """ Return the lusztig datum obtained by applying tropical Plücker relations along ``enhanced_braid_chain`` starting with ``initial_lusztig_datum``.
EXAMPLES::
sage: from sage.combinat.root_system.braid_move_calculator import BraidMoveCalculator sage: from sage.combinat.crystals.pbw_datum import enhance_braid_move_chain sage: from sage.combinat.crystals.pbw_datum import compute_new_lusztig_datum sage: ct = CartanType(['A', 2]) sage: W = CoxeterGroup(ct) sage: B = BraidMoveCalculator(W) sage: chain = B.chain_of_reduced_words((1,2,1),(2,1,2)) sage: enhanced_braid_chain = enhance_braid_move_chain(chain, ct) sage: compute_new_lusztig_datum(enhanced_braid_chain,(1,0,1)) (0, 1, 0)
TESTS::
sage: from sage.combinat.root_system.braid_move_calculator import BraidMoveCalculator sage: from sage.combinat.crystals.pbw_datum import enhance_braid_move_chain sage: from sage.combinat.crystals.pbw_datum import compute_new_lusztig_datum sage: ct = CartanType(['A', 2]) sage: W = CoxeterGroup(ct) sage: B = BraidMoveCalculator(W) sage: chain = B.chain_of_reduced_words((1,2,1), (2,1,2)) sage: enhanced_braid_chain = enhance_braid_move_chain(chain, ct) sage: compute_new_lusztig_datum(enhanced_braid_chain,(1,0,1)) == (0,1,0) True """ cdef tuple interval_of_change # Does not currently check that len(initial_lusztig_datum) is appropriate cdef int i
# The tropical plucker relations @cython.boundscheck(False) @cython.wraparound(False) cpdef tuple tropical_plucker_relation(tuple a, lusztig_datum): r""" Apply the tropical Plücker relation of type ``a`` to ``lusztig_datum``.
The relations are obtained by tropicalizing the relations in Proposition 7.1 of [BZ01]_.
INPUT:
- ``a`` -- a pair ``(x, y)`` of the off-diagonal entries of a `2 \times 2` Cartan matrix
EXAMPLES::
sage: from sage.combinat.crystals.pbw_datum import tropical_plucker_relation sage: tropical_plucker_relation((0,0), (2,3)) (3, 2) sage: tropical_plucker_relation((-1,-1), (1,2,3)) (4, 1, 2) sage: tropical_plucker_relation((-1,-2), (1,2,3,4)) (8, 1, 2, 3) sage: tropical_plucker_relation((-2,-1), (1,2,3,4)) (6, 1, 2, 3) """ else: # (-1,-2) and (-1,-3)
# Maybe we need to be more specific, and pass not the Cartan type, but the root lattice? # TODO: Move to PBW_data? @cython.boundscheck(False) @cython.wraparound(False) cpdef list enhance_braid_move_chain(braid_move_chain, cartan_type): r""" Return a list of tuples that records the data of the long words in ``braid_move_chain`` plus the data of the intervals where the braid moves occur and the data of the off-diagonal entries of the `2 \times 2` Cartan submatrices of each braid move.
INPUT:
- ``braid_move_chain`` -- a chain of reduced words in the Weyl group of ``cartan_type`` - ``cartan_type`` -- a finite Cartan type
OUTPUT:
A list of 2-tuples ``(interval_of_change, cartan_sub_matrix)`` where
- ``interval_of_change`` is the (half-open) interval of indices where the braid move occurs; this is `None` for the first tuple - ``cartan_sub_matrix`` is the off-diagonal entries of the `2 \times 2` submatrix of the Cartan matrix corresponding to the braid move; this is `None` for the first tuple
For a matrix::
[2 a] [b 2]
the ``cartan_sub_matrix`` is the pair ``(a, b)``.
TESTS::
sage: from sage.combinat.crystals.pbw_datum import enhance_braid_move_chain sage: braid_chain = [(1, 2, 1, 3, 2, 1), ....: (1, 2, 3, 1, 2, 1), ....: (1, 2, 3, 2, 1, 2), ....: (1, 3, 2, 3, 1, 2), ....: (3, 1, 2, 3, 1, 2), ....: (3, 1, 2, 1, 3, 2), ....: (3, 2, 1, 2, 3, 2), ....: (3, 2, 1, 3, 2, 3)] sage: enhanced_chain = enhance_braid_move_chain(braid_chain, CartanType(["A",5])) sage: enhanced_chain[0] (None, None) sage: enhanced_chain[7] ((3, 6), (-1, -1)) """ cdef int i, j cdef int k, pos, first, last cdef tuple interval_of_change, cartan_sub_matrix cdef tuple current_word # TODO - Optimize this by avoiding calls to here? # This likely could be done when performing chain_of_reduced_words # Things in here get called the most (about 50x more than enhance_braid_move_chain) # This gets the smallest continguous half-open interval [a, b) # that contains the indices where current_word and previous_word differ.
|