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.1.tar.gz (16.4 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.1-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: quantum_decomp-1.1.1.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for quantum_decomp-1.1.1.tar.gz
Algorithm Hash digest
SHA256 e4c06144db0c0623a8820f77a5f4010b5dce379f77515e5046cc3688a690da0b
MD5 9c443100e4fb8f53cf8f3d330b800552
BLAKE2b-256 3d7bb0f7b46a026663531eae48f20dc77b8a783e188eb536b795d628e0b892aa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: quantum_decomp-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for quantum_decomp-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a253f5ecb21c73443ea00b4a77a833e1fadf782d8795bb65505de2d768519833
MD5 06bb34693fa3172455500a0aba693d7d
BLAKE2b-256 b1ca6dddc2aa414f1bcf987b367954ed654a4257afc05534bb2b8a437e7d2146

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