def test_compute_maps(root_system, mu): bgg = BGGComplex(root_system) ws = WeightSet.from_bgg(bgg) mu = ws.make_dominant(mu)[0] # make sure weight is dominant mapsolver= BGGMapSolver(bgg,mu) mapsolver.solve() assert mapsolver.check_maps()==True
def test_trivial_module(root_system): bgg = BGGComplex(root_system) factory = ModuleFactory(bgg.LA) component_dic = {"g": factory.build_component("g", "coad")} components = [[("g", 1, "wedge")]] module = LieAlgebraCompositeModule(factory, components, component_dic) assert bgg.LA.dimension() == module.total_dimension
def test_cohom1(root_system): r""":math:`H^k(X,\mathfrak b)=0` for all k and for all types.""" BGG = BGGComplex(root_system) factory = ModuleFactory(BGG.LA) component_dic = {"b": factory.build_component("b", "coad")} components = [[("b", 1, "wedge")]] module = LieAlgebraCompositeModule(factory, components, component_dic) bggcohom = BGGCohomology(BGG, module) all_degrees = range(BGG.max_word_length + 1) for i in all_degrees: assert bggcohom.betti_number(bggcohom.cohomology(i)) == 0
def test_total_trivial_dim(root_system): """Total dimension of principal block is given by (h+1)**r, with h coxeter number and r the rank. """ BGG = BGGComplex(root_system) mu = (0,)*BGG.rank total_betti = 0 for a,b,i,j,k in all_abijk(BGG): coker = Eijk_basis(BGG,j,k) cohom = BGGCohomology(BGG, Mjk(BGG,j,k),coker=coker) total_betti+=cohom.betti_number(cohom.cohomology(i, mu=mu)) theoretical_dim = (2*len(BGG.neg_roots)/BGG.rank+1)**BGG.rank assert theoretical_dim == total_betti
def test_adjoint_action_parabolic(root_system, subset): bgg = BGGComplex(root_system) factory = ModuleFactory(bgg.LA) component = factory.build_component("p", "ad", subset=subset) for (i, j), Cijk in component.action.items(): Li = factory.index_to_lie_algebra[i] Lj = factory.index_to_lie_algebra[j] Lij = Li.bracket(Lj) from_coeffs = sum(factory.index_to_lie_algebra[k] * c for k, c in Cijk.items()) if from_coeffs - Lij != 0: raise AssertionError( "Structure coefficients of action are incorrect")
def main(): parser = argparse.ArgumentParser(description="Produce table from .pkl file") parser.add_argument("diagram") parser.add_argument("--compact", default=True) parser.add_argument("-s", default=0, type=int) parser.add_argument("--subset", default="", type=str) args = parser.parse_args() print(vars(args)) os.makedirs("pickles", exist_ok=True) os.makedirs("tables", exist_ok=True) diagram = args.diagram s = args.s compact = args.compact if len(args.subset) == 0: subset = [] else: try: subset = [int(x) for x in args.subset.strip().split(",")] except: raise ValueError(f"argument --subset inproperly formated: {args.subset}") # the parameters we actually want to change BGG = BGGComplex(diagram) compact = True picklefile = os.path.join("pickles", f"{diagram}-s{s}-{subset}.pkl") cohom_dic = pickle.load(open(picklefile, "rb")) cohom = BGGCohomology(BGG) abijk = all_abijk(BGG, s=s, subset=subset, half_only=False) max_a = max(x[0] for x in abijk) cohom_dic = extend_from_symmetry(cohom_dic, max_a=max_a) for a, b, i, j, k in all_abijk(BGG, s=s, subset=subset, half_only=False): if (a, b) not in cohom_dic: cohom_dic[(a, b)] = None latex_dic = {k: cohom.cohom_to_latex(c, compact=compact) for k, c in cohom_dic.items()} betti_dic = {k: cohom.betti_number(c) for k, c in cohom_dic.items()} tab1 = display_bigraded_table(latex_dic, text_only=True) tab2 = display_bigraded_table(betti_dic, text_only=True) tab3 = display_cohomology_stats(cohom_dic, BGG, text_only=True) texfile = os.path.join("tables", f"{diagram}-s{s}-{subset}.tex") with open(texfile, "w") as f: f.write( prepare_texfile( [tab1, tab2, tab3], title=f"type {diagram}, s={s}, subset={subset}" ) )
def test_init_weight_set(root_system, mu, from_bgg, w): if from_bgg: bgg = BGGComplex(root_system) ws = WeightSet.from_bgg(bgg) else: ws = WeightSet(root_system) assert ws.weight_to_tuple(ws.tuple_to_weight(mu)) == mu def sage_dot_action(w, mu): w_sage = ws.weyl_dic[w] mu_sage = ws.tuple_to_weight(mu) new_mu = w_sage.action(mu_sage + ws.rho) - ws.rho return ws.weight_to_tuple(new_mu) assert sage_dot_action(w, mu) == tuple(ws.dot_action(w, mu))
def test_cohom2(root_system): r""":math:`H^k(X,\mathfrak b\otimes \mathfrak u)=0` for all k>0 in type An, n>1""" BGG = BGGComplex(root_system) factory = ModuleFactory(BGG.LA) component_dic = { "b": factory.build_component("b", "coad"), "u": factory.build_component("u", "coad"), } components = [[("b", 1, "wedge"), ("u", 1, "wedge")]] module = LieAlgebraCompositeModule(factory, components, component_dic) cohom = BGGCohomology(BGG, module) bggcohom = BGGCohomology(BGG, module) assert bggcohom.betti_number(bggcohom.cohomology(0)) == 1 all_degrees = range(1, BGG.max_word_length + 1) for i in all_degrees: assert bggcohom.betti_number(bggcohom.cohomology(i)) == 0
def test_signs(root_system): bgg = BGGComplex(root_system) signs = compute_signs(bgg) assert check_signs(bgg, signs) == True
def test_coker(root_system, action_type, subset): """Use fact that coker(^2b->bxb) = sym^2b""" BGG = BGGComplex(root_system) factory = ModuleFactory(BGG.LA) component_dic = { "b": factory.build_component("b", action_type, subset=subset) } wedge_components = [[("b", 2, "wedge")]] wedge_module = LieAlgebraCompositeModule(factory, wedge_components, component_dic) tensor_components = [[("b", 1, "wedge"), ("b", 1, "wedge")]] tensor_module = LieAlgebraCompositeModule(factory, tensor_components, component_dic) sym_components = [[("b", 2, "sym")]] sym_module = LieAlgebraCompositeModule(factory, sym_components, component_dic) # Store cokernel in a dictionary # each key is a weight, each entry is a matrix encoding the basis of the cokernel T = dict() for mu in wedge_module.weight_components.keys(): # Basis of the weight component mu of the wedge module wedge_basis = wedge_module.weight_components[mu][0][1] # Build the matrix as a sparse matrix sparse_mat = dict() for wedge_index, wedge_row in enumerate(wedge_basis): a, b = wedge_row # each row consists of two indices # dictionary sending tuples of (a,b,0) to their index in the basis of tensor product module target_dic = tensor_module.weight_comp_index_numbers[mu] # look up index of a\otimes b and b\otimes a, and assign respective signs +1, -1 index_1 = target_dic[(a, b, 0)] index_2 = target_dic[(b, a, 0)] sparse_mat[(wedge_index, index_1)] = 1 sparse_mat[(wedge_index, index_2)] = -1 # Build a matrix from these relations M = matrix( ZZ, sparse_mat, nrows=wedge_module.dimensions[mu], ncols=tensor_module.dimensions[mu], sparse=True, ) # Cokernel is kernel of transpose T[mu] = M.transpose().kernel().basis_matrix() bggcohom1 = BGGCohomology(BGG, tensor_module, coker=T) bggcohom2 = BGGCohomology(BGG, sym_module) all_degrees = range(BGG.max_word_length + 1) for i in all_degrees: betti1 = bggcohom1.betti_number(bggcohom1.cohomology(i)) betti2 = bggcohom2.betti_number(bggcohom2.cohomology(i)) assert betti1 == betti2