My first quantum circuit used a combination of Hadamard gates and CNOT gates to create a superposition state.
OPENQASM 2.0;
include "qelib1.inc";
qubit q[1]; <--register a qubit
H q[0]; <-- Hadamard gate that creates superposition
cx q[0],q[1]; <- controlled NOT gate - flips one qubit
measure q[0] ->
c[0]; measure q[1] -> c[1]; <----measuring the distance between the 2 particles
This is the code for sending a message to the future, but we need actual particles to do this:
OPENQASM 2.0;
include "qelib1.inc";
qreg q[5]; <--- placing quibits in the register
creg c[8]; <---- placing quibits in the register
h q[0]; <---- gate to send the quibits through. Gates are mathematical equations.
x q[0]; <---- gate to send the quibits through.
x q[1]; <---- gate to send the quibits through.
creg[0] = [place binary coded message here];
So, we were getting an error with the semicolons. That's why I needed help. John tried to trouble shoot but nothing worked.
I am still studying these simple programs to understand them, but I'm getting there.
OPENQASM 2.0;
include "qelib1.inc";
qubit q[1]; <--register a qubit
H q[0]; <-- Hadamard gate that creates superposition
cx q[0],q[1]; <- controlled NOT gate - flips one qubit
measure q[0] ->
c[0]; measure q[1] -> c[1]; <----measuring the distance between the 2 particles
This is the code for sending a message to the future, but we need actual particles to do this:
OPENQASM 2.0;
include "qelib1.inc";
qreg q[5]; <--- placing quibits in the register
creg c[8]; <---- placing quibits in the register
h q[0]; <---- gate to send the quibits through. Gates are mathematical equations.
x q[0]; <---- gate to send the quibits through.
x q[1]; <---- gate to send the quibits through.
creg[0] = [place binary coded message here];
So, we were getting an error with the semicolons. That's why I needed help. John tried to trouble shoot but nothing worked.
I am still studying these simple programs to understand them, but I'm getting there.
Last edited: