Skip to content

Commit

Permalink
🔀 Merge pull request #54 from DVLab-NTU/bug/zx2ts-transpose
Browse files Browse the repository at this point in the history
Bug/zx2ts transpose
  • Loading branch information
JoshuaLau0220 authored Feb 9, 2024
2 parents d3865dc + cf3029b commit 8ac4ba8
Show file tree
Hide file tree
Showing 3 changed files with 196 additions and 226 deletions.
16 changes: 8 additions & 8 deletions src/convert/qcir_to_zxgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ create_multi_control_backbone(ZXGraph& g, std::vector<QubitInfo> const& qubits,
g.add_edge(in, v, EdgeType::hadamard);
g.add_edge(v, out, EdgeType::hadamard);
if (ax == RotationAxis::y) {
g.add_buffer(in, v, EdgeType::hadamard)->set_phase(dvlab::Phase(1, 2));
g.add_buffer(out, v, EdgeType::hadamard)->set_phase(dvlab::Phase(-1, 2));
g.add_buffer(in, v, EdgeType::hadamard)->set_phase(dvlab::Phase(-1, 2));
g.add_buffer(out, v, EdgeType::hadamard)->set_phase(dvlab::Phase(1, 2));
}
}
if (!bitinfo._isTarget)
Expand Down Expand Up @@ -372,14 +372,14 @@ ZXGraph create_ry_zx_form(QCirGate* gate, dvlab::Phase ph) {
auto qubit = gate->get_qubits()[0]._qubit;

ZXVertex* in = g.add_input(qubit);
ZXVertex* s = g.add_vertex(qubit, VertexType::z, dvlab::Phase(1, 2));
ZXVertex* sx = g.add_vertex(qubit, VertexType::x, ph);
ZXVertex* sdg = g.add_vertex(qubit, VertexType::z, dvlab::Phase(-1, 2));
ZXVertex* rx = g.add_vertex(qubit, VertexType::x, ph);
ZXVertex* s = g.add_vertex(qubit, VertexType::z, dvlab::Phase(1, 2));
ZXVertex* out = g.add_output(qubit);
g.add_edge(in, s, EdgeType::simple);
g.add_edge(s, sx, EdgeType::simple);
g.add_edge(sx, sdg, EdgeType::simple);
g.add_edge(sdg, out, EdgeType::simple);
g.add_edge(in, sdg, EdgeType::simple);
g.add_edge(sdg, rx, EdgeType::simple);
g.add_edge(rx, s, EdgeType::simple);
g.add_edge(s, out, EdgeType::simple);

return g;
}
Expand Down
Loading

0 comments on commit 8ac4ba8

Please sign in to comment.