Introduction to Quantum Computing

Applications

  • Game design
  • Quantum Chemistry to calculate bond lengths between atoms

Setup

Coding

from qiskit import *qr = QuantumRegister(2)
cr = ClassicalRegister(2)
circuit = QuantumCircuit(qr,cr)
circuit.draw()

To build entanglements, we need gates… Hadamard gates.

circuit = circuit.h(qr[0])
circuit.draw(output='mp1')

Controlled X like logical if. Say here control is qr[0] and the target is qr[1]

circuit.cx(qr[0],qr[1])

Measure the qubits, take those bits and store in classical bits

circuit.measure(qr,cr)   #qr=>cr

Simulate the circuit locally using Aer

 simulator = Aer.simulate('qasm-simulator')

Execute the circuit which returns results

result = execute(circuit,backend=simulator).result()

Visualize

from qiskit.tools.visualization import plot_histogram
plot_histogram(result.get_counts(circuit))

Place on Quantum Computer and test

from qiskit import IBMQIBMQ.save('...')IBMQ.load_account()provider = IBMQ.get_provider('ibm-q')qcomp = provider.get_backend('ibmq_16_melbourne')job =  execute(circuit,backend=qcomp)

The job is placed on Qcomp but it doesn't execute immediately. Others might be using the same Qcomp, so it may take time to return. We can monitor the job by job_monitor

from qiskit.tools.monitor import job_monitorjob_monitor(job)result = job.result()

Different ways people discuss the quantum state:

  1. Bracket representation — state vector simulator
  2. Gates can be represented as matrices and operations on it are operations on vectors — unitary simulator
  3. Bloch sphere (visual representation of state) — state vector simulator
  4. How circuit works as a result of measurement — qasm simulator
bracket and matrix representations

[1 0] is state 0> [0 1] is state 1> [0 1, 1 0] is state of X

Gates: https://quantum-computing.ibm.com/docs/circ-comp/q-gates

Quantum Algorithms

Quantum Teleportation:

When we want to copy one qbit info to another, simple copy results in change measurement destroy the state. We take help of entanglement for quantum teleportation.

Bernstein Vazirani Algorithm:

Quantum computer can guess a secret number of n bits in one shot which takes n shots in classical computer.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store