Skip to main content

Tool for decomposing unitary matrix into quantum gates

Project description

Tool for decomposing unitary matrix into quantum gates

PyPI version

This is a Python tool which takes a unitary matrix and returns a quantum circuit implementing it as Q# code, Cirq circuit, or Qiskit circuit.

Installing

pip install quantum-decomp

Example

>>> import numpy, quantum_decomp
>>> SWAP = numpy.array([[1,0,0,0],[0,0,1,0],[0,1,0,0], [0,0,0,1]])
>>> print(quantum_decomp.matrix_to_qsharp(SWAP, op_name='Swap'))
operation Swap (qs : Qubit[]) : Unit {
  CNOT(qs[1], qs[0]);
  CNOT(qs[0], qs[1]);
  CNOT(qs[1], qs[0]);
}

>>> print(quantum_decomp.matrix_to_cirq_circuit(SWAP))
0: ───@───X───@───
            
1: ───X───@───X───

>>> print(quantum_decomp.matrix_to_qiskit_circuit(SWAP))
     ┌───┐     ┌───┐
q_0:  X ├──■──┤ X 
     └─┬─┘┌─┴─┐└─┬─┘
q_1: ──■──┤ X ├──■──
          └───┘

See example.ipynb for more examples and instructions how to use this tool.

References

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

quantum_decomp-1.1.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

quantum_decomp-1.1.0-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file quantum_decomp-1.1.0.tar.gz.

File metadata

  • Download URL: quantum_decomp-1.1.0.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for quantum_decomp-1.1.0.tar.gz
Algorithm Hash digest
SHA256 06f069d10dd784cc3b3d9a2c45d14ea2649c0860d79923e54e913c769349e9cf
MD5 2849d41df5aaf5d92dec6ebec2b45cfe
BLAKE2b-256 3835de10f252a9c90c13dc93480fd6af8624bb11f4cc2fabc130bbbf17c0fc3b

See more details on using hashes here.

File details

Details for the file quantum_decomp-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: quantum_decomp-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for quantum_decomp-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2fc0c2edde627580ed59d9c13e12a309ca5f8b29ed68c67a487bc97a7164704d
MD5 d67ebaf709f1b5298fb93b4c5c5d39e0
BLAKE2b-256 f815eb2b2a00c17aad418a459e4eaf78bb191f3916ec6f1edc499cdb9fd59deb

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