Consolidate QASM examples into the testscripts directory and organize them.

This commit is contained in:
Andrew Cross 2017-05-04 12:47:10 -04:00
parent 44a4aa9bdd
commit 7953920336
288 changed files with 75 additions and 85 deletions

View File

@ -1,2 +0,0 @@
// fist thing is an id_list, not an id
gate x,y a,b { h b; cx a,b; h b; }

View File

@ -1,2 +0,0 @@
reset b
reset c;

View File

@ -1,2 +0,0 @@
if(c0==1) z q[2]
if(c0==1) z q[2];

View File

@ -1,2 +0,0 @@
U (theta,phi, lambda) q
U (theta,phi, lambda) q;

View File

@ -1,2 +0,0 @@
U (theta,phi, lambda);
U (theta,phi, lambda) q;

View File

@ -1,2 +0,0 @@
U (theta,phi lambda) q;
U (theta,phi, lambda) q;

View File

@ -1,2 +0,0 @@
U theta,phi, lambda) q;
U (theta,phi, lambda) q;

View File

@ -1,3 +0,0 @@
CX a,b
CX a,b;

View File

@ -1,38 +0,0 @@
// quantum ripple-carry adder from Cuccaro et al, quant-ph/0410184
OPENQASM 2.0;
include "qelib1.inc";
gate majority a,b,c
{
cx c,b;
cx c,a;
ccx a,b,c;
}
gate unmaj a,b,c
{
ccx a,b,c;
cx c,a;
cx a,b;
}
qreg cin[1];
qreg a[4];
qreg b[4];
qreg cout[1];
creg ans[5];
// set input states
x a[0]; // a = 0001
x b; // b = 1111
// add a to b, storing result in b
majority cin[0],b[0],a[0];
majority a[0],b[1],a[1];
majority a[1],b[2],a[2];
majority a[2],b[3],a[3];
cx a[3],cout[0];
unmaj a[2],b[3],a[3];
unmaj a[1],b[2],a[2];
unmaj a[0],b[1],a[1];
unmaj cin[0],b[0],a[0];
measure b[0] -> ans[0];
measure b[1] -> ans[1];
measure b[2] -> ans[2];
measure b[3] -> ans[3];
measure cout[0] -> ans[4];

View File

@ -1,5 +1,5 @@
// quantum ripple-carry adder from Cuccaro et al, quant-ph/0410184
IBMQASM 2.0;
OPENQASM 2.0;
include "qelib1.inc";
gate majority a,b,c
{

View File

@ -1,5 +1,5 @@
// barriers with different arguments
IBMQASM 2.0;
OPENQASM 2.0;
qreg q[10];
qreg r[2];
qreg v[3];

View File

@ -1,7 +1,7 @@
// quantum ripple-carry adder
// 8-bit adder made out of 2 4-bit adders from adder.qasm
// Cuccaro et al, quant-ph/0410184
IBMQASM 2.0;
OPENQASM 2.0;
include "qelib1.inc";
gate majority a,b,c
{

View File

@ -1,4 +1,5 @@
IBMQASM 2.0;
// parameter expressions and opaque gates
OPENQASM 2.0;
qreg q[1];
qreg r[5];
qreg s[5];

View File

@ -1,4 +1,5 @@
IBMQASM 2.0;
// Test barriers in gates
OPENQASM 2.0;
include "junk.incl";
gate new() a,b,c
{

View File

@ -1,5 +1,5 @@
// Test code generation for a variety of gate call signatures
IBMQASM 2.0;
// Test a variety of gate call signatures
OPENQASM 2.0;
include "qelib1.inc";
gate test1 a, b, c
{

View File

@ -1,5 +1,5 @@
// QFT and measure, version 1
IBMQASM 2.0;
OPENQASM 2.0;
include "qelib1.inc";
qreg q[4];
creg c[4];

View File

@ -1,5 +1,5 @@
// QFT and measure, version 2
IBMQASM 2.0;
OPENQASM 2.0;
include "qelib1.inc";
qreg q[4];
creg c0[1];

View File

@ -1,7 +1,7 @@
// quantum Fourier transform for the Quantum Experience
// on the first 3 qubits
IBMQASM 2.0;
OPENQASM 2.0;
include "qelib1.inc";
// Register declarations

View File

@ -1,7 +1,7 @@
// quantum Fourier transform for the Quantum Experience
// on the first 4 qubits
IBMQASM 2.0;
OPENQASM 2.0;
include "qelib1.inc";
// Register declarations

View File

@ -1,7 +1,7 @@
// quantum Fourier transform for the Quantum Experience
// on all 5 qubits
IBMQASM 2.0;
OPENQASM 2.0;
include "qelib1.inc";
// Register declarations

View File

@ -1,5 +1,5 @@
// Repetition code syndrome measurement
IBMQASM 2.0;
OPENQASM 2.0;
include "qelib1.inc";
qreg q[3];
qreg a[2];

View File

@ -1,4 +1,5 @@
IBMQASM 2.0;
// Example with operations supported on a 5 qubit device
OPENQASM 2.0;
include "qelib1.inc";
qreg q[5];
creg c[5];

View File

@ -35,7 +35,7 @@ gate tdg a { u1(-pi/4) a; }
// --- Standard rotations ---
// Rotation around X-axis
gate rx(theta) a { u3(theta, pi/2,-pi/2) a; }
gate rx(theta) a { u3(theta, -pi/2,pi/2) a; }
// rotation around Y-axis
gate ry(theta) a { u3(theta,0,0) a; }
// rotation around Z axis

View File

@ -1,5 +1,5 @@
// quantum Fourier transform
IBMQASM 2.0;
OPENQASM 2.0;
include "qelib1.inc";
qreg q[4];
creg c[4];

View File

@ -1,4 +1,4 @@
IBMQASM 2.0;
OPENQASM 2.0;
include "qelib1.inc";
gate pre q { } // pre-rotation
gate post q { } // post-rotation

View File

@ -1,5 +1,5 @@
// One randomized benchmarking sequence
IBMQASM 2.0;
OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];

View File

@ -1,5 +1,5 @@
// missingg ;
OPENQASM 2.0;
qreg q[1];
U(0.3*0.2/1, cos(0.3*pi)*.1, 0) q[0]
U(0.3*0.2/1, cos(0.3*pi)*.1, 0) q[0];

View File

@ -0,0 +1,2 @@
// first thing is an id_list, not an id
gate x,y a,b { h b; cx a,b; h b; }

View File

@ -1,4 +1,8 @@
// missing ';' in body of gate
gate h a { }
gate t a { }
gate tdg a { }
gate cx a,b { }
gate ccx a,b,c
{
h c;

View File

@ -1,4 +1,4 @@
// missing }
gate h a { }
gate cx a,b { h b;
gate cy a,b { h b; cx a,b; h b; }

View File

@ -1,5 +1,5 @@
// missingg ; in magic
IBMQASM 2.0
OPENQASM 2.0
U(0.3*0.2/1, cos(0.3*pi)*.1, 0) q[0];
U(0.3*0.2/1, cos(0.3*pi)*.1, 0) q[0];

Some files were not shown because too many files have changed in this diff Show More