Skip to content

Commit

Permalink
data: syc sl medium circuits
Browse files Browse the repository at this point in the history
  • Loading branch information
evmckinney9 committed Oct 12, 2023
1 parent 76d4c62 commit 1c9c435
Show file tree
Hide file tree
Showing 9 changed files with 259 additions and 207 deletions.
17 changes: 10 additions & 7 deletions src/circuits/d02_syc_cnot.qasm
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
OPENQASM 2.0;
include "qelib1.inc";
gate unitary q0,q1 { u(pi/2,pi/2,0) q0; u(0.7297147035725542,-pi/2,pi/2) q1; cx q0,q1; u(pi/2,-pi/2,-pi/2) q0; u(0.9817498751378533,-0.6405278637538672,-0.6405278637538672) q1; cx q0,q1; u(pi/12,0,pi/2) q0; u(2.090822159332339,-2.446835860047982,2.603927236866438) q1; cx q0,q1; u(pi/2,7*pi/12,pi/2) q0; u(pi/2,-2.1500785622180896,0) q1; }
gate xx_plus_yy(param0,param1) q0,q1 { rz(param1) q0; rz(-pi/2) q1; sx q1; rz(pi/2) q1; s q0; cx q1,q0; ry(-0.5*param0) q1; ry(-0.5*param0) q0; cx q1,q0; sdg q0; rz(-pi/2) q1; sxdg q1; rz(pi/2) q1; rz(-1.0*param1) q0; }
gate unitary q0,q1 { u(pi,2.560414061120464,0.9896177343255674) q0; u(0.8410816232223423,pi/2,0) q1; cx q0,q1; u(pi,-2.971674198862732,1.740714781521957) q0; u(1.5538639737106923,-1.3766364974562635,1.7442327895581347) q1; cx q0,q1; u(0,-1.5984590971903003,1.8602584849894495) q0; u(2.411877950017239,-11*pi/12,pi/2) q1; }
qreg q[2];
u3(6.283178916958845,-5.310676059768193,2.955803032132598) q[0];
u3(2.4215892860297674,-2.6661463510241687,-5.130855062916504) q[1];
u3(3.141593246276017,-1.9472550734092864,-0.8063412513592849) q[0];
u3(-2.869526226763068,-0.474733334614634,-3.065753336011342) q[1];
xx_plus_yy(pi,0) q[0],q[1];
unitary q[0],q[1];
u3(-4.640529553270085,-2.288356128133611,-5.772303062133274) q[0];
u3(3.1415944729511582,3.329859232412612,-3.7931958671015633) q[1];
u3(-4.6405301697488675,-1.3763444156140188,0.29165637104728814) q[0];
u3(3.141593138679194,-4.076111141274988,2.84706662074429) q[1];
xx_plus_yy(pi,0) q[0],q[1];
unitary q[0],q[1];
u3(-3.1415929067507564,-4.998826848474456,-3.481179229326132) q[0];
u3(-0.9241784618955011,4.370015630501661,-2.474308539104233) q[1];
u3(-1.7567537696660637e-07,3.8825607918364167,0.32890751093079196) q[0];
u3(-4.692028281074731,4.983707983131604,-3.592179770496584) q[1];
22 changes: 13 additions & 9 deletions src/circuits/d02_syc_swap.qasm
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
OPENQASM 2.0;
include "qelib1.inc";
gate unitary q0,q1 { u(pi/2,pi/2,0) q0; u(0.7297147035725542,-pi/2,pi/2) q1; cx q0,q1; u(pi/2,-pi/2,-pi/2) q0; u(0.9817498751378533,-0.6405278637538672,-0.6405278637538672) q1; cx q0,q1; u(pi/12,0,pi/2) q0; u(2.090822159332339,-2.446835860047982,2.603927236866438) q1; cx q0,q1; u(pi/2,7*pi/12,pi/2) q0; u(pi/2,-2.1500785622180896,0) q1; }
gate xx_plus_yy(param0,param1) q0,q1 { rz(param1) q0; rz(-pi/2) q1; sx q1; rz(pi/2) q1; s q0; cx q1,q0; ry(-0.5*param0) q1; ry(-0.5*param0) q0; cx q1,q0; sdg q0; rz(-pi/2) q1; sxdg q1; rz(pi/2) q1; rz(-1.0*param1) q0; }
gate unitary q0,q1 { u(pi,2.560414061120464,0.9896177343255674) q0; u(0.8410816232223423,pi/2,0) q1; cx q0,q1; u(pi,-2.971674198862732,1.740714781521957) q0; u(1.5538639737106923,-1.3766364974562635,1.7442327895581347) q1; cx q0,q1; u(0,-1.5984590971903003,1.8602584849894495) q0; u(2.411877950017239,-11*pi/12,pi/2) q1; }
qreg q[2];
u1(6.633333356317586) q[0];
u3(0.24750256162196735,4.609410253197844,3.2207025068223802) q[1];
u3(-5.397198072508453,-5.569314323004589,1.6434255090271281) q[0];
u3(1.1172608061265474,-2.1466778122001995,0.37032169457557934) q[1];
xx_plus_yy(pi,0) q[0],q[1];
unitary q[0],q[1];
u3(5.0691048685506255,2.5645436208258845,1.6214187869083594) q[0];
u3(6.283182233142859,-4.997181843804259,-0.5593171903794606) q[1];
u3(3.1415879383140024,2.555440712259339,-0.3326293607383059) q[0];
u3(1.363710849033404,-0.8593476790996736,-2.405159602383865) q[1];
xx_plus_yy(pi,0) q[0],q[1];
unitary q[0],q[1];
u3(-3.1415897272350533,-3.2731681671477535,-4.711803785625409) q[0];
u3(-4.355674374763057,-3.3604740329054623,-2.8263375740075616) q[1];
u3(-1.77787724625092,3.8770744608316106,-2.5440412827896415) q[0];
u1(-13.653968168273767) q[1];
xx_plus_yy(pi,0) q[0],q[1];
unitary q[0],q[1];
u3(1.6850557650617017,-3.4180913705760414,-3.133214293072256) q[0];
u3(3.1415961994876516,3.986145231269736,-2.3970427403931414) q[1];
u3(4.25885677763076,2.7712734454416643,-4.2089538700045415) q[0];
u3(1.5474966056908372,-3.46328542878946,-0.12308576405066433) q[1];
4 changes: 3 additions & 1 deletion src/mirror_gates/pass_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ def __init__(
self.use_fast_settings = use_fast_settings
self.coupling = coupling
self.cx_basis = cx_basis
self.syc_basis = syc_basis
self.logger = logger
if self.cx_basis and not syc_basis:
if self.cx_basis and not self.syc_basis:
self.basis_gate = CXGate()
self.gate_costs = 1.0
self.name += r"-$\texttt{CNOT}$"
self.basis_gates = ["u", "cx", "id"]
elif self.syc_basis:
# raise NotImplementedError
self.basis_gate = syc
self.gate_costs = 1.0
self.name += r"-$\texttt{SYC}$"
Expand Down
18 changes: 12 additions & 6 deletions src/mirror_gates/sycamore.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Define the Sycamore gate and its decompositions."""
from qiskit import QuantumCircuit
from qiskit.circuit.equivalence_library import SessionEquivalenceLibrary as sel
from qiskit.circuit.library import CXGate, CZGate, SwapGate, iSwapGate
from qiskit.circuit.library import CZGate, iSwapGate
from qiskit.quantum_info import Operator

qc = QuantumCircuit(2)
Expand All @@ -11,9 +10,16 @@
syc.name = "syc"
syc.params = []

# # Get the directory of the current file
# current_directory = Path(__file__).parent

cx_decomp = QuantumCircuit.from_qasm_file("../circuits/d02_syc_cnot.qasm")
sel.add_equivalence(CXGate(), cx_decomp)
# # Compute the absolute paths to the .qasm files
# cx_decomp_path = current_directory / "../circuits/d02_syc_cnot.qasm"
# swap_decomp_path = current_directory / "../circuits/d02_syc_swap.qasm"

swap_decomp = QuantumCircuit.from_qasm_file("../circuits/d02_syc_swap.qasm")
sel.add_equivalence(SwapGate(), swap_decomp)
# cx_decomp = QuantumCircuit.from_qasm_file(cx_decomp_path)
# cx_decomp = cx_decomp.decompose()
# sel.add_equivalence(CXGate(), cx_decomp)

# swap_decomp = QuantumCircuit.from_qasm_file(swap_decomp_path)
# sel.add_equivalence(SwapGate(), swap_decomp)
2 changes: 1 addition & 1 deletion src/notebooks/results/main_bench/r03_HH_CX_bench.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.17"
"version": "3.10.6"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 1c9c435

Please sign in to comment.