Quantum Computing

1 minute read

Published:

This post covers .

Basic Ideas

  • The Quantum Computing

  • For the simplest programs with very few bits, it is useful to represent this process in a diagram known as a circuit diagram.

  • The extraction of outputs in a quantum circuit is done using an operation called measure_all()

    CNOT - the controlled-NOT gate. CNOT gate takes two qubits- one control qubit and other as target bit


from qiskit import QuantumCircuit
from qiskit.providers.aer import AerSimulator
sim = AerSimulator() # make simulator object
#Create quantum circuit with 2 qubits and 2 classical bits
qc = QuantumCircuit(2, 2)
qc.x(0)
qc.cx(0,1)
qc.measure([0,1],[0,1])
display(qc.draw())
job = sim.run(qc)      # run the experiment
result= job.result()

#interpret the results as "counts" dictionary
print("Result: ", result.get_counts())

Toffile - The Toffoli gate, invented by Tommaso Toffoli,It is also known as the controlled-controlled-not gate, which describes its action. It has 3-qubit inputs and outputs; if the first two bits are control qubits 1, it inverts the third bit, otherwise all bits stay the same. It is basically an AND gate

from qiskit import QuantumCircuit
from qiskit.providers.aer import AerSimulator
qc= QuantumCircuit(4,2)
qc.cx(0,2)
qc.cx(1,2)
qc.ccx(0,1,3)
display(qc.draw())
  • Design a Half Adder using Quantum Circuits