Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Add ibm yorktown qft5 example
Browse files Browse the repository at this point in the history
  • Loading branch information
emmatyping committed Oct 14, 2020
1 parent 794ff87 commit 6fce6df
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ leapex/
leapex-reoptimize/
multistart/
docs/_build/
qft5-yorktown/
28 changes: 28 additions & 0 deletions examples/qft5_ibm_yorktown.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
This example synthesizes a 5 qubit Quantum Fourier Transform for the IBM Yorktown
quantum computer.
"""
from qsearch import (
gates, unitaries, Project,
leap_compiler, post_processing,
parallelizers, multistart_solvers,
gatesets, assemblers,
)

if __name__ == '__main__':
with Project('qft5-yorktown') as project:
# Add a 5 qubit qft
project.add_compilation("qft5", unitaries.qft(32))
# configure qsearch to use the LEAP compiler, which scales to more qubits
project["compiler_class"] = leap_compiler.LeapCompiler
# set a miniumum search depth (to reduce frequent chopping that gets nowhere)
project["min_depth"] = 3
# use the IBM yorktown "bowtie" topology
project["gateset"] = gatesets.QubitCNOTAdjacencyList([(0,1),(0,2),(1,2),(2,3),(2,4),(3,4)])
# give verbose output to track the synthesis
project["verbosity"] = 2
# run synthesis
project.run()
# LEAP generates sub-optimal results, so we must re-synthesize to get the best results
project.post_process(post_processing.LEAPReoptimizing_PostProcessor(), solver=multistart_solvers.MultiStart_Solver(24), parallelizer=parallelizers.ProcessPoolParallelizer, weight_limit=5)
project.assemble("qft5", assembler=assemblers.ASSEMBLER_IBMOPENQASM)

0 comments on commit 6fce6df

Please sign in to comment.