timholthuijsen / quantumproject Goto Github PK
View Code? Open in Web Editor NEWRepository for a Quantom Programming Project
Repository for a Quantom Programming Project
The file InefficientNot.py has two consecutive measurements on the same qubit and bit, making the second redundant.
To reproduce the problem I visualized the circuit:
from qiskit import QuantumCircuit
def inefficientNOT(inefficiencies, inp, layout = [0], n_times = 100):
"""
This NOT gate includes an int number of inefficiencies, which determines
how many qc.x gates the NOT will apply. Note that inefficiencies
should always be an odd number for the gate to function as a not
"""
qc = QuantumCircuit(1, 1) # A quantum circuit with a single qubit and a single classical bit
qc.reset(0)
if inp=='1':
qc.x(0)
qc.barrier()
"""We apply a predefined number of inefficiencies.
Unfortunately, and contrary to our expectations, this did not yield a decreased
accuracy result when running on a quantum computer. For the inefficiency-reduced accuracy,
we will use the NOT() function instead"""
for i in range(inefficiencies):
print(i+1, "x gates have been added")
qc.x(0)
#barrier between gate operation and measurement
qc.barrier()
qc.measure(0,0)
trial = qc.measure(0,0)
return qc
# OMITTED CODE
qc = inefficientNOT(
inefficiencies=3,
inp='1',
)
qc.draw()
Output:
1 x gates have been added
2 x gates have been added
3 x gates have been added
┌───┐ ░ ┌───┐┌───┐┌───┐ ░ ┌─┐┌─┐
q: ─|0>─┤ X ├─░─┤ X ├┤ X ├┤ X ├─░─┤M├┤M├
└───┘ ░ └───┘└───┘└───┘ ░ └╥┘└╥┘
c: 1/════════════════════════════════╩══╩═
0 0
Where two measurements are added.
I would have expected a single measurement since adding two measurements on the same qubit and bit is redundant and makes the circuit more complex.
I would remove the second measurement.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.