Introduction to Quantum Computing




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

To build entanglements, we need gates… Hadamard gates.

circuit = circuit.h(qr[0])

Controlled X like logical if. Say here control is qr[0] and the target is qr[1][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()


from import plot_histogram

Place on Quantum Computer and test

from qiskit import'...')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 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


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.