Home Algorithms Commercialization Data Science Information Theories Quantum Theories Lab Linear Algebra
<< Rotation by Phase Shift PDF Born Rule >>

$\require{cancel} \newcommand{\Ket}[1]{\left|{#1}\right\rangle} \newcommand{\Bra}[1]{\left\langle{#1}\right|} \newcommand{\Braket}[1]{\left\langle{#1}\right\rangle} \newcommand{\Rsr}[1]{\frac{1}{\sqrt{#1}}} \newcommand{\RSR}[1]{1/\sqrt{#1}} \newcommand{\Verti}{\rvert} \newcommand{\HAT}[1]{\hat{\,#1~}} \DeclareMathOperator{\Tr}{Tr}$

Superdense Coding

First created in June 2018

Superdense Coding is not quantum teleportation. It is the reverse, and illustrated here as a general concept.

Alice is sending two classical bits to Bob. They pre-share a pair of entangled qubits $\Ket{\alpha}\otimes\Ket{\beta}$, expressed in this context as $\Ket{\psi}=\Ket{\alpha\beta}$.

$G=(H\otimes I)(cX)(U\otimes I)$

$= (H\otimes I) \begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 1\\ 0 & 0 & 1 & 0 \end{bmatrix} \begin{bmatrix} u_{00} & 0 & u_{01} & 0\\ 0 & u_{00} & 0 & u_{01}\\ u_{10} & 0 & u_{11} & 0\\ 0 & u_{10} & 0 & u_{11} \end{bmatrix} =\frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\\ 1 & 0 & -1 & 0\\ 0 & 1 & 0 & -1 \end{bmatrix} \begin{bmatrix} u_{00} & 0 & u_{01} & 0\\ 0 & u_{00} & 0 & u_{01}\\ 0 & u_{10} & 0 & u_{11}\\ u_{10} & 0 & u_{11} & 0 \end{bmatrix} =\frac{1}{\sqrt{2}} \begin{bmatrix} u_{00} & u_{10} & u_{01} & u_{11}\\ u_{10} & u_{00} & u_{11} & u_{01}\\ u_{00} & -u_{10} & u_{01} & -u_{11}\\ -u_{10} & u_{00} & -u_{11} & u_{01} \end{bmatrix} .$

$\Ket{\psi} =G\frac{1}{\sqrt{2}}(\Ket{00}+\Ket{11}) =G\frac{1}{\sqrt{2}}[1,0,0,1]^T =\frac{1}{2}[u_{00}+u_{11},~u_{10}+u_{01},~u_{00}-u_{11},~-u_{10}+u_{01}]^T .$

For $I,\qquad\qquad(u_{00}, u_{01}, u_{10}, u_{11})=(1,0,0,1),\quad\Ket{\psi}=[1,0,0,0]^T$.
For $X,\qquad\qquad(u_{00}, u_{01}, u_{10}, u_{11})=(0,1,1,0),\quad\Ket{\psi}=[0,1,0,0]^T$.
For $Z,\qquad\qquad(u_{00}, u_{01}, u_{10}, u_{11})=(1,0,0,-1),\quad\Ket{\psi}=[0,0,1,0]^T$.
For $Y'=ZX,\quad(u_{00}, u_{01}, u_{10}, u_{11})=(0,1,-1,0),\quad\Ket{\psi}=[0,0,0,1]^T$.

In [1]:
import time, datetime

from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, QISKitError
from qiskit import available_backends, execute, register, get_backend

# import state tomography functions
from qiskit.tools.visualization import plot_histogram, plot_state, circuit_drawer

def run_job(qc, backend, shots=128):
    # Run circuit qc on backend bknd
    print('Job started at ' + time.strftime('%H:%M:%S, %d %b, %Y'))
    print('Doing ' + str(shots) + ' shot(s) on backend ' + backend)

    #job = execute(qc, backend=backend, shots=128, max_credits=3)
    job = execute(qc, backend=backend, shots=shots, max_credits=3)

    ts0 = datetime.datetime.now().replace(microsecond=0)

    lapse = 0
    interval = 3
    while not job.done:
        #print('Status @ {} seconds'.format(interval * lapse))
        ts1 = datetime.datetime.now().replace(microsecond=0)
        print('Lapse #' + str(lapse) + ' ' + str(ts1 - ts0) + ' so far')
        print(job.status)
        time.sleep(interval)
        lapse += 1
    print(job.status)

    print('Job stopped at ' + time.strftime('%H:%M:%S, %d %b, %Y'))
    
    return job
In [2]:
### Retry Point: Superdense Coding ###

q = QuantumRegister(2)
c = ClassicalRegister(2)
qc = QuantumCircuit(q, c)

# | Bob Alice >
# q[0] is Bob's; q[1] is Alice's
# Use U=Z as an example coding |10>

# Preparing the Bell State
qc.h(q[1])
qc.cx(q[1], q[0])
# 1/sqrt(2)(|00>+|11>)

# Alice codes |00>

# Alice codes |01>
#qc.x(q[1])

# Alice codes |10>
qc.z(q[1])

# Alice codes |11>
#qc.x(q[1])
#qc.z(q[1])

# Decoding | Bob Alice > = |10>
qc.cx(q[1], q[0])
qc.h(q[1])

circuit_drawer(qc)
Out[2]:
In [3]:
job = execute(qc, backend='local_statevector_simulator')
job.result().get_statevector(qc)
Out[3]:
array([2.22044605e-16+6.123234e-17j, 0.00000000e+00+0.000000e+00j,
       1.00000000e+00-6.123234e-17j, 0.00000000e+00+0.000000e+00j])
In [4]:
qc.measure(q, c)
job = run_job(qc, 'local_qasm_simulator')
plot_histogram(job.result().get_counts(qc))
Job started at 17:31:18, 16 Jun, 2018
Doing 128 shot(s) on backend local_qasm_simulator
Lapse #0 0:00:00 so far
{'status': <JobStatus.RUNNING: 'job is actively running'>, 'status_msg': None}
{'status': <JobStatus.DONE: 'job has successfully run'>, 'status_msg': None}
Job stopped at 17:31:21, 16 Jun, 2018

 

<< Rotation by Phase Shift Top Born Rule >>