Skip to main content

Tool for decomposing unitary matrix into quantum gates

Project description

Tool for decomposing unitary matrix into quantum gates

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

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(qd.matrix_to_cirq_circuit(SWAP))
0: ───@───X───@───
            
1: ───X───@───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.0.0.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.0.0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for quantum_decomp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2b4372964889729fbe639c8118cd90a2dd0a8c20807a31233516e0ceafc40c25
MD5 ded0ffa5d763464a86a8ac3a9267392a
BLAKE2b-256 445e3555542306d7fb95cc98ab0a1beb172e8f37e54ae5d5ae688b89fe5221f0

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for quantum_decomp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d6233ac17436eace8f604aee2d2abad3d43ba9ec822b211bce89f0b46b8e7bb
MD5 a37f4c34cce516339d53b984848350a2
BLAKE2b-256 cd51b85ecd12bef6279f8ccfc4f76655dabd5f85cf4dd0c724b11688ad807578

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