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

Citation

If you use this tool in your research, please cite this paper on arXiv.

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.2.tar.gz (16.7 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.2-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: quantum_decomp-1.1.2.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for quantum_decomp-1.1.2.tar.gz
Algorithm Hash digest
SHA256 284ecd83495d8ef3738e21538d1281cd53ea66c9f2f179d666c155c732de6b70
MD5 cb6365af9625c757717a1cdd8c4f55b7
BLAKE2b-256 10d132f19afc5c6f6601e38c5129a20ed4090b8bac20c9e0ab27e6e70ab3a92d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: quantum_decomp-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for quantum_decomp-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ba0ab5d3b5889917f92ee3e2028b377d1a69951e92c07c269b1ddfbb5d3e99b4
MD5 23774cdea05b578f54020a018bdcd01a
BLAKE2b-256 17114f84fefe72773899398b23d1b803360dd6f14e64343f6f74b58089c6360f

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