Skip to main content

Gate model library.

Project description

dwave-gate is a software package for constructing, modifying and running quantum circuits. It provides a set of tools that enables you to:

  • Construct quantum circuits using an intuitive context-manager interface.

  • Utilize a comprehensive library of quantum gates with simple access to matrix representations, various decompositions, and more.

  • Simulate circuits on a performant (C++) state-vector simulator.

  • Easily create your own quantum gates and templates. Any circuit can be either directly applied in another circuit or converted into a quantum operation.

Example usage

This example uses the dwave.gate.Circuit object’s context manager to append operations to a two-qubit circuit.

import dwave.gate.operations as ops
from dwave.gate import Circuit

circuit = Circuit(2)

with circuit.context as q:
    ops.Hadamard(q[1])
    ops.CZ(q[0], q[1])
    ops.Hadamard(q[1])

You can run the dwave.gate.simulator simulator on such circuits.

>>> from dwave.gate.simulator import simulate
>>> simulate(circuit)
array([0.+0.j, 0.+0.j, 0.+0.j, 1.+0.j])

Installation

The simplest way to install dwave-gate is from PyPI:

pip install dwave-gate

It can also be installed from source by cloning this GitHub repository and running (on Unix systems):

make install

The makefile will also simplify running tests (make test), coverage (make coverage) and formatting (make format) the code using the Black formatter (set to a line-length of 100) and isort.

Alternatively, the package can be built and installed using Python (on any supported system):

python setup.py build_ext --inplace

and tests and coverage can be run using Pytest:

pytest tests/ --cov=dwave.gate

License

Released under the Apache License 2.0. See LICENSE file.

Contributing

Ocean’s contributing guide has guidelines for contributing to Ocean packages.

Release Notes

dwave-gate uses reno to manage its release notes.

When making a contribution to dwave-gate that will affect users, create a new release note file by running

reno new your-short-descriptor-here

You can then edit the file created under releasenotes/notes/. Remove any sections not relevant to your changes. Commit the file along with your changes.

See reno’s user guide for details.

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

dwave-gate-0.1.0.tar.gz (262.8 kB view hashes)

Uploaded Source

Built Distributions

dwave_gate-0.1.0-cp311-cp311-win_amd64.whl (167.4 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

dwave_gate-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

dwave_gate-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.0 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

dwave_gate-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (181.7 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

dwave_gate-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl (201.7 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

dwave_gate-0.1.0-cp310-cp310-win_amd64.whl (168.3 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

dwave_gate-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (960.2 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

dwave_gate-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (943.1 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

dwave_gate-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (185.7 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

dwave_gate-0.1.0-cp310-cp310-macosx_10_9_x86_64.whl (206.5 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

dwave_gate-0.1.0-cp39-cp39-win_amd64.whl (171.3 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

dwave_gate-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (983.0 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

dwave_gate-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (972.8 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

dwave_gate-0.1.0-cp39-cp39-macosx_11_0_arm64.whl (185.8 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

dwave_gate-0.1.0-cp39-cp39-macosx_10_9_x86_64.whl (207.2 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

dwave_gate-0.1.0-cp38-cp38-win_amd64.whl (171.4 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

dwave_gate-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (996.3 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

dwave_gate-0.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (978.3 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

dwave_gate-0.1.0-cp38-cp38-macosx_11_0_arm64.whl (183.7 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

dwave_gate-0.1.0-cp38-cp38-macosx_10_9_x86_64.whl (204.4 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

dwave_gate-0.1.0-cp37-cp37m-win_amd64.whl (168.4 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

dwave_gate-0.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (915.0 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

dwave_gate-0.1.0-cp37-cp37m-macosx_10_9_x86_64.whl (201.8 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

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