Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import combinations
- def level(M):
- return M.denominator() # not documented enough :(
- def create_matrix(CT):
- AS = RootSystem(CT).ambient_space()
- return Matrix([[r.associated_coroot().inner_product(v) for r in AS.positive_roots()] for v in AS.fundamental_weights()])
- def calculate_levels(CT):
- M = create_matrix(CT)
- allrows = list(range(M.nrows()))
- res = dict()
- print(binomial(M.ncols(), M.nrows()))
- # for cols in Subsets(range(M.ncols()), M.nrows()): # much slower?
- for cols in combinations(range(M.ncols()), M.nrows()):
- res[cols]=0
- try:
- sM = M[allrows, cols].inverse()
- res[cols] = level(sM)
- except:
- res[cols] = 0
- return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement