Skip to main content

Random d-nary symplectic 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 symplectic 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.2.tar.gz (18.1 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.2-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: random_symplectic-0.0.2.tar.gz
  • Upload date:
  • Size: 18.1 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.2.tar.gz
Algorithm Hash digest
SHA256 f8f13e5e63a2c9da6c14a90f5060bdb30ba087ee4517c01ff66b0597022d53ea
MD5 e49936d91b648bcb829674de41d7668a
BLAKE2b-256 42e300b9c66b8185585cda10d2ce70c94292bdf8a42da18ee0b433abc4ac3529

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for random_symplectic-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f124fd3d6562d4ab92381778a4828a5b5deed44723688351e9c7807b2ff79a6b
MD5 5d1f85dd023bf35386316837d881c702
BLAKE2b-256 4a77f6a40ef8b766a63a6e6ee9cc86b1efb206c866d07a17b4958073992a7daa

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