Ticket #13460: trac_13460-RC_spinor-ts.patch

File trac_13460-RC_spinor-ts.patch, 54.9 KB (added by tscrim, 8 years ago)

With moved test from #13403

  • sage/combinat/rigged_configurations/bij_abstract_class.py

    # HG changeset patch
    # User Travis Scrimshaw <tscrim@ucdavis.edu>
    # Date 1355644513 28800
    # Node ID e5a235f03923670c1166b96107d0af6d6f92daa4
    # Parent 544a42a9924d48457440a8f12fbb6fe8002ff3de
    #13460 - Implement type D_n spinor bijection for rigged configurations.
    
    diff --git a/sage/combinat/rigged_configurations/bij_abstract_class.py b/sage/combinat/rigged_configurations/bij_abstract_class.py
    a b class KRTToRCBijectionAbstract: 
    5555        EXAMPLES::
    5656
    5757            sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['A', 4, 1], [[2,1]])
    58             sage: from sage.combinat.rigged_configurations.bij_abstract_class import KRTToRCBijectionAbstract
    59             sage: bijection = KRTToRCBijectionAbstract(KRT(pathlist=[[4,3]])) 
    60             sage: bijection.cur_path
    61             []
    62             sage: bijection.ret_rig_con
    63             <BLANKLINE>
    64             (/)
    65             <BLANKLINE>
    66             (/)
    67             <BLANKLINE>
    68             (/)
    69             <BLANKLINE>
    70             (/)
    71             <BLANKLINE>
     58            sage: from sage.combinat.rigged_configurations.bij_type_A import KRTToRCBijectionTypeA
     59            sage: bijection = KRTToRCBijectionTypeA(KRT(pathlist=[[4,3]]))
    7260            sage: TestSuite(bijection).run()
    7361        """
    74         # L = [[0]] * crystalPath.parent().cartan_type().n
    75         # for dim in crystalPath.parent().dims:
    76         #     L[dim[0]-1][0] += 1
    77 
    7862        self.ret_rig_con = krt.parent()._bijection_class(
    7963          krt.parent().affine_ct,
    8064          krt.parent().dims)(partition_list=[[]] *
    class KRTToRCBijectionAbstract: 
    8569        #   be placed in an unstable state.
    8670        # The user will (and should) never know about this temporary mutable state.
    8771        self.ret_rig_con._set_mutable()
     72        self.cur_dims = []
    8873        self.cur_path = []
     74        # self.L = {}
    8975       
    9076    def __eq__(self, rhs):
    9177        r"""
    9278        Check equality.
    93        
     79
    9480        This is only here for pickling check. This is a temporary placeholder
    9581        class, and as such, should never be compared.
    9682
    class KRTToRCBijectionAbstract: 
    10692        return isinstance(rhs, KRTToRCBijectionAbstract)
    10793
    10894    @abstract_method
    109     def next_state(self, val, tableau_height):
     95    def next_state(self, val):
    11096        r"""
    11197        Build the next state in the bijection.
    11298
    class KRTToRCBijectionAbstract: 
    114100
    115101        - ``val``            -- The value we are adding
    116102        - ``tableau_height`` -- The height of the tableau
    117        
     103
    118104        TESTS::
    119        
     105
    120106            sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['A', 4, 1], [[2,1]])
    121107            sage: from sage.combinat.rigged_configurations.bij_type_A import KRTToRCBijectionTypeA
    122             sage: bijection = KRTToRCBijectionTypeA(KRT(pathlist=[[4,3]])) 
    123             sage: bijection.next_state(3, 0)
     108            sage: bijection = KRTToRCBijectionTypeA(KRT(pathlist=[[4,3]]))
     109            sage: bijection.cur_path.insert(0, [])
     110            sage: bijection.cur_dims.insert(0, [0, 1])
     111            sage: bijection.cur_path[0].insert(0, [3])
     112            sage: bijection.next_state(3)
    124113            sage: bijection.ret_rig_con
    125114            <BLANKLINE>
    126115            -1[ ]-1
    class KRTToRCBijectionAbstract: 
    160149        # Setup the first block
    161150        blockLen = self.ret_rig_con[a][0]
    162151        vac_num = self.ret_rig_con.parent()._calc_vacancy_number(self.ret_rig_con.nu(),
    163                                                                  a, 0, B=self.cur_path)
     152                                                                 a, 0, dims=self.cur_dims)
    164153
    165154        for i, row_len in enumerate(self.ret_rig_con[a]):
    166155            # If we've gone to a different sized block, then update the
    167156            #   values which change when moving to a new block size
    168157            if blockLen != row_len:
    169158                vac_num = self.ret_rig_con.parent()._calc_vacancy_number(self.ret_rig_con.nu(),
    170                                                                          a, i, B=self.cur_path)
     159                                                                         a, i, dims=self.cur_dims)
    171160                blockLen = row_len
    172161            self.ret_rig_con[a].vacancy_numbers[i] = vac_num
    173162
    class RCToKRTBijectionAbstract: 
    252241        #self.rigged_con = deepcopy(RC_element)
    253242        self.rigged_con = RC_element.__copy__()
    254243
    255         # Build an empty path for the vacancy numbers
    256         self.rem_path = []
    257         for dim in self.rigged_con.parent().dims:
    258             self.rem_path.append([])
    259             for i in range(dim[0]):
    260                 self.rem_path[-1].append([None] * dim[1])
     244        # Make a (deep) copy of the dimensions for the bijection
     245        self.cur_dims = [list(x[:]) for x in self.rigged_con.parent().dims]
    261246
    262247        # Note that this implementation of the bijection is destructive to cur_partitions,
    263248        #   therefore we will make a (deep) copy of the partitions.
    264249        # TODO: Convert from cur_partitions to rigged_con
    265250        self.cur_partitions = deepcopy(list(self.rigged_con)[:])
     251       
     252        # Compute the current L matrix
     253#        self.L = {}
     254#        for dim in self.rigged_con.parent().dims:
     255#            if self.L.has_key(dim[0]):
     256#                row = self.L[dim[0]]
     257#                if row.has_key(dim[1]):
     258#                    row[dim[1]] += 1
     259#                else:
     260#                    row[dim[1]] = 1
     261#            else:
     262#                self.L[dim[0]] = {dim[1]:1}
    266263
    267264    def __eq__(self, rhs):
    268265        r"""
    269266        Check equality.
    270        
     267
    271268        This is only here for pickling check. This is a temporary placeholder
    272269        class, and as such, should never be compared.
    273270
    class RCToKRTBijectionAbstract: 
    283280        return isinstance(rhs, RCToKRTBijectionAbstract)
    284281
    285282    @abstract_method
    286     def next_state(self):
     283    def next_state(self, height):
    287284        """
    288285        Build the next state in the bijection.
    289        
     286
    290287        TESTS::
    291288
    292289            sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 1]])
    293290            sage: from sage.combinat.rigged_configurations.bij_type_A import RCToKRTBijectionTypeA
    294291            sage: bijection = RCToKRTBijectionTypeA(RC(partition_list=[[1],[1],[1],[1]]))
    295             sage: bijection.tj(1)
    296             sage: bijection.next_state()
     292            sage: bijection.next_state(0)
    297293            5
    298294            sage: bijection.cur_partitions
    299295            [(/)
    class RCToKRTBijectionAbstract: 
    328324        # Setup the first block
    329325        blockLen = partition[0]
    330326        vacNum = self.rigged_con.parent()._calc_vacancy_number(self.cur_partitions,
    331                                                                a, 0, B=self.rem_path)
     327                                                               a, 0, dims=self.cur_dims)
    332328
    333329        for i, rowLen in enumerate(self.cur_partitions[a]):
    334330            # If we've gone to a different sized block, then update the
    335331            #   values which change when moving to a new block size
    336332            if blockLen != rowLen:
    337333                vacNum = self.rigged_con.parent()._calc_vacancy_number(self.cur_partitions,
    338                                                                        a, i, B=self.rem_path)
     334                                                                       a, i, dims=self.cur_dims)
    339335                blockLen = rowLen
    340336
    341337            partition.vacancy_numbers[i] = vacNum
    342338
    343     @abstract_method
    344     def tj(self, k):
    345         r"""
    346         Perform the map `tj` to "move" our path to one with a leading box of
    347         height 1.
    348        
    349         TESTS::
    350        
    351             sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 1]])
    352             sage: from sage.combinat.rigged_configurations.bij_type_A import RCToKRTBijectionTypeA
    353             sage: bijection = RCToKRTBijectionTypeA(RC(partition_list=[[1],[1],[1],[1]]))
    354             sage: bijection.tj(1)
    355             sage: bijection.cur_partitions
    356             [-1[ ]-1
    357             , 1[ ]1
    358             , 0[ ]0
    359             , -1[ ]-1
    360             ]
    361         """
    362 
    363339    def _find_singular_string(self, partition, last_size):
    364340        r"""
    365341        Return the index of the singular string or None if not found.
  • sage/combinat/rigged_configurations/bij_type_A.py

    diff --git a/sage/combinat/rigged_configurations/bij_type_A.py b/sage/combinat/rigged_configurations/bij_type_A.py
    a b  
    11r"""
    2 Specific implementations of the bijection classes for type `A_n^{(1)}`.
     2Bijection classes for type `A_n^{(1)}`
    33
    44Part of the (internal) classes which run the bijection between rigged
    5 configurations and KR tableaux of type `A_n^{(1)}`.
     5configurations and tensor products of Kirillov-Reshetikhin tableaux of
     6type `A_n^{(1)}`.
    67
    78AUTHORS:
    89
    class KRTToRCBijectionTypeA(KRTToRCBijec 
    3940    Specific implementation of the bijection from KR tableaux to rigged configurations for type `A_n^{(1)}`.
    4041    """
    4142
    42     def next_state(self, val, tableau_height):
     43    def next_state(self, val):
    4344        r"""
    4445        Build the next state for type `A_n^{(1)}`
    4546
    class KRTToRCBijectionTypeA(KRTToRCBijec 
    4849            sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['A', 4, 1], [[2,1]])
    4950            sage: from sage.combinat.rigged_configurations.bij_type_A import KRTToRCBijectionTypeA
    5051            sage: bijection = KRTToRCBijectionTypeA(KRT(pathlist=[[4,3]]))
    51             sage: bijection.next_state(3, 0)
     52            sage: bijection.cur_path.insert(0, [])
     53            sage: bijection.cur_dims.insert(0, [0, 1])
     54            sage: bijection.cur_path[0].insert(0, [3])
     55            sage: bijection.next_state(3)
    5256            sage: bijection.ret_rig_con
    5357            <BLANKLINE>
    5458            -1[ ]-1
    class KRTToRCBijectionTypeA(KRTToRCBijec 
    6064            (/)
    6165            <BLANKLINE>
    6266        """
     67        tableau_height = len(self.cur_path[0]) - 1
    6368
    6469        # Note first we subtract off for the n = max value (in the path) - 1,
    6570        #   then we remove 1 to match the indices between math and programming.
    class RCToKRTBijectionTypeA(RCToKRTBijec 
    107112    Specific implementation of the bijection from rigged configurations to tensor products of KR tableaux for type `A_n^{(1)}`.
    108113    """
    109114
    110     def next_state(self):
     115    def next_state(self, height):
    111116        r"""
    112117        Build the next state for type `A_n^{(1)}`.
    113118
    class RCToKRTBijectionTypeA(RCToKRTBijec 
    116121            sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 1]])
    117122            sage: from sage.combinat.rigged_configurations.bij_type_A import RCToKRTBijectionTypeA
    118123            sage: bijection = RCToKRTBijectionTypeA(RC(partition_list=[[1],[1],[1],[1]]))
    119             sage: bijection.tj(1)
    120             sage: bijection.next_state()
     124            sage: bijection.next_state(0)
    121125            5
    122126            sage: bijection.cur_partitions
    123127            [(/)
    class RCToKRTBijectionTypeA(RCToKRTBijec 
    131135        b = None
    132136
    133137        # Calculate the rank and ell values
    134 
    135138        last_size = 0
    136         for a, partition in enumerate(self.cur_partitions):
     139        a = height
     140        for partition in self.cur_partitions[height:]:
    137141            ell[a] = self._find_singular_string(partition, last_size)
    138142
    139143            if ell[a] is None:
    class RCToKRTBijectionTypeA(RCToKRTBijec 
    141145                break
    142146            else:
    143147                last_size = partition[ell[a]]
     148            a += 1
    144149
    145150        if b is None:
    146151            b = n + 1
    class RCToKRTBijectionTypeA(RCToKRTBijec 
    161166            self.cur_partitions[n - 1].rigging[row_num] = self.cur_partitions[n - 1].vacancy_numbers[row_num]
    162167
    163168        return(b)
    164 
    165     def tj(self, k):
    166         r"""
    167         The map `tj` for crystals of type `A_n^{(1)}`.
    168        
    169         INPUT:
    170        
    171         - ``k`` -- The height of the crystal `B^{k,1}`.
    172 
    173         EXAMPLES::
    174 
    175             sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 1]])
    176             sage: from sage.combinat.rigged_configurations.bij_type_A import RCToKRTBijectionTypeA
    177             sage: bijection = RCToKRTBijectionTypeA(RC(partition_list=[[1],[1],[1],[1]]))
    178             sage: bijection.tj(1)
    179             sage: bijection.cur_partitions
    180             [-1[ ]-1
    181             , 1[ ]1
    182             , 0[ ]0
    183             , -1[ ]-1
    184             ]
    185         """
    186 
    187         for a in range(0, k - 1):
    188             self.cur_partitions[a]._list.append(1)
    189             if len(self.cur_partitions[a]) > 1 and self.cur_partitions[a][-2] == 1:
    190                 self.cur_partitions[a].vacancy_numbers.append(self.cur_partitions[a].vacancy_numbers[-1])
    191                 self.cur_partitions[a].rigging.append(self.cur_partitions[a].vacancy_numbers[-1])
    192             else:
    193                 self.cur_partitions[a].vacancy_numbers.append(\
    194                   self.rigged_con.parent()._calc_vacancy_number(self.cur_partitions, a, 0, B=self.rem_path))
    195                 # Since we've (technically) changed the path, but we don't actually do it to simplify
    196                 #   the structure of the code.
    197                 if a == 0 or a == k - 2:
    198                     self.cur_partitions[a].vacancy_numbers[-1] += 1
    199                 self.cur_partitions[a].rigging.append(self.cur_partitions[a].vacancy_numbers[-1])
    200 
  • sage/combinat/rigged_configurations/bij_type_D.py

    diff --git a/sage/combinat/rigged_configurations/bij_type_D.py b/sage/combinat/rigged_configurations/bij_type_D.py
    a b  
    11r"""
    2 Specific implementations of the bijection classes for type `D_n^{(1)}`.
     2Bijection classes for type `D_n^{(1)}`
    33
    44Part of the (internal) classes which runs the bijection between rigged
    55configurations and KR tableaux of type `D_n^{(1)}`.
    class KRTToRCBijectionTypeD(KRTToRCBijec 
    4242    some places.
    4343    """
    4444
    45     def next_state(self, val, tableau_height):
     45    def next_state(self, val):
    4646        r"""
    4747        Build the next state for type `D_n^{(1)}`.
    4848
    49         EXAMPLES::
     49        TESTS::
    5050
    5151            sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['D', 4, 1], [[2,1]])
    5252            sage: from sage.combinat.rigged_configurations.bij_type_D import KRTToRCBijectionTypeD
    5353            sage: bijection = KRTToRCBijectionTypeD(KRT(pathlist=[[-2, 3]]))
    54             sage: bijection.next_state(3, 0)
     54            sage: bijection.cur_path.insert(0, [])
     55            sage: bijection.cur_dims.insert(0, [0, 1])
     56            sage: bijection.cur_path[0].insert(0, [3])
     57            sage: bijection.next_state(3)
    5558            sage: bijection.ret_rig_con
    5659            <BLANKLINE>
    5760            -1[ ]-1
    class KRTToRCBijectionTypeD(KRTToRCBijec 
    6366            (/)
    6467            <BLANKLINE>
    6568        """
    66 
    6769        # Note that type D_n only contains the (absolute) values between 1 and n
    6870        #   (unlike type A_n which is 1 to n+1). Thus we only need to subtract 1
    6971        #   to match the indices.
    7072        # Also note that we must subtract 1 from n to match the indices as well.
     73        n = self.ret_rig_con.parent()._cartan_type.n
     74        tableau_height = len(self.cur_path[0]) - 1
    7175
    7276        # If it is a regular value, we follow the A_n rules
    7377        if val > 0:
    74             KRTToRCBijectionTypeA.next_state(self, val, tableau_height)
     78            KRTToRCBijectionTypeA.next_state(self, val)
    7579
    7680            # If we are inserting n-1 (which will only update nu[a] for a <=
    7781            #   n-1), we need to update the vacancy number of nu[n] as well
    78             if val == self.ret_rig_con.parent()._cartan_type.n - 1:
     82            if val == n - 1:
    7983                self._update_vacancy_nums(val)
     84            if tableau_height >= n - 2:
     85                self._correct_vacancy_nums()
    8086            return
    8187
    82         n = self.ret_rig_con.parent()._cartan_type.n
    8388        posVal = -val
    8489
    8590        if posVal == n:
     91            # Special case for `\overline{n}` and adding to make height `n`
     92            # This only occurs with `r = n - 1`
     93            if self.cur_dims[0][0] == n - 1 and tableau_height == n - 1:
     94                return
     95
    8696            if len(self.ret_rig_con[n - 1]) > 0:
    8797                maxWidth = self.ret_rig_con[n - 1][0] + 1
    8898            else:
    class KRTToRCBijectionTypeD(KRTToRCBijec 
    99109            # Update all other effected remaining values
    100110
    101111            self._update_vacancy_nums(n - 1)
     112            if tableau_height >= n - 2:
     113                self._correct_vacancy_nums()
    102114            self._update_partition_values(n - 1)
    103115
    104116            self._update_vacancy_nums(tableau_height)
    105117            self._update_partition_values(tableau_height)
    106118
    107             self._update_vacancy_nums(tableau_height - 1)
    108             self._update_partition_values(tableau_height - 1)
     119            if tableau_height > 0:
     120                self._update_vacancy_nums(tableau_height - 1)
     121                self._update_partition_values(tableau_height - 1)
    109122
    110123            self._update_vacancy_nums(n - 2)
    111124            return
    class KRTToRCBijectionTypeD(KRTToRCBijec 
    121134          self.ret_rig_con[n - 1][0] + 1 > maxWidth:
    122135            maxWidth = self.ret_rig_con[n - 1][0] + 1
    123136
    124 
    125         # Add cells similiar to type A_n but we move to the right until we reach
     137        # Add cells similar to type A_n but we move to the right until we reach
    126138        #   the value of n-2
    127139        for a in range(posVal - 1, n - 2):
    128140            maxWidth = self.ret_rig_con[a].insert_cell(maxWidth)
    129141
    130142        # Handle the special behavior near values of n
    131         maxWidth2 = self.ret_rig_con[n - 2].insert_cell(maxWidth)
    132         maxWidth = self.ret_rig_con[n - 1].insert_cell(maxWidth)
    133 
    134         if maxWidth2 < maxWidth:
    135             maxWidth = maxWidth2
     143        if tableau_height <= n - 2:
     144            maxWidth2 = self.ret_rig_con[n - 2].insert_cell(maxWidth)
     145            maxWidth = self.ret_rig_con[n - 1].insert_cell(maxWidth)
     146            if maxWidth2 < maxWidth:
     147                maxWidth = maxWidth2
     148        elif posVal <= self.cur_dims[0][0]:
     149            # Special case when the height will become n
     150            maxWidth = self.ret_rig_con[self.cur_dims[0][0] - 1].insert_cell(maxWidth)
    136151
    137152        # Go back following the regular A_n rules
    138         maxWidth = self.ret_rig_con[n - 3].insert_cell(maxWidth)
     153        if tableau_height <= n - 3:
     154            maxWidth = self.ret_rig_con[n - 3].insert_cell(maxWidth)
    139155
    140156        self._update_vacancy_nums(n - 2)
     157        self._update_vacancy_nums(n - 1)
     158        if tableau_height >= n - 2:
     159            self._correct_vacancy_nums()
    141160        self._update_partition_values(n - 2)
    142         self._update_vacancy_nums(n - 1)
    143161        self._update_partition_values(n - 1)
    144162
    145163        for a in reversed(range(tableau_height, n - 3)):
    class KRTToRCBijectionTypeD(KRTToRCBijec 
    147165            self._update_vacancy_nums(a + 1)
    148166            self._update_partition_values(a + 1)
    149167
    150         # Update the final rigged tableau
    151         self._update_vacancy_nums(tableau_height)
    152         self._update_partition_values(tableau_height)
     168        # Update the final rigged partitions
     169        if tableau_height < n - 2:
     170            self._update_vacancy_nums(tableau_height)
     171            self._update_partition_values(tableau_height)
    153172
    154         if posVal < tableau_height:
    155             for a in range(posVal - 1, tableau_height):
     173            if posVal < tableau_height:
     174                for a in range(posVal - 1, tableau_height):
     175                    self._update_vacancy_nums(a)
     176                    self._update_partition_values(a)
     177                if posVal > 1:
     178                    self._update_vacancy_nums(posVal-2)
     179                    self._update_partition_values(posVal-2)
     180            elif 0 < tableau_height:
     181                self._update_vacancy_nums(tableau_height - 1)
     182                self._update_partition_values(tableau_height - 1)
     183        elif posVal <= n - 1:
     184            for a in range(posVal - 1, n - 2):
    156185                self._update_vacancy_nums(a)
    157186                self._update_partition_values(a)
    158         elif tableau_height > 0:
    159             self._update_vacancy_nums(tableau_height - 1)
    160             self._update_partition_values(tableau_height - 1)
     187            if posVal > 1:
     188                self._update_vacancy_nums(posVal-2)
     189                self._update_partition_values(posVal-2)
     190
     191    def _correct_vacancy_nums(self):
     192        r"""
     193        Correct the vacancy numbers with special considerations for spinor
     194        columns.
     195
     196        This should only be called when we are going to have a (left-most)
     197        spinor column of height `n-1` or `n` in type `D^{(1)_n`.
     198
     199        This is a correction for the spinor column where we consider the
     200        weight `\overline{\Lambda_k}` where `k = n-1,n` during the spinor
     201        bijection. This adds 1 to each of the respective vacancy numbers
     202        to account for this.
     203
     204        TESTS::
     205
     206            sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['D', 4, 1], [[2,1]])
     207            sage: from sage.combinat.rigged_configurations.bij_type_D import KRTToRCBijectionTypeD
     208            sage: bijection = KRTToRCBijectionTypeD(KRT(pathlist=[[-1,-4,3,2]]))
     209            sage: bijection.doubling_map()
     210            sage: bijection.cur_path.insert(0, [])
     211            sage: bijection.cur_dims.insert(0, [0, 1])
     212            sage: bijection.cur_path[0].insert(0, [2])
     213            sage: bijection.next_state(2) # indirect doctest
     214            sage: bijection.ret_rig_con
     215            <BLANKLINE>
     216            -2[ ]-2
     217            <BLANKLINE>
     218            (/)
     219            <BLANKLINE>
     220            (/)
     221            <BLANKLINE>
     222            (/)
     223            <BLANKLINE>
     224           
     225        """
     226        pos = self.ret_rig_con.parent()._cartan_type.n - 2
     227        if self.cur_dims[0][0] == len(self.cur_path[0]):
     228            # The current r value is never greater than the height of the current column
     229            # Thus if we do not enter into this if block, then r < height and
     230            #   we adjust the (n-1)-th partition.
     231            pos += 1
     232
     233        for i in range(len(self.ret_rig_con[pos]._list)):
     234            self.ret_rig_con[pos].vacancy_numbers[i] += 1
     235
     236    def doubling_map(self):
     237        r"""
     238        Perform the doubling map of the rigged configuration at the current
     239        state of the bijection.
     240
     241        This is the map `B(\Lambda) \hookrightarrow B(2 \Lambda)` which
     242        doubles each of the rigged partitions and updates the vacancy numbers
     243        accordingly.
     244
     245        TESTS::
     246
     247            sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['D', 4, 1], [[4,1]])
     248            sage: from sage.combinat.rigged_configurations.bij_type_D import KRTToRCBijectionTypeD
     249            sage: bijection = KRTToRCBijectionTypeD(KRT(pathlist=[[-1,-4,3,2]]))
     250            sage: bijection.cur_path.insert(0, [])
     251            sage: bijection.cur_dims.insert(0, [0, 1])
     252            sage: bijection.cur_path[0].insert(0, [2])
     253            sage: bijection.next_state(2)
     254            sage: bijection.ret_rig_con
     255            <BLANKLINE>
     256            -2[ ]-2
     257            <BLANKLINE>
     258            (/)
     259            <BLANKLINE>
     260            (/)
     261            <BLANKLINE>
     262            (/)
     263            <BLANKLINE>
     264            sage: bijection.cur_dims
     265            [[0, 1]]
     266            sage: bijection.doubling_map()
     267            sage: bijection.ret_rig_con
     268            <BLANKLINE>
     269            -4[ ][ ]-4
     270            <BLANKLINE>
     271            (/)
     272            <BLANKLINE>
     273            (/)
     274            <BLANKLINE>
     275            (/)
     276            <BLANKLINE>
     277            sage: bijection.cur_dims
     278            [[0, 2]]
     279        """
     280        for i in range(len(self.cur_dims)):
     281            self.cur_dims[i][1] *= 2
     282        for i in range(len(self.ret_rig_con)):
     283            for j in range(len(self.ret_rig_con[i])):
     284                self.ret_rig_con[i]._list[j] *= 2
     285                self.ret_rig_con[i].rigging[j] *= 2
     286                self.ret_rig_con[i].vacancy_numbers[j] *= 2
     287
     288    def halving_map(self):
     289        """
     290        Perform the halving map of the rigged configuration at the current
     291        state of the bijection.
     292
     293        This is the inverse map to `B(\Lambda) \hookrightarrow B(2 \Lambda)`
     294        which halves each of the rigged partitions and updates the vacancy
     295        numbers accordingly.
     296
     297        TESTS::
     298
     299            sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['D', 4, 1], [[4,1]])
     300            sage: from sage.combinat.rigged_configurations.bij_type_D import KRTToRCBijectionTypeD
     301            sage: bijection = KRTToRCBijectionTypeD(KRT(pathlist=[[-1,-4,3,2]]))
     302            sage: bijection.cur_path.insert(0, [])
     303            sage: bijection.cur_dims.insert(0, [0, 1])
     304            sage: bijection.cur_path[0].insert(0, [2])
     305            sage: bijection.next_state(2)
     306            sage: test = bijection.ret_rig_con
     307            sage: bijection.doubling_map()
     308            sage: bijection.halving_map()
     309            sage: test == bijection.ret_rig_con
     310            True
     311        """
     312        # Skip the first column since it is a spinor
     313        for i in range(1, len(self.cur_dims)):
     314            self.cur_dims[i][1] /= 2
     315        for i in range(len(self.ret_rig_con)):
     316            for j in range(len(self.ret_rig_con[i])):
     317                self.ret_rig_con[i]._list[j] /= 2
     318                self.ret_rig_con[i].rigging[j] /= 2
     319                self.ret_rig_con[i].vacancy_numbers[j] /= 2
    161320
    162321class RCToKRTBijectionTypeD(RCToKRTBijectionTypeA):
    163322    r"""
    164323    Specific implementation of the bijection from rigged configurations to tensor products of KR tableaux for type `D_n^{(1)}`.
    165324    """
    166325
    167     def next_state(self):
     326    def next_state(self, height):
    168327        r"""
    169328        Build the next state for type `D_n^{(1)}`.
    170329
    171         EXAMPLES::
     330        TESTS::
    172331
    173332            sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 1]])
    174333            sage: from sage.combinat.rigged_configurations.bij_type_D import RCToKRTBijectionTypeD
    175334            sage: bijection = RCToKRTBijectionTypeD(RC(partition_list=[[],[1,1],[1],[1]]))
    176             sage: bijection.tj(1)
    177             sage: bijection.next_state()
    178             1
     335            sage: bijection.next_state(1)
     336            -2
    179337            sage: bijection.cur_partitions
    180338            [(/)
    181             , -1[ ]-1
    182             -1[ ]-1
    183             , 0[ ]0
    184             , 0[ ]0
     339            , (/)
     340            , (/)
     341            , (/)
    185342            ]
    186 
    187343        """
    188344        n = self.rigged_con.parent()._cartan_type.n
    189345        ell = [None] * (2 * n - 2) # No `\bar{\ell}^{n-1}` and `\bar{\ell}^n`
    class RCToKRTBijectionTypeD(RCToKRTBijec 
    192348        # Calculate the rank and ell values
    193349
    194350        last_size = 0
    195         for a in range(0, n - 2):
     351        for a in range(height, n - 2):
    196352            ell[a] = self._find_singular_string(self.cur_partitions[a], last_size)
    197353
    198354            if ell[a] is None:
    class RCToKRTBijectionTypeD(RCToKRTBijec 
    201357            else:
    202358                last_size = self.cur_partitions[a][ell[a]]
    203359
    204         if b is None:
     360        if height == n:
     361            # Special case from height `n` spinor with `r = n-1`
     362            ell[n - 2] = self._find_singular_string(self.cur_partitions[n - 2], last_size)
     363            if ell[n - 2] is not None:
     364                last_size = self.cur_partitions[n - 2][ell[n - 2]]
     365            else:
     366                b = -n
     367        elif height == n - 1:
     368            # Special case for height `n-1` spinor
     369            ell[n - 1] = self._find_singular_string(self.cur_partitions[n - 1], last_size)
     370            if ell[n - 1] is not None:
     371                last_size = self.cur_partitions[n - 1][ell[n - 1]]
     372            else:
     373                b = n
     374        elif b is None:
    205375            # Do the special cases when we've reached n - 2
    206376            ell[n - 2] = self._find_singular_string(self.cur_partitions[n - 2], last_size)
    207377            ell[n - 1] = self._find_singular_string(self.cur_partitions[n - 1], last_size)
    class RCToKRTBijectionTypeD(RCToKRTBijec 
    224394            # Now go back
    225395            for a in reversed(range(0, n - 2)):
    226396                # Modified form of _find_singular_string
    227                 for i in reversed(range(0, ell[a])):
     397                end = ell[a]
     398                if a < height:
     399                    end = len(self.cur_partitions[a])
     400                for i in reversed(range(0, end)):
    228401                    if self.cur_partitions[a][i] >= last_size and \
    229402                      self.cur_partitions[a].vacancy_numbers[i] == self.cur_partitions[a].rigging[i]:
    230403                            ell[n + a] = i
    class RCToKRTBijectionTypeD(RCToKRTBijec 
    276449              self.cur_partitions[n - 2].vacancy_numbers[ret_row_next]
    277450
    278451        self._update_vacancy_numbers(n - 1)
     452        if height >= n - 1:
     453            self._correct_vacancy_nums()
    279454        if ret_row_bar_next is not None:
    280455            self.cur_partitions[n - 1].rigging[ret_row_bar_next] = \
    281456              self.cur_partitions[n - 1].vacancy_numbers[ret_row_bar_next]
    282457
    283458        return(b)
    284459
    285     def tj(self, k):
    286         r"""
    287         The map `tj` for crystals of type `D_n^{(1)}`.
    288        
    289         INPUT:
    290        
    291         - ``k`` -- The height of the crystal `B^{k,1}`.
     460    def doubling_map(self):
     461        """
     462        Perform the doubling map of the rigged configuration at the current
     463        state of the bijection.
    292464
    293         EXAMPLES::
     465        This is the map `B(\Lambda) \hookrightarrow B(2 \Lambda)` which
     466        doubles each of the rigged partitions and updates the vacancy numbers
     467        accordingly.
    294468
    295             sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 1]])
     469        TESTS::
     470
     471            sage: RC = RiggedConfigurations(['D', 4, 1], [[4, 1]])
    296472            sage: from sage.combinat.rigged_configurations.bij_type_D import RCToKRTBijectionTypeD
    297             sage: bijection = RCToKRTBijectionTypeD(RC(partition_list=[[1],[2,1],[2],[1]]))
    298             sage: bijection.tj(2)
     473            sage: bijection = RCToKRTBijectionTypeD(RC(partition_list=[[],[],[],[1]]))
    299474            sage: bijection.cur_partitions
    300             [0[ ]0
    301             0[ ]0
    302             , -1[ ][ ]-1
    303             0[ ]0
    304             , -1[ ][ ]-1
    305             , 0[ ]0
     475            [(/)
     476            , (/)
     477            , (/)
     478            , -1[ ]-1
     479            ]
     480            sage: bijection.doubling_map()
     481            sage: bijection.cur_partitions
     482            [(/)
     483            , (/)
     484            , (/)
     485            , -2[ ][ ]-2
    306486            ]
    307487        """
    308         n = len(self.cur_partitions)
     488        # Skip the first column since it is a spinor
     489        for i in range(1, len(self.cur_dims)):
     490            self.cur_dims[i][1] *= 2
     491        for partition in self.cur_partitions:
     492            for j in range(len(partition)):
     493                partition._list[j] *= 2
     494                partition.rigging[j] *= 2
     495                partition.vacancy_numbers[j] *= 2
    309496
    310         if k == n - 1:
    311             # TODO
    312             pass
    313         elif k == n:
    314             # TODO
    315             pass
    316         else:
    317             RCToKRTBijectionTypeA.tj(self, k)
     497    def halving_map(self):
     498        """
     499        Perform the halving map of the rigged configuration at the current
     500        state of the bijection.
    318501
     502        This is the inverse map to `B(\Lambda) \hookrightarrow B(2 \Lambda)`
     503        which halves each of the rigged partitions and updates the vacancy
     504        numbers accordingly.
     505
     506        TESTS::
     507
     508            sage: RC = RiggedConfigurations(['D', 4, 1], [[4, 1]])
     509            sage: from sage.combinat.rigged_configurations.bij_type_D import RCToKRTBijectionTypeD
     510            sage: bijection = RCToKRTBijectionTypeD(RC(partition_list=[[],[],[],[1]]))
     511            sage: test = bijection.cur_partitions
     512            sage: bijection.doubling_map()
     513            sage: bijection.halving_map()
     514            sage: test == bijection.cur_partitions
     515            True
     516        """
     517        for i in range(len(self.cur_dims)):
     518            self.cur_dims[i][1] /= 2
     519        for partition in self.cur_partitions:
     520            for j in range(len(partition)):
     521                partition._list[j] /= 2
     522                partition.rigging[j] /= 2
     523                partition.vacancy_numbers[j] /= 2
     524
     525    def _correct_vacancy_nums(self):
     526        """
     527        Correct the vacancy numbers with special considerations for spinor
     528        columns.
     529
     530        This should only be called when we are going to have a (left-most)
     531        spinor column of height `n-1` or `n`.
     532
     533        This is a correction for the spinor column where we consider the
     534        weight `\overline{\Lambda_k}` where `k = n-1,n` during the spinor
     535        bijection. This adds 1 to each of the respective vacancy numbers
     536        to account for this.
     537
     538        TESTS::
     539
     540            sage: RC = RiggedConfigurations(['D', 4, 1], [[4, 1]])
     541            sage: from sage.combinat.rigged_configurations.bij_type_D import RCToKRTBijectionTypeD
     542            sage: bijection = RCToKRTBijectionTypeD(RC(partition_list=[[],[],[],[1]]))
     543            sage: bijection.doubling_map()
     544            sage: bijection.next_state(4) # indirect doctest
     545            -4
     546        """
     547        n = self.rigged_con.parent()._cartan_type.n
     548        for i in range(len(self.cur_partitions[n-1]._list)):
     549            self.cur_partitions[n-1].vacancy_numbers[i] += 1
  • sage/combinat/rigged_configurations/bijection.py

    diff --git a/sage/combinat/rigged_configurations/bijection.py b/sage/combinat/rigged_configurations/bijection.py
    a b def KRTToRCBijection(krt_elt): 
    3838        sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['A', 4, 1], [[2,1]])
    3939        sage: from sage.combinat.rigged_configurations.bijection import KRTToRCBijection
    4040        sage: bijection = KRTToRCBijection(KRT(pathlist=[[4,3]]))
    41         sage: bijection.next_state(3, 0)
     41        sage: bijection.cur_path.insert(0, [])
     42        sage: bijection.cur_dims.insert(0, [0, 1])
     43        sage: bijection.cur_path[0].insert(0, [3])
     44        sage: bijection.next_state(3)
    4245        sage: bijection.ret_rig_con
    4346        <BLANKLINE>
    4447        -1[ ]-1
    def RCToKRTBijection(rigged_configuratio 
    6770        sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 1]])
    6871        sage: from sage.combinat.rigged_configurations.bijection import RCToKRTBijection
    6972        sage: bijection = RCToKRTBijection(RC(partition_list=[[1],[1],[1],[1]]))
    70         sage: bijection.tj(1)
    71         sage: bijection.next_state()
     73        sage: bijection.next_state(0)
    7274        5
    7375        sage: bijection.cur_partitions
    7476        [(/)
  • sage/combinat/rigged_configurations/rigged_configuration_element.py

    diff --git a/sage/combinat/rigged_configurations/rigged_configuration_element.py b/sage/combinat/rigged_configurations/rigged_configuration_element.py
    a b class RiggedConfigurationElement(Clonabl 
    364364            for i, vac_num in enumerate(partition.vacancy_numbers):
    365365                assert vac_num >= partition.rigging[i], "rigging can be at most the vacancy number"
    366366
    367     def to_tensor_product_of_Kirillov_Reshetikhin_tableaux(self, display_steps=False, display_all=False, **options):
     367    def to_tensor_product_of_Kirillov_Reshetikhin_tableaux(self, display_steps=False, **options):
    368368        r"""
    369369        Perform the bijection from this rigged configuration to a tensor
    370370        product of Kirillov-Reshetikhin tableaux given in [RigConBijection]_
    class RiggedConfigurationElement(Clonabl 
    422422        #   bijection has been performed.
    423423        ret_crystal_path = []
    424424
    425         for tableau in self.parent().dims:
     425        for dim in self.parent().dims:
    426426            ret_crystal_path.append([])
    427 
    428             split_column = False
    429             while len(bijection.rem_path[0]) > 0 or split_column:
    430                 # If we have finished a splited column
    431                 if len(bijection.rem_path[0]) == 0:
    432                     bijection.rem_path.pop(0)
    433                     split_column = False
    434 
    435                 if display_steps or display_all:
    436                     print "===================="
    437                     print repr(self.parent()(*bijection.cur_partitions))
    438                     print "--------------------"
    439                     print ret_crystal_path
    440                     print "--------------------\n"
    441 
    442                 # Build the next state
    443                 # Check to see if we need to split off a column
    444                 if len(bijection.rem_path[0][0]) > 1:
    445                     for row in bijection.rem_path[0]:
    446                         row.pop()
    447                     bijection.rem_path.insert(0, [[None]] * len(bijection.rem_path[0]))
     427           
     428            # Iterate over each column
     429            for dummy_var in range(dim[1]):
     430                # Split off a new column if necessary
     431                if bijection.cur_dims[0][1] > 1:
     432                    bijection.cur_dims[0][1] -= 1
     433                    bijection.cur_dims.insert(0, [dim[0], 1])
    448434
    449435                    # Perform the corresponding splitting map on rigged configurations
    450                     # All it does is update the vacancy numbers
     436                    # All it does is update the vacancy numbers on the RC side
    451437                    for a in range(n):
    452438                        bijection._update_vacancy_numbers(a)
    453                     split_column = True
    454439
    455                     if display_all:
    456                         print "Split column:"
     440                # Check to see if we are a spinor
     441                if type == 'D' and dim[0] >= n - 1:
     442                    if display_steps:
     443                        print "===================="
    457444                        print repr(self.parent()(*bijection.cur_partitions))
     445                        print "--------------------"
     446                        print ret_crystal_path
    458447                        print "--------------------\n"
     448                        print "Applied doubling map"
     449                    bijection.doubling_map()
     450                    if dim[0] == n - 1:
     451                        if display_steps:
     452                            print "===================="
     453                            print repr(self.parent()(*bijection.cur_partitions))
     454                            print "--------------------"
     455                            print ret_crystal_path
     456                            print "--------------------\n"
     457                        b = bijection.next_state(n)
     458                        if b == n:
     459                            b = -n
     460                        ret_crystal_path[-1].append(Letters(b)) # Append the rank
    459461
    460                 bijection.rem_path[0].pop()
     462                while bijection.cur_dims[0][0] > 0:
     463                    if display_steps:
     464                        print "===================="
     465                        print repr(self.parent()(*bijection.cur_partitions))
     466                        print "--------------------"
     467                        print ret_crystal_path
     468                        print "--------------------\n"
     469   
     470                    bijection.cur_dims[0][0] -= 1 # This takes care of the indexing
     471                    b = bijection.next_state(bijection.cur_dims[0][0])
     472                   
     473                    # Corrections for spinor
     474                    if type == 'D' and dim[0] == n and b == -n \
     475                      and bijection.cur_dims[0][0] == n - 1:
     476                        b = -(n-1)
     477   
     478                    # Make sure we have a crystal letter
     479                    ret_crystal_path[-1].append(Letters(b)) # Append the rank
    461480
    462                 # Check to see if we needed to pull off a box
    463                 if len(bijection.rem_path[0]) > 0:
    464                     bijection.tj(len(bijection.rem_path[0]) + 1)
     481                bijection.cur_dims.pop(0) # Pop off the leading column
    465482
    466                 if display_all:
    467                     print "tj:"
    468                     print repr(self.parent()(*bijection.cur_partitions))
    469                     print "--------------------\n"
    470 
    471                 b = bijection.next_state()
    472 
    473                 # Make sure we have a crystal letter
    474                 ret_crystal_path[-1].append(Letters(b)) # Append the rank
    475 
    476             bijection.rem_path.pop(0)
     483                # Check to see if we were a spinor
     484                if type == 'D' and dim[0] >= n-1:
     485                    if display_steps:
     486                        print "===================="
     487                        print repr(self.parent()(*bijection.cur_partitions))
     488                        print "--------------------"
     489                        print ret_crystal_path
     490                        print "--------------------\n"
     491                        print "Applied halving map"
     492                    bijection.halving_map()
    477493
    478494        # If you're curious about this, see the note in AbstractTensorProductOfKRTableaux._highest_weight_iter().
    479495        # You should never call this option.
  • 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 
    446446   
    447447    def _calc_vacancy_number(self, partitions, a, i, **options):
    448448        r"""
    449         Calculate the vacancy number of the `i`-th row of the `a`-th partition.
     449        Calculate the vacancy number of the `i`-th row of the `a`-th rigged
     450        partition.
    450451
    451452        INPUT:
    452453
    453454        - ``partitions`` -- The list of rigged partitions we are using
    454         - ``a``          -- The tableau index
    455         - ``i``          -- The row index of the `a`-th tableau
     455        - ``a``          -- The rigged partition index
     456        - ``i``          -- The row index of the `a`-th rigged partition
    456457
    457458        TESTS::
    458459
    class AbstractRiggedConfigurations(Uniqu 
    470471                if len(tableau) == a + 1:
    471472                    vac_num += min(row_len, len(tableau[0]))
    472473        elif "L" in options:
    473             for i in range(len(options["L"][a])):
    474                 vac_num += min(i, row_len) * options["L"][a][i]
     474            L = options["L"]
     475            if L.has_key(a):
     476                for kvp in L[a].items():
     477                    vac_num += min(kvp[0], row_len) * kvp[1]
     478        elif "dims" in options:
     479            for dim in options["dims"]:
     480                if dim[0] == a + 1:
     481                    vac_num += min(dim[1], row_len)
    475482        else:
    476483            for dim in self.dims:
    477484                if dim[0] == a + 1:
    478485                    vac_num += min(dim[1], row_len)
    479486
    480         #for i, value in enumerate(self._cartan_type.classical().cartan_matrix().row(a)):
    481         for i, value in enumerate(self._cartan_type.cartan_matrix().row(a)):
    482             vac_num -= value * partitions[i].get_num_cells_to_column(row_len)
     487        #for j, value in enumerate(self._cartan_type.classical().cartan_matrix().row(a)):
     488        for j, value in enumerate(self._cartan_type.cartan_matrix().row(a)):
     489            vac_num -= value * partitions[j].get_num_cells_to_column(row_len)
    483490
    484491        return vac_num
    485492
    class RiggedConfigurations(AbstractRigge 
    766773        sage: ret = RC(tp_krc)
    767774        sage: ret == elt
    768775        True
     776
     777    ::
     778
     779        sage: RC = RiggedConfigurations(['D', 4, 1], [[4,1], [3,3]])
     780        sage: KR1 = KirillovReshetikhinCrystal(['D', 4, 1], 4, 1)
     781        sage: KR2 = KirillovReshetikhinCrystal(['D', 4, 1], 3, 3)
     782        sage: T = TensorProductOfCrystals(KR1, KR2)
     783        sage: t = T[1]; t
     784        [[++++, []], [+++-, [[1], [2], [4], [-4]]]]
     785        sage: ret = RC(t)
     786        sage: ret.to_tensor_product_of_Kirillov_Reshetikhin_crystals()
     787        [[++++, []], [+++-, [[1], [2], [4], [-4]]]]
    769788    """
    770789    @staticmethod
    771790    def __classcall_private__(cls, cartan_type, B):
    class RiggedConfigurations(AbstractRigge 
    816835            sage: RC
    817836            Rigged configurations of type ['A', 3, 1] and factors ((3, 2), (1, 2), (1, 1))
    818837            sage: TestSuite(RC).run()  # long time (4s on sage.math, 2012)
     838            sage: RC = RiggedConfigurations(['D', 4, 1], [[2,2]])
     839            sage: TestSuite(RC).run() # long time
     840            sage: RC = RiggedConfigurations(['D', 4, 1], [[3,1]])
     841            sage: TestSuite(RC).run() # long time
     842            sage: RC = RiggedConfigurations(['D', 4, 1], [[4,3]])
     843            sage: TestSuite(RC).run() # long time
    819844        """
    820845        from tensor_product_kr_tableaux import TensorProductOfKirillovReshetikhinTableaux # For circular imports
    821846        AbstractRiggedConfigurations.__init__(self, cartan_type, B, TensorProductOfKirillovReshetikhinTableaux)
    class RiggedConfigurations(AbstractRigge 
    858883        # lazy_attribute does not inherit
    859884        return [x for x in self._highest_weight_iter()]
    860885
     886    def _test_bijection(self, **options):
     887        r"""
     888        Test function to make sure that the bijection between rigged
     889        configurations and Kirillov-Reshetikhin tableaux is correct.
     890
     891        EXAMPLES::
     892
     893            sage: RC = RiggedConfigurations(['A', 4, 1], [[3,2],[4,1]])
     894            sage: RC._test_bijection()
     895        """
     896        tester = self._tester(**options)
     897        rejects = []
     898        for x in self:
     899            y = x.to_tensor_product_of_Kirillov_Reshetikhin_tableaux()
     900            z = y.to_rigged_configuration()
     901            if z != x:
     902                rejects.append((x, z))
     903
     904        tester.assertTrue(len(rejects) == 0, "Bijection is not correct: %s"%rejects)
     905        if len(rejects) != 0:
     906            return rejects
     907
    861908    def tensor_product_of_Kirillov_Reshetikhin_crystals(self):
    862909        """
    863910        Return the corresponding tensor product of Kirillov-Reshetikhin
    class RiggedConfigurations(AbstractRigge 
    873920        return self._bijection_class(self._affine_ct, self.dims).tensor_product_of_Kirillov_Reshetikhin_crystals()
    874921
    875922RiggedConfigurations.Element = RiggedConfigurationElement
     923
     924# For experimentation purposes only.
     925# I'm keeping this for when we implement the R-matrix in general
     926#def R_matrix_test(n, L1, L2):
     927#    RC = HighestWeightRiggedConfigurations(['D', n, 1], [L1, L2])
     928#    RC2 = HighestWeightRiggedConfigurations(['D', n, 1], [L2, L1])
     929#    ret_list = []
     930#    for x in RC:
     931#        x2 = RC2(*x)
     932#        ret_list.append([x.to_tensor_product_of_Kirillov_Reshetikhin_tableaux(),
     933#                         x2.to_tensor_product_of_Kirillov_Reshetikhin_tableaux()])
     934#    return ret_list
     935 No newline at end of file
  • sage/combinat/rigged_configurations/rigged_partition.py

    diff --git a/sage/combinat/rigged_configurations/rigged_partition.py b/sage/combinat/rigged_configurations/rigged_partition.py
    a b class RiggedPartition(Partition_class): 
    282282        maxPos = -1
    283283        for i, vacNum in enumerate(self.vacancy_numbers):
    284284            if self._list[i] <= max_width and vacNum == self.rigging[i]:
    285               # and vacNum > maxSingular:
    286                 # maxSingular = vacNum
    287285                maxPos = i
    288286                break
    289287
  • 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 class TensorProductOfKirillovReshetikhin 
    505505
    506506            sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [[3,1],[2,2]]); KRT
    507507            Tensor product of Kirillov-Reshetikhin tableaux of type ['A', 3, 1] and tableau shape(s) [[1, 1, 1], [2, 2]]
    508             sage: TestSuite(KRT).run()
     508            sage: TestSuite(KRT).run() # long time
     509            sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['D',4,1], [[2,2]])
     510            sage: TestSuite(KRT).run() # long time
     511            sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['D',4,1], [[3,1]])
     512            sage: TestSuite(KRT).run() # long time
     513            sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['D',4,1], [[4,3]])
     514            sage: TestSuite(KRT).run() # long time
    509515        """
    510516        from rigged_configurations import RiggedConfigurations
    511517        AbstractTensorProductOfKRTableaux.__init__(self, cartan_type, B, RiggedConfigurations)
    class TensorProductOfKirillovReshetikhin 
    513519          cartan_type, list([rectDims[1]] * rectDims[0] for rectDims in B)))
    514520        self.module_generators = HighestWeightTensorProductOfKirillovReshetikhinTableaux(cartan_type, B)
    515521
     522    def _test_bijection(self, **options):
     523        r"""
     524        Test function to make sure that the bijection between rigged
     525        configurations and Kirillov-Reshetikhin tableaux is correct.
     526
     527        EXAMPLES::
     528
     529            sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['A', 4, 1], [[3,2],[4,1]])
     530            sage: KRT._test_bijection()
     531        """
     532        tester = self._tester(**options)
     533        rejects = []
     534        for x in self:
     535            y = x.to_rigged_configuration()
     536            z = y.to_tensor_product_of_Kirillov_Reshetikhin_tableaux()
     537            if z != x:
     538                rejects.append((x, z))
     539
     540        tester.assertTrue(len(rejects) == 0, "Bijection is not correct: %s"%rejects)
     541        if len(rejects) != 0:
     542            return rejects
     543
    516544    def tensor_product_of_Kirillov_Reshetikhin_crystals(self):
    517545        """
    518546        Return the corresponding tensor product of Kirillov-Reshetikhin
  • 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 class TensorProductOfKirillovReshetikhin 
    207207
    208208        The rigged configuration corresponding to ``self``.
    209209
    210         EXAMPLES::
     210        EXAMPLES:
     211
     212        Type `A_n^{(1)}` example::
    211213
    212214            sage: KRT = HighestWeightTensorProductOfKirillovReshetikhinTableaux(['A', 3, 1], [[2,1], [2,1], [2,1]])
    213215            sage: T = KRT(pathlist=[[4, 2], [3, 1], [2, 1]])
    class TensorProductOfKirillovReshetikhin 
    222224            <BLANKLINE>
    223225            0[ ]0
    224226            <BLANKLINE>
     227
     228        Type `D_n^{(1)}` example::
     229
    225230            sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['D', 4, 1], [[2,2]])
    226231            sage: T = KRT(pathlist=[[2,1,4,3]])
    227232            sage: T
    class TensorProductOfKirillovReshetikhin 
    236241            0[ ]0
    237242            <BLANKLINE>
    238243            (/)
     244
     245        Type `D_n^{(1)}` spinor example::
     246
     247            sage: CP = TensorProductOfKirillovReshetikhinTableaux(['D', 5, 1], [[5,1],[2,1],[1,1],[1,1],[1,1]])
     248            sage: elt = CP(pathlist=[[-2,-5,4,3,1],[-1,2],[1],[1],[1]])
     249            sage: elt
     250            [[1], [3], [4], [-5], [-2]] (X) [[2], [-1]] (X) [[1]] (X) [[1]] (X) [[1]]
     251            sage: elt.to_rigged_configuration()
     252            <BLANKLINE>
     253            2[ ][ ]1
     254            <BLANKLINE>
     255            0[ ][ ]0
     256            0[ ]0
     257            <BLANKLINE>
     258            0[ ][ ]0
     259            0[ ]0
     260            <BLANKLINE>
     261            0[ ]0
     262            <BLANKLINE>
     263            0[ ][ ]0
     264            <BLANKLINE>
     265
     266        This is invertible by calling
     267        :meth:`~sage.combinat.rigged_configurations.rigged_configuration_element.RiggedConfigurationElement.to_tensor_product_of_Kirillov_Reshetikhin_tableaux()`::
     268
     269            sage: KRT = TensorProductOfKirillovReshetikhinTableaux(['D', 4, 1], [[2,2]])
     270            sage: T = KRT(pathlist=[[2,1,4,3]])
     271            sage: rc = T.to_rigged_configuration()
     272            sage: ret = rc.to_tensor_product_of_Kirillov_Reshetikhin_tableaux(); ret
     273            [[1, 3], [2, 4]]
     274            sage: ret == T
     275            True
    239276        """
    240277
    241278        bijection = KRTToRCBijection(self)
     279        type = self.parent().cartan_type().letter
     280        n = self.parent().cartan_type().n
    242281
    243282        for cur_crystal in reversed(self):
     283            r = cur_crystal.parent().r()
    244284            # Iterate through the columns
    245285            for col_number, cur_column in enumerate(reversed(cur_crystal.to_array(False))):
    246286                bijection.cur_path.insert(0, []) # Prepend an empty list
    247287
     288                # Check to see if we are a spinor column
     289                if type == 'D' and r >= n-1:
     290                    if display_steps:
     291                        print "===================="
     292                        print repr(TensorProductOfKirillovReshetikhinTableauxElement(self.parent(), *bijection.cur_path))
     293                        print "--------------------"
     294                        print repr(bijection.ret_rig_con)
     295                        print "--------------------\n"
     296                        print "Applied doubling map"
     297                    bijection.doubling_map()
     298
     299                bijection.cur_dims.insert(0, [0, 1])
     300
    248301                # Note that we do not need to worry about iterating over columns
    249302                #   (see previous note about the data structure).
    250                 # height is the height of the current tableau
    251                 for height, letter in enumerate(reversed(cur_column)):
     303                for letter in reversed(cur_column):
     304                    if bijection.cur_dims[0][0] < r:
     305                        bijection.cur_dims[0][0] += 1
    252306                    val = letter.value # Convert from a CrystalOfLetter to an Integer
    253307
    254308                    if display_steps:
    class TensorProductOfKirillovReshetikhin 
    259313                        print "--------------------\n"
    260314
    261315                    # Build the next state
    262                     # FIXME: Remove the single object list around letter
    263316                    bijection.cur_path[0].insert(0, [letter]) # Prepend the value
    264                     bijection.next_state(val, height)
     317                    bijection.next_state(val)
     318
     319                # Check to see if we are a spinor column
     320                if type == 'D' and r >= n-1:
     321                    if display_steps:
     322                        print "===================="
     323                        print repr(TensorProductOfKirillovReshetikhinTableauxElement(self.parent(), *bijection.cur_path))
     324                        print "--------------------"
     325                        print repr(bijection.ret_rig_con)
     326                        print "--------------------\n"
     327                        print "Applied halving map"
     328                    bijection.halving_map()
    265329
    266330                # If we've split off a column, we need to merge the current column
    267331                #   to the current crystal tableau
    268332                if col_number > 0:
    269333                    for i, letter_singleton in enumerate(bijection.cur_path[0]):
    270334                        bijection.cur_path[1][i].insert(0, letter_singleton[0])
    271                     bijection.cur_path.pop(0)
     335                    bijection.cur_dims.pop(0)
     336                    bijection.cur_dims[0][1] += 1
    272337
    273338                    # And perform the inverse column splitting map on the RC
    274                     for a in range(self.parent().cartan_type().n):
     339                    for a in range(n):
    275340                        bijection._update_vacancy_nums(a)
    276341
    277342        bijection.ret_rig_con.set_immutable() # Return it to immutable