Skip to content

Commit

Permalink
Add Open Graph tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wlcsm committed Jul 30, 2024
1 parent b2f05d4 commit 59108c0
Show file tree
Hide file tree
Showing 21 changed files with 991 additions and 18 deletions.
31 changes: 31 additions & 0 deletions tests/circuits/adder_n4.qasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
OPENQASM 2.0;
include "qelib1.inc";
qreg q[4];
creg c[4];
x q[0];
x q[1];
h q[3];
cx q[2],q[3];
t q[0];
t q[1];
t q[2];
tdg q[3];
cx q[0],q[1];
cx q[2],q[3];
cx q[3],q[0];
cx q[1],q[2];
cx q[0],q[1];
cx q[2],q[3];
tdg q[0];
tdg q[1];
tdg q[2];
t q[3];
cx q[0],q[1];
cx q[2],q[3];
s q[3];
cx q[3],q[0];
h q[3];
measure q[0] -> c[0];
measure q[1] -> c[1];
measure q[2] -> c[2];
measure q[3] -> c[3];
56 changes: 56 additions & 0 deletions tests/circuits/bell_n4.qasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Generated from Cirq v0.8.0

OPENQASM 2.0;
include "qelib1.inc";


// Qubits: [(0, 0), (0, 1), (1, 0), (1, 1)]
qreg q[4];
creg m_b[1];
creg m_y[1];
creg m_a[1];
creg m_x[1];


h q[0];
h q[1];
h q[3];
cx q[0],q[2];
rx(pi*-0.25) q[0];

// Gate: CNOT**0.5
ry(pi*-0.5) q[2];
u3(pi*0.5,0,pi*0.75) q[3];
u3(pi*0.5,0,pi*0.25) q[2];
rx(pi*0.5) q[3];
cx q[3],q[2];
rx(pi*0.25) q[3];
ry(pi*0.5) q[2];
cx q[2],q[3];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[3],q[2];
u3(pi*0.5,pi*0.5,pi*1.0) q[3];
u3(pi*0.5,pi*1.0,pi*1.0) q[2];
ry(pi*0.5) q[2];

// Gate: CNOT**0.5
ry(pi*-0.5) q[0];
u3(pi*0.5,0,pi*0.75) q[1];
u3(pi*0.5,0,pi*0.25) q[0];
rx(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*0.25) q[1];
ry(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*-0.5) q[0];
rz(pi*0.5) q[0];
cx q[1],q[0];
u3(pi*0.5,pi*0.5,pi*1.0) q[1];
u3(pi*0.5,pi*1.0,pi*1.0) q[0];
ry(pi*0.5) q[0];

measure q[2] -> m_b[0];
measure q[3] -> m_y[0];
measure q[0] -> m_a[0];
measure q[1] -> m_x[0];
14 changes: 14 additions & 0 deletions tests/circuits/cat_state_n4.qasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
OPENQASM 2.0;
include "qelib1.inc";
qreg bits[4];
creg c[4];

h bits[0];
cx bits[0],bits[1];
cx bits[1],bits[2];
cx bits[2],bits[3];

measure bits[0] -> c[0];
measure bits[1] -> c[1];
measure bits[2] -> c[2];
measure bits[3] -> c[3];
14 changes: 14 additions & 0 deletions tests/circuits/deutsch_n2.qasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Implementation of Deutsch algorithm with two qubits for f(x)=x
OPENQASM 2.0;
include "qelib1.inc";

qreg q[2];
creg c[2];

x q[1];
h q[0];
h q[1];
cx q[0],q[1];
h q[0];
measure q[0] -> c[0];
measure q[1] -> c[1];
272 changes: 272 additions & 0 deletions tests/circuits/dnn_n2.qasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
// A TWO QUBIT CIRCIUT 3 LAYERS DEEP
// Generated from Cirq v0.8.0

OPENQASM 2.0;
include "qelib1.inc";

// Qubits: [(0, 0), (0, 1)]
qreg q[2];
creg ans[2];

rx(pi*0.3501408748) q[0];
ry(pi*0.3501408748) q[0];
rz(pi*0.3501408748) q[0];
rx(pi*0.3501408748) q[1];
ry(pi*0.3501408748) q[1];
rz(pi*0.3501408748) q[1];

// Gate: ZZ**1.1
rz(pi*1.1) q[0];
rz(pi*1.1) q[1];
u3(pi*0.5,0,pi*0.25) q[0];
u3(pi*0.5,pi*1.0,pi*0.75) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.4) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*0.5,pi*0.65,pi*1.0) q[0];
u3(pi*0.5,pi*0.15,0) q[1];

// Gate: YY**1.1
u3(0,pi*1.0,pi*0.5) q[0];
u3(0,0,pi*0.5) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.4) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*1.0,0,pi*0.5) q[0];
u3(pi*1.0,0,pi*1.5) q[1];

// Gate: XX**1.1
u3(pi*0.5,pi*1.5,pi*1.5) q[0];
u3(pi*0.5,pi*0.5,pi*1.5) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.4) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*0.5,pi*0.5,pi*0.5) q[0];
u3(pi*0.5,pi*0.5,pi*1.5) q[1];

rx(pi*0.3501408748) q[0];
ry(pi*0.3501408748) q[0];
rz(pi*0.3501408748) q[0];
rx(pi*0.3501408748) q[1];
ry(pi*0.3501408748) q[1];
rz(pi*0.3501408748) q[1];
rx(pi*0.3501408748) q[1];
ry(pi*0.3501408748) q[1];
rz(pi*0.3501408748) q[1];
rx(pi*0.3501408748) q[0];
ry(pi*0.3501408748) q[0];
rz(pi*0.3501408748) q[0];

// Gate: ZZ**1.1
rz(pi*1.1) q[1];
rz(pi*1.1) q[0];
u3(pi*0.5,0,pi*0.25) q[1];
u3(pi*0.5,pi*1.0,pi*0.75) q[0];
rx(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*0.4) q[1];
ry(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*-0.5) q[0];
rz(pi*0.5) q[0];
cx q[1],q[0];
u3(pi*0.5,pi*0.65,pi*1.0) q[1];
u3(pi*0.5,pi*0.15,0) q[0];

// Gate: YY**1.1
u3(0,pi*1.0,pi*0.5) q[1];
u3(0,0,pi*0.5) q[0];
rx(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*0.4) q[1];
ry(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*-0.5) q[0];
rz(pi*0.5) q[0];
cx q[1],q[0];
u3(pi*1.0,0,pi*0.5) q[1];
u3(pi*1.0,0,pi*1.5) q[0];

// Gate: XX**1.1
u3(pi*0.5,pi*1.5,pi*1.5) q[1];
u3(pi*0.5,pi*0.5,pi*1.5) q[0];
rx(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*0.4) q[1];
ry(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*-0.5) q[0];
rz(pi*0.5) q[0];
cx q[1],q[0];
u3(pi*0.5,pi*0.5,pi*0.5) q[1];
u3(pi*0.5,pi*0.5,pi*1.5) q[0];

rx(pi*0.3501408748) q[1];
ry(pi*0.3501408748) q[1];
rz(pi*0.3501408748) q[1];
rx(pi*0.3501408748) q[0];
ry(pi*0.3501408748) q[0];
rz(pi*0.3501408748) q[0];

// Gate: CNOT**1.1
ry(pi*-0.5) q[1];
u3(pi*0.5,0,pi*0.25) q[0];
u3(pi*0.5,pi*1.0,pi*0.75) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.05) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*0.5,pi*0.3,pi*1.0) q[0];
u3(pi*0.5,pi*1.8,0) q[1];
ry(pi*0.5) q[1];

// Gate: CZ**1.1
u3(pi*0.5,0,pi*0.25) q[0];
u3(pi*0.5,pi*1.0,pi*0.75) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.05) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*0.5,pi*0.3,pi*1.0) q[0];
u3(pi*0.5,pi*1.8,0) q[1];

rx(pi*0.3501408748) q[0];
ry(pi*0.3501408748) q[0];
rz(pi*0.3501408748) q[0];
rx(pi*0.3501408748) q[1];
ry(pi*0.3501408748) q[1];
rz(pi*0.3501408748) q[1];

// Gate: ZZ**1.1
rz(pi*1.1) q[0];
rz(pi*1.1) q[1];
u3(pi*0.5,0,pi*0.25) q[0];
u3(pi*0.5,pi*1.0,pi*0.75) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.4) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*0.5,pi*0.65,pi*1.0) q[0];
u3(pi*0.5,pi*0.15,0) q[1];

// Gate: YY**1.1
u3(0,pi*1.0,pi*0.5) q[0];
u3(0,0,pi*0.5) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.4) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*1.0,0,pi*0.5) q[0];
u3(pi*1.0,0,pi*1.5) q[1];

// Gate: XX**1.1
u3(pi*0.5,pi*1.5,pi*1.5) q[0];
u3(pi*0.5,pi*0.5,pi*1.5) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.4) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*0.5,pi*0.5,pi*0.5) q[0];
u3(pi*0.5,pi*0.5,pi*1.5) q[1];

rx(pi*0.3501408748) q[0];
ry(pi*0.3501408748) q[0];
rz(pi*0.3501408748) q[0];
rx(pi*0.3501408748) q[1];
ry(pi*0.3501408748) q[1];
rz(pi*0.3501408748) q[1];
rx(pi*0.3501408748) q[1];
ry(pi*0.3501408748) q[1];
rz(pi*0.3501408748) q[1];
rx(pi*0.3501408748) q[0];
ry(pi*0.3501408748) q[0];
rz(pi*0.3501408748) q[0];

// Gate: ZZ**1.1
rz(pi*1.1) q[1];
rz(pi*1.1) q[0];
u3(pi*0.5,0,pi*0.25) q[1];
u3(pi*0.5,pi*1.0,pi*0.75) q[0];
rx(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*0.4) q[1];
ry(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*-0.5) q[0];
rz(pi*0.5) q[0];
cx q[1],q[0];
u3(pi*0.5,pi*0.65,pi*1.0) q[1];
u3(pi*0.5,pi*0.15,0) q[0];

// Gate: YY**1.1
u3(0,pi*1.0,pi*0.5) q[1];
u3(0,0,pi*0.5) q[0];
rx(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*0.4) q[1];
ry(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*-0.5) q[0];
rz(pi*0.5) q[0];
cx q[1],q[0];
u3(pi*1.0,0,pi*0.5) q[1];
u3(pi*1.0,0,pi*1.5) q[0];

// Gate: XX**1.1
u3(pi*0.5,pi*1.5,pi*1.5) q[1];
u3(pi*0.5,pi*0.5,pi*1.5) q[0];
rx(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*0.4) q[1];
ry(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*-0.5) q[0];
rz(pi*0.5) q[0];
cx q[1],q[0];
u3(pi*0.5,pi*0.5,pi*0.5) q[1];
u3(pi*0.5,pi*0.5,pi*1.5) q[0];

rx(pi*0.3501408748) q[1];
ry(pi*0.3501408748) q[1];
rz(pi*0.3501408748) q[1];
rx(pi*0.3501408748) q[0];
ry(pi*0.3501408748) q[0];
rz(pi*0.3501408748) q[0];

measure q[0] -> ans[0];
measure q[1] -> ans[1];
Loading

0 comments on commit 59108c0

Please sign in to comment.