Skip to main content

Random d-nary symplecitc matrices for qudit Clifford gates.

Project description

Random Symplectic

Python library for generating uniformly random d-nary symplectic matrices for prime $d$. These matrices form a representation of the $n$-qudit Clifford group and can be decomposed into elementary 1- and 2-qudit gates (Hostens, 2005). Uniform sampling from the Clifford group is a critical subroutine to randomized benchmarking (Magesan, 2012).

The algorithm implements a mapping from the integers to $\text{Sp}(2n, \mathbb{Z}_d)$, reducing sampling from the symplectic group to sampling an integer, and is an extension of the qubit-based method presented by Koenig and Smolin (2014). A manuscript detailing the algorithm is forthcoming.

Installation

To install the package for Python 3.8+, do

pip install random-symplectic

Getting Started

The package implements the DnaryArray class, a subclass of numpy's ndarray for arrays over the integers mod $d$. Users can specify $d$ using the classmethod DnaryArray.set_d, which will return a subclass of DnaryArray specialized to the given modulus.

>>> from randomsymplectic import DnaryArray
>>> D3 = DnaryArray.set_d(3)
>>> D3([1, 2, 3, 4])
DnaryArray(d=3)([1, 2, 0, 1])

In particular, a specialized subclass exposes a plethora of useful methods for doing symplectic algebra over the group of d-nary arrays, as well as generating symplectic matrices.

Random Symplectic Matrices

DnaryArray has two classmethods for generating uniformly random symplecitc matrices: DnaryArray.random_symplectic and DnaryArray.from_index. The former operates by generating random d-nary vectors of lengths building up to the size of the matrix to be generated. The latter deterministically generates each of those vectors from the provided index.

>>> from randomsymplectic import DnaryArray
>>> D3 = DnaryArray.set_d(3)
>>> D3.from_index(0, n=1)
DnaryArray(d=3)([[1, 0],
                 [0, 1]])
>>> D3.from_index(12152, 3)
DnaryArray(d=3)([[1, 0, 1, 2, 1, 1],
                 [0, 1, 0, 2, 1, 2],
                 [2, 0, 0, 1, 1, 0],
                 [0, 0, 2, 0, 1, 0],
                 [0, 0, 0, 0, 1, 0],
                 [2, 0, 2, 0, 2, 0]])

References

  1. E. Hostens, J. Dehaene, and B. De Moor, Stabilizer states and Clifford operations for systems of arbitrary dimensions and modular arithmetic, Phys. Rev. A 71, 042315 (2005), arXiv:quant-ph/0408190.
  2. E. Magesan, J. M. Gambetta, and J. Emerson, Characterizing quantum gates via randomized benchmarking, Phys. Rev. A 85, 042311 (2012), arXiv:1109.6887v2.
  3. R. Koenig and J. A. Smolin, How to efficiently select an arbitrary Clifford group element, Journal of Mathematical Physics 55, 122202 (2014), arXiv:1406.2170.

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

random_symplectic-0.0.1.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

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

random_symplectic-0.0.1-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file random_symplectic-0.0.1.tar.gz.

File metadata

  • Download URL: random_symplectic-0.0.1.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for random_symplectic-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0dd169a5bb1f3397d62c54b7fa23d1c179a4f0bcce653754bfa873d0a1785471
MD5 19e405fb2fa39d05ebd77519b37ba1e0
BLAKE2b-256 3416867dc714da6a3f6c475c8728be808dcb79ed63c1e00236545a001a0c3753

See more details on using hashes here.

File details

Details for the file random_symplectic-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for random_symplectic-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b5a65125aa417be35a3e30a5f4b47f48598471b5c582fa9b5b2843620c2afd4
MD5 0509f92c601ebd7746f51b447b4ba3f9
BLAKE2b-256 9bab7a1e0f11f31c4fc52912c4ae34ee59b3887f650152f6314a477177e789c6

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