Skip to main content

Gate model library.

Project description

https://img.shields.io/pypi/v/dwave-gate.svg https://img.shields.io/pypi/pyversions/dwave-gate.svg https://circleci.com/gh/dwavesystems/dwave-gate.svg?style=svg https://codecov.io/gh/dwavesystems/dwave-gate/branch/master/graph/badge.svg

dwave-gate

dwave-gate is a software package for constructing, modifying and running quantum circuits on the included simulator. 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, c):
    ops.X(q[0])
    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)

and then access the resulting state via the state attribute.

>>> circuit.state
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:

make install

The makefile will also simplify running tests (make test), coverage (make coverage), documentation (make docs), as well as formatting (make format) the code using the Black formatter (set to a line-length of 100) and isort. It’s available on both Unix as well as Windows systems, via the make.bat batch file.

Alternatively, the package can be built and installed in development mode using Python and pip. The simulator operations would need to be generated first by executing operation_generation.py, found in dwave/gate/simulator.

python setup.py build_ext --inplace
pip install -e .

Tests and coverage can be run using Pytest.

python -m 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.3.0.tar.gz (296.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dwave_gate-0.3.0-cp311-cp311-win_amd64.whl (195.3 kB view details)

Uploaded CPython 3.11Windows x86-64

dwave_gate-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

dwave_gate-0.3.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

dwave_gate-0.3.0-cp311-cp311-macosx_11_0_arm64.whl (211.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

dwave_gate-0.3.0-cp311-cp311-macosx_10_9_x86_64.whl (236.5 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

dwave_gate-0.3.0-cp310-cp310-win_amd64.whl (196.7 kB view details)

Uploaded CPython 3.10Windows x86-64

dwave_gate-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

dwave_gate-0.3.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

dwave_gate-0.3.0-cp310-cp310-macosx_11_0_arm64.whl (217.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

dwave_gate-0.3.0-cp310-cp310-macosx_10_9_x86_64.whl (242.1 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

dwave_gate-0.3.0-cp39-cp39-win_amd64.whl (200.5 kB view details)

Uploaded CPython 3.9Windows x86-64

dwave_gate-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

dwave_gate-0.3.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

dwave_gate-0.3.0-cp39-cp39-macosx_11_0_arm64.whl (216.6 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

dwave_gate-0.3.0-cp39-cp39-macosx_10_9_x86_64.whl (243.0 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

dwave_gate-0.3.0-cp38-cp38-win_amd64.whl (200.5 kB view details)

Uploaded CPython 3.8Windows x86-64

dwave_gate-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

dwave_gate-0.3.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

dwave_gate-0.3.0-cp38-cp38-macosx_11_0_arm64.whl (214.1 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

dwave_gate-0.3.0-cp38-cp38-macosx_10_9_x86_64.whl (240.3 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file dwave-gate-0.3.0.tar.gz.

File metadata

  • Download URL: dwave-gate-0.3.0.tar.gz
  • Upload date:
  • Size: 296.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for dwave-gate-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b87ffc88b15fa02735d3ea46b208cf6202d8b935847d36283a4cdb6e193ef2de
MD5 735541225de6ccc8a297a8a6ebd9231e
BLAKE2b-256 4d17173a864f6451e74c5a2b39eb8bc619cf223410c3c90403b7c5456137ea4c

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: dwave_gate-0.3.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 195.3 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for dwave_gate-0.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e392501c8a9425a666ee94cdd394e45f76c00f5498b5e974cf077923f3333ea6
MD5 c567335f29a0d140696ae229c61e39d5
BLAKE2b-256 c61895957e6c5015b5fa740bb6152576c83af970f271aff87ccd0bb3c56b7fe2

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 27d5f19137b0eadfa22bb79854abc35435e07c1196e12bcc97804cc8c6329738
MD5 306a54bbc3faa497913538709607f9da
BLAKE2b-256 c15a9430d065fb15aa9dad48b91223f10570bbe08e6f5beaf0f886813e25ef3b

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b715deb9e5a13b11ac47b7a0cf56bc8631ed59b3f860ccaba42e74c5fed139e7
MD5 9e0edd479ac8f047fafe56efe1969e31
BLAKE2b-256 8e6c28cb92b53468fde19548ecb764ad6e20d1ee057c56296d53f92cbb796f97

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2c18d108336b2185124a3a0f2c8642f3697eced573ea24e168f95e726e31596a
MD5 9ba759c163bec59ea7d2e4e32468d1cc
BLAKE2b-256 6c539fe8eff25d8623f2a85694aaef1287867b37d690a4dd12b3791c45b578a4

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f2d422deff4c0ec4d1bf852131085f3485911f82a9b5cb0ee096109d95387bc5
MD5 82beaae066c1ba9f422e08e7a854c10c
BLAKE2b-256 be885bc0184ee900d83db6e395499a0d8df9b8654603733b4376c3e730668b2d

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: dwave_gate-0.3.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 196.7 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for dwave_gate-0.3.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1564d4d2c1566d467136a7084a6159ba818c7766704796352d8b531c39a43867
MD5 39172a47bcb2cad146c15d1d41f68177
BLAKE2b-256 e7d091c36a98445f20ddabd3ed9c08c196c337591bec1fcc083dd2ec83d39a09

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9949b72cdb050142613eec3694d4c823f65670cd48b8e790b606c77ff7db3bb4
MD5 d6317d5512079ffb454d85c9c6385c1c
BLAKE2b-256 8bc4805add631e36a82a36844ef8e109226d3f45d88301bd638fc1a37a896b42

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e901bd81f5db47e05c10f27bfd1f969b8c80cef28715bca960abdf56eb52c058
MD5 f071b6a39c46f8196024f7b2c742fd96
BLAKE2b-256 2166947a68c4bb1ece75cd687fe933595fd96aec56f8396dd97561872ba33837

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 205013835132a5182be1bb9e892af16b88da4368ae9d10b65c32a323e380401a
MD5 57d196732434c24837e4b69773395a07
BLAKE2b-256 951400b33a113a9c24a0316cb89f33e9a329695e450e6767ec034a39b0e2fa5a

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 abba4c062df71aff5733dc9a1ea77e736d9567f62e696effda0e0caec27593ae
MD5 a73782c03f9b5c9172f0038a5aac5b4a
BLAKE2b-256 fce31ac74a55055da722584a01d1627c3b4c0ae79f256315d93f503f2a5956c6

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: dwave_gate-0.3.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 200.5 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for dwave_gate-0.3.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5ad0dbd8f3ce5a3ce2afda7f9bdf359c69c4b7c1a1e29a38d9aa3682c581cb12
MD5 6b8b00923b9facde4d21ed35001ce1f0
BLAKE2b-256 6768a2cd44c9da959ef659bb6f2a75fe861fa3eaa823e346b76b36d1422600ee

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3500c8d8a795595d1971f0ecb7537623ff6cb3a8a68611ca7042b31bc124c41e
MD5 3da095d8d47a62489dfc92cd57724ae0
BLAKE2b-256 5083df61575b89fc30618c28696c8ae035e7368864fbe73d1e8f1b3e391c76dd

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 89c14ec2a66e244563b080ceb440597912e1acbca3c9740e36d46c6ae2860e60
MD5 ab1cc70982135e0011daf9fd62175e33
BLAKE2b-256 e0683579c85ee2340b6a53b1c71673fe7fc0395dd1bb0611aa09bee0615f58c1

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 570e64a0a5456509445a52c8d1e4e83375dcdb9261ee665572c7e698cfa2df76
MD5 e832cff4909db880adac537756f73110
BLAKE2b-256 a2375295aecffe883eebc42098c889fad39427fc69b2db1266e25ee262f8b01a

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 16ab75d3670db1282d006c4c8a9d053a77843fdf10119dfc50775394e9a91a67
MD5 07ef59d400623cb814509b77757420bb
BLAKE2b-256 9194b8929974437219332756a5046518aff47b9417c3752ebc83026c56d613a7

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: dwave_gate-0.3.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 200.5 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for dwave_gate-0.3.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4a4f731931344a9cfd71e712863a633327d98c401529d99762a4ed89ec54f97b
MD5 fb8d499702598f8e667adbf13241f780
BLAKE2b-256 34efbb63b6fec176188d906a425927ddec83fce302e0367830bc4bf7b6314f8b

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d4c998d001e82f962afdd919818ab37b945f91b3432902c98a6dddc44bcf37de
MD5 7cb3eabc9a39d69354c8d4a579577030
BLAKE2b-256 ad29928e1a42aa6531d3d47d749368216c1d07596787f800f85e0259bfe160d4

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7c98a4bac15f155418f354cc0f8c3692cb8380ca53af4eb429aa906648b11300
MD5 46e837f316f42c3ce318c79577e39a95
BLAKE2b-256 e90d55195aec5c4797d8fd213fd14b8d7c220f9b4681ed2ed00020cc86d6248a

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eaf28b86d2684399a4355fac41fa3ca4f37d1b3d5f547d4519da0e31c4c99ee2
MD5 fae70ba666bcedda0702ba01d663b706
BLAKE2b-256 91d77d01ac2c33808a0d06f2127eb3d5d070bc1bf185f00eaf0e825b7f20ad93

See more details on using hashes here.

File details

Details for the file dwave_gate-0.3.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dwave_gate-0.3.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b8b6c7ed37260be9b5c18a771c40454d451ba6d4c7e657f5e1fb4a10722acb9d
MD5 dae5d6f1332fc70cc6c7031b1060d258
BLAKE2b-256 4f07da7a102a80eb70c303c49a6fcc79058e668282848f654c1ab6cebea93d17

See more details on using hashes here.

Supported by

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