Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168759
Image: ubuntu2004
def rcd(g, ancilla): # Maybe some Check Up here if g is of correct format # Creating Graph G = Graph(g, boundary = ancilla) # Required Matrix and Vector Space, p-list and Field F = GF(2) p = G.vertices() MS = MatrixSpace(F, G.order()) V = VectorSpace(F, G.order()) for x in G.get_boundary(): p.remove(x) # Creating subspace SemiSubSpace = V.basis_matrix().matrix_from_rows(p).row_space() SubSpace = SemiSubSpace.direct_sum(SemiSubSpace) # Creating Generator Matrix and Stabilizer Space adj = MS(G.adjacency_matrix()) Mgenerator = block_matrix([MS.identity_matrix(), adj], ncols = 2) Stabilizer = Mgenerator.row_space() # Projection onto spanned subspace TraceOut = Stabilizer.intersection(SubSpace) return TraceOut
@interact def _(graph = input_box(default = {0:[1], 1:[2], 2:[3], 3:[4], 5:[0]}, label = 'Insert Graph here:',type = dict), ancilla = input_box(default = [0], label = 'Ancilla Vertices', type = list)): p = rcd(graph, ancilla) Graph(graph).plot print p
Insert Graph here: 
Ancilla Vertices 
[removed]
[removed]
[removed]
[removed]