Skip to main content

Variational synthesis of quantum circuits

Project description

CPFlow

Implementation of the synthesis algorithms for quantum circuits described in ... Distributed under the MIT licence.

Installation

CPFlow is available via pip. It is highly recommended to install the package in a new virtual environment.

pip install cpflow

A feature that allows to decompose sythesized circuits into Clifford+T basis requires yet experimental qiskit branch that can be installed through

pip install git+https://github.com/LNoorl/qiskit-terra@d2e0dc1185ccc3b0c9957e3d7d9bc610dede29d4

Basic example

Decomposing the CCZ gate with linear qubit connectivity 0-1-2. Can be executed in python console but intended for use with Jupyter notebooks.

import numpy as np
from cpflow import *

u_target = np.diag([1, 1, 1, 1, 1, 1, 1, -1])  # CCZ gate
layer = [[0, 1], [1, 2]]  # Linear connectivity
decomposer = Synthesize(layer, target_unitary=u_target, label='ccz_chain')
options = StaticOptions(num_cp_gates=12, accepted_num_cz_gates=10, num_samples=10)

results = decomposer.static(options)

d = results.decompositions[3]  # This turned out to be the best decomposition.
d.refine()
print(d)
d.circuit.draw()

Output:

< ccz_chain| Rational | loss: 1.1920928955078125e-07  | CZ count: 8 | CZ depth: 8  >

image

More features

For further examples we encourage to explore a tutorial notebook interactively. For motivation and background see the original paper link_to_paper.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cpflow-0.0.4.tar.gz (28.5 kB view details)

Uploaded Source

File details

Details for the file cpflow-0.0.4.tar.gz.

File metadata

  • Download URL: cpflow-0.0.4.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for cpflow-0.0.4.tar.gz
Algorithm Hash digest
SHA256 56c22bc562d550df5843f6006eeba4ee0355ff52de20a06f53bac1199760dd02
MD5 8eaeeb3369789b16fef05cfed2c0067f
BLAKE2b-256 3d7fe8ad5ab9d4763c3186885255faa48c02af0002e459e028340541ad16eac3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page