Introduction to Quantum Computing

Applications

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:

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.

Consultant