Skip to content

Commit

Permalink
updating docs, and cleaning up imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ampolloreno committed Nov 2, 2017
1 parent a4ec5cb commit 3abd519
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion docs/deutsch_jozsa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ either 1 or 0, and a balanced function maps to 1 for half of the inputs and maps
half. Unlike any deterministic classical algorithm, the Deutsch-Jozsa Algorithm can solve this
problem with a single iteration, regardless of the input size. It was one of the first known quantum
algorithms that showed an exponential speedup, albeit against a deterministic (non-probabilistic)
classical computer, and with access to a blackbox function that can evaluate inputs to the chosen
classical compuetwr, and with access to a blackbox function that can evaluate inputs to the chosen
function.

Algorithm and Details
Expand Down Expand Up @@ -48,6 +48,16 @@ Algorithm:
#. Measure :math:`\ket{x}`. If the result is all zeroes, then the function is constant. Otherwise, it
is balanced.

Implementation Notes
--------------------

The oracle in the :term:`Deutsch-Jozsa` module is not implemented in such a way that calling
`Deutsch_Jozsa.is_constant()` will yield an exponential speedup over classical implementations. To
construct the quantum algorithm that is executing on the QPU we use a Quil `defgate`, which
specifies the circuit :math:`U_w` as its action on the data qubits :math:`\ket{x}`. This matrix is
exponentially large, and thus even generating the program will take exponential time.


Source Code Docs
----------------

Expand Down
4 changes: 2 additions & 2 deletions grove/deutsch_jozsa/deutsch_jozsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
"""
import numpy as np
import pyquil.quil as pq
from pyquil.gates import *
from pyquil.gates import X, H, CNOT


SWAP_MATRIX = np.array([[1, 0, 0, 0],
[0, 0, 1, 0],
[0, 1, 0, 0],
[0, 0, 0, 1]])
r"""The matrix that performs \alpha\ket{ij}\to\alpha\ket{ji}"""

ORACLE_GATE_NAME = "DEUTSCH_JOZSA_ORACLE"


Expand Down Expand Up @@ -92,7 +93,6 @@ def _construct_deutsch_jozsa_circuit(self):
dj_prog.inst(X(self.ancillas[0]), H(self.ancillas[0]))

# Apply Hadamard, Oracle, and Hadamard again

dj_prog.inst([H(qubit) for qubit in self.computational_qubits])

# Build the oracle
Expand Down

0 comments on commit 3abd519

Please sign in to comment.