Exemple #1
0
 def make_graded_matrix_pair(self, r, grade):
     k, col_i = self.make_graded_entry_dictionary(r - 1, grade)
     m, mid_i = self.make_graded_entry_dictionary(r, grade)
     n, row_i = self.make_graded_entry_dictionary(r + 1, grade)
     A = []
     B = []
     if r > 0:
         B = [[0 for _ in range(k)] for _ in range(m)]
         self.verticals(r - 1)
         for v, g in self.verticals:
             if self.grade(v, g) == grade:
                 for i in range(self.d):
                     if alg.v(v, i) == 0:
                         u = v + (1 << i)
                         for h in self.maps[v, i][g]:
                             B[mid_i[u, h]][col_i[v,
                                                  g]] = self.maps[v,
                                                                  i][g][h]
     inv_v = self.inv_v
     inv_g = 0
     if self.odd:
         inv_g = (1 << self.get_res_len(inv_v)) - 1
     inv_index = mid_i[inv_v, inv_g]
     if r < self.d:
         A = [[fe.FE(0, 0) for _ in range(m)] for _ in range(n)]
         self.verticals(r)
         for v, g in self.verticals:
             if self.grade(v, g) == grade:
                 for i in range(self.d):
                     if alg.v(v, i) == 0:
                         u = v + (1 << i)
                         for h in self.maps[v, i][g]:
                             value = self.maps[v, i][g][h]
                             A[row_i[u, h]][mid_i[v, g]] = fe.FE(value, 0)
     return A, B, k, m, n, inv_index
Exemple #2
0
 def make_matrix(self, r):
     m, col_i = self.make_entry_dictionary(r)
     n, row_i = self.make_entry_dictionary(r + 1)
     A = [[0 for _ in range(m)] for _ in range(n)]
     self.verticals(r)
     for v, g in self.verticals:
         for i in range(self.d):
             if alg.v(v, i) == 0:
                 u = v + (1 << i)
                 for h in self.maps[v, i][g]:
                     A[row_i[u, h]][col_i[v, g]] = self.maps[v, i][g][h]
     return A
Exemple #3
0
    def square_sign(self, v, i, j):
        #Algorithm due to Shumakovitch
        #Adapted to current set up
        #The input should be a vertex and the indices of two arrow changing from 0 to 1
        assert (alg.v(v, i) == 0 and alg.v(v, j) == 0 and i != j)
        c00 = self.get_res_len(v)
        c11 = self.get_res_len(v + (1 << i) + (1 << j))
        if c00 < c11:
            self.squares[v, i, j] = "Type A, increasing cycles"
            return -1  #Type A
        elif c11 < c00:
            self.squares[v, i, j] = "Type C, decreasing cycles"
            return 1  #Type C
        pd = self.braid.get_x_diagram()
        t1 = pd[i][2]
        h1 = pd[i][0]
        t2 = pd[j][2]
        h2 = pd[j][0]
        r00 = self.get_res(v)
        lct1 = self.get_circle(v, t1)  #index of circle t1 is in
        lch2 = self.get_circle(v, h2)  #index of circle h2 is in

        if (h1 in r00[lch2] and t2 in r00[lct1]) and (h1 not in r00[lct1]):
            self.squares[v, i, j] = "Type A, same no., arrows point likewise"
            return -1  #Type A
        if h1 not in r00[lct1] or t2 not in r00[lch2]:
            self.squares[v, i,
                         j] = "Type C, same no., arrows point differently"
            return 1  #Type C
        assert (lct1 == lch2)
        assert (h1 in r00[lct1] and t2 in r00[lct1])
        #r01 = self.get_res(v00 + (1<<a2))
        rct1 = self.get_circle(v + (1 << j), t1)
        rct2 = self.get_circle(v + (1 << j), t2)
        if rct1 == rct2:
            self.squares[v, i, j] = "Type Y"
            return 1  #Type Y
        self.squares[v, i, j] = "Type X"
        return -1  #Type X
Exemple #4
0
 def make_matrix_pair(self, r, augmented=True, field_A=False):
     k, col_i = self.make_entry_dictionary(r - 1)
     m, mid_i = self.make_entry_dictionary(r)
     n, row_i = self.make_entry_dictionary(r + 1)
     if field_A:
         A = [[fe.FE(0, 0) for _ in range(m)] for _ in range(n)]
     else:
         A = [[0 for _ in range(m)] for _ in range(n)]
     B = [[0 for _ in range(k)] for _ in range(m)]
     if r > 0:
         self.verticals(r - 1)
         for v, g in self.verticals:
             for i in range(self.d):
                 if alg.v(v, i) == 0:
                     u = v + (1 << i)
                     for h in self.maps[v, i][g]:
                         B[mid_i[u, h]][col_i[v, g]] = self.maps[v, i][g][h]
     inv_v = self.inv_v
     inv_g = (1 << self.get_res_len(inv_v)) - 1
     inv_index = mid_i[inv_v, inv_g]
     if augmented:
         for mid in mid_i:
             if mid == (inv_v, inv_g):
                 B[mid_i[mid]].append(1)
             else:
                 B[mid_i[mid]].append(0)
     if r < self.d:
         self.verticals(r)
         for v, g in self.verticals:
             for i in range(self.d):
                 if alg.v(v, i) == 0:
                     u = v + (1 << i)
                     for h in self.maps[v, i][g]:
                         value = self.maps[v, i][g][h]
                         if field_A:
                             A[row_i[u, h]][mid_i[v, g]] = fe.FE(value, 0)
                         else:
                             A[row_i[u, h]][mid_i[v, g]] = value
     return A, B, k, m, n, inv_index
Exemple #5
0
    def split_map(self, edge):
        assert (alg.v(edge[0], edge[1]) == 0)
        source = edge[0]
        target = edge[0] + (1 << edge[1])
        source_res = self.get_res(source)
        target_res = self.get_res(target)
        a = self.braid.get_x_diagram()[edge[1]]
        bmap = [None for _ in range(self.get_res_len(source))]
        d = [-1, -1]
        for j in range(self.get_res_len(target)):
            #arrow tail in target ?
            if a[2] in target_res[j]:

                assert (d[1] == -1)
                d[1] = j
            for i in range(self.get_res_len(source)):
                #if not involved in the split
                if a[0] not in source_res[i]:
                    if source_res[i][0] in target_res[j]:
                        bmap[i] = (j, 1)
                #if involved in the split
                else:
                    #arrow head in target ?
                    if a[0] in target_res[j]:
                        bmap[i] = (j, 1)
                        assert (d[0] == -1)
                        d[0] = j
        imap = self.induced_map(edge[0], bmap)
        map0 = [{} for _ in range(len(imap))]
        map1 = [{} for _ in range(len(imap))]
        for i in range(len(imap)):
            for key in imap[i]:
                if (key >> d[0]) % 2 == 0:
                    sign = 1
                    for j in range(d[0]):
                        if (key >> j) % 2 == 1:
                            sign *= -1
                    map0[i][key + (1 << d[0])] = -imap[i][key] * sign
                if (key >> d[1]) % 2 == 0:
                    sign = 1
                    for j in range(d[1]):
                        if (key >> j) % 2 == 1:
                            sign *= -1
                    map1[i][key + (1 << d[1])] = imap[i][key] * sign
        self.add_algebra_maps(map0, map1)
        return map0
Exemple #6
0
 def make_graded_matrix_set(self):
     matrix_set = [{} for _ in range(self.d + 2)]
     dim, index = self.make_graded_entry_dictionary_set()
     for r in range(self.d):
         for grade in dim[r]:
             matrix_set[r][grade] = [[0 for _ in range(dim[r][grade])]
                                     for _ in range(dim[r +
                                                        1].get(grade, 0))]
         self.verticals(r)
         for v, g in self.verticals:
             grade = self.grade(v, g)
             for i in range(self.d):
                 if alg.v(v, i) == 0:
                     u = v + (1 << i)
                     for h in self.maps[v, i][g]:
                         value = self.maps[v, i][g][h]
                         matrix_set[r][grade][index[r + 1][grade][u, h]][
                             index[r][grade][v, g]] = value
     return dim, matrix_set
Exemple #7
0
 def get_res(self,v):
     assert (v < (1<<self.d))
     if self.res[v]:
         return self.res[v]
     if not self.x_diagram:
         self.get_x_diagram()
     sym = []
     sym[:] = self.closure[:]
     for i in range(self.d):
         if alg.v(v,i) == 0:
             a,b = self.zero_smoothing(self.x_diagram[i])
         else:
             a,b = self.one_smoothing(self.x_diagram[i])
         sym.append(a)
         sym.append(b)
     self.res[v] = self.sym_to_circles(sym)
     self.res_len[v] = len(self.res[v])
     #print(v,self.res[v])
     return self.res[v]
Exemple #8
0
 def make_matrix(self, r, column, row, augmented=False):
     n, row_i = self.make_row_dictionary(r + 1, row)
     m, col_i = self.make_column_dictionary(r, column)
     col_labels = [None for _ in range(m)]
     for key in col_i:
         col_labels[col_i[key]] = key
     M = [[0 for _ in range(m)] for _ in range(n)]
     column(r)
     for v, g in column:
         for i in range(self.d):
             if alg.v(v, i) == 0:
                 u = v + (1 << i)
                 for h in self.maps[v, i][g]:
                     M[row_i[u, h]][col_i[v, g]] = self.maps[v, i][g][h]
     if augmented:
         col_labels.append((0, 0))
         inv_v = self.inv_v
         inv_g = (1 << self.get_res_len(inv_v)) - 1
         for row in row_i:
             if row == (inv_v, inv_g):
                 M[row_i[row]].append(1)
             else:
                 M[row_i[row]].append(0)
     return M, col_labels
Exemple #9
0
 def is_edge(self, edge):
     if alg.v(*edge):
         return False
     return True