Does Sage support computing Gr_{F_q}(k,r), the space of k-hyperplanes through the origin in GF(q**r)? I looked around for things like Schubert cells and didn't see anything immediately relevant. I've started to write some stuff for k=2. I may do a PR if it's not already available.
Thanks, Jackson -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/sage-devel/972f2abc-2fb8-40aa-a84a-62a175b7b18bn%40googlegroups.com.
from itertools import combinations, product from sage.all import GF, matrix, vector def schubert_cells_2(q,r): all_cells = {} # Store all Schubert cells F = GF(q) # Finite field of order q indices = list(combinations(range(r), 2)) # Possible pivot column indices for p0, p1 in indices: # Iterate over pivot column pairs all_cells[(p0, p1)] = [] M = matrix(F, 2, r) # Initialize a 2×4 zero matrix M[:, p0] = vector(F, [1, 0]) # Place first pivot column M[:, p1] = vector(F, [0, 1]) # Place second pivot column # Determine free parameter positions free_param_positions = [j for j in range(r) if j not in (p0, p1)] # Rules for free parameters: # - If j is between p0 and p1, assign to the top row # - If j is after p1, assign freely to both rows # - If j is before p0, do not assign any parameter def num_free_params(j): if p0 < j < p1: return 1 if j > p1: return 2 if j < p0: return 0 free_param_counts = [num_free_params(j) for j in free_param_positions] # Generate all possible parameter assignments for params in product(*[list(F)] * sum(free_param_counts)): M_filled = matrix(M) # Copy base matrix param_iter = iter(params) # Iterator over parameter values for j in free_param_positions: if p0 < j < p1: # Free parameter on top row # Directly assign the parameter to the top row M_filled[0, j] = next(param_iter) if j > p1: # Free parameters on both rows # Directly assign the parameters to both rows, no coercion M_filled[:, j] = vector([next(param_iter),next(param_iter)]) all_cells[(p0,p1)].append(M_filled) return all_cells # Example usage: cells = schubert_cells_2(5,4) # Example with F_5 sum(len(cells[(p0, p1)]) for p0, p1 in list(combinations(range(4), 2)))