From 2ee6e363a6d8ffd0eb4527c7f5a6aa88def4ee1d Mon Sep 17 00:00:00 2001 From: Boldi Date: Tue, 25 Jun 2024 20:57:32 +0100 Subject: [PATCH] Fix error arising from using `.value` --- pyzx/rules.py | 4 ++-- pyzx/tensor.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyzx/rules.py b/pyzx/rules.py index 1b396a5e..89b2b789 100644 --- a/pyzx/rules.py +++ b/pyzx/rules.py @@ -227,7 +227,7 @@ def spider(g: BaseGraph[VT,ET], matches: List[MatchSpiderType[VT]]) -> RewriteOu if v0 == w: continue e = (v0,w) if e not in etab: etab[e] = [0,0] - etab[e][g.edge_type(g.edge(v1,w)).value - 1] += 1 + etab[e][g.edge_type(g.edge(v1,w)) - 1] += 1 return (etab, rem_verts, [], True) def unspider(g: BaseGraph[VT,ET], m: List[Any], qubit:FloatInt=-1, row:FloatInt=-1) -> VT: @@ -363,7 +363,7 @@ def w_fusion(g: BaseGraph[VT,ET], matches: List[MatchSpiderType[VT]]) -> Rewrite w = v0_out e = (v0_out, w) if e not in etab: etab[e] = [0,0] - etab[e][g.edge_type(g.edge(v1_out, w)).value - 1] += 1 + etab[e][g.edge_type(g.edge(v1_out, w)) - 1] += 1 return (etab, rem_verts, [], True) diff --git a/pyzx/tensor.py b/pyzx/tensor.py index ef1276c0..1e931fc9 100644 --- a/pyzx/tensor.py +++ b/pyzx/tensor.py @@ -163,7 +163,7 @@ def tensorfy(g: 'BaseGraph[VT,ET]', preserve_scalar:bool=True) -> np.ndarray: raise ValueError("Vertex %s has non-ZXH type but is not an input or output" % str(v)) nn = list(filter(lambda n: rows[n]