Skip to content

Mc-Zen/qsalto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qsalto logo

transform your quantum weight enumerators

PyPI Package MIT License Tests

qsalto provides transformations between several (normalized) quantum weight enumerators, including

  • Shor-Laflamme enumerators1 $a$, $b$,
  • Rains unitary enumerators2 $a'$, $b'$,
  • and Rains shadow enumerators3 $\tilde{a}$.

We provide both

Python package

The python package features functions to generate nine classes of transformation matrices. You can install it via

pip install qsalto

or

pip install qsalto[Precision]

if you want to make use of high-precision transformation matrices (see below). This variant will also install the optional dependency mpmath.

After installation you can use the package as follows:

import qsalto

a = ..  # some normalized Shor-Laflamme distribution
n = len(a) - 1

# Transform it into Rains shadow enumerators
a2 = qsalto.T2(n) @ a  
Matrix Function Transforms from ... ... to is self-inverse
$M$ M(n) $\mathbf{a}$ $\mathbf{b}$
$M'$ M1(n) $\mathbf{a'}$ $\mathbf{b'}$
$\tilde{M}$ M2(n) $\mathbf{\tilde{a}}$ $\mathbf{\tilde{b}}$
$T'$ T1(n) $\mathbf{a}$, $\mathbf{b}$ $\mathbf{a'}$, $\mathbf{b'}$
$T'^{-1}$ iT1(n) $\mathbf{a'}$, $\mathbf{b'}$ $\mathbf{a}$, $\mathbf{b}$
$\tilde{T}$ T2(n) $\mathbf{a}$, $\mathbf{b}$ $\mathbf{\tilde{a}}$, $\mathbf{\tilde{b}}$
$\tilde{T}^{-1}$ iT2(n) $\mathbf{\tilde{a}}$, $\mathbf{\tilde{b}}$ $\mathbf{a}$, $\mathbf{b}$
$\tilde{T}'$ T3(n) $\mathbf{a'}$, $\mathbf{b'}$ $\mathbf{\tilde{a}}$, $\mathbf{\tilde{b}}$
$\tilde{T}'^{-1}$ iT3(n) $\mathbf{\tilde{a}}$, $\mathbf{\tilde{b}}$ $\mathbf{a'}$, $\mathbf{b'}$

To compute the full matrices, an optimized algorithm making use of recursive patterns is employed. Each matrix generator also features the computation of single elements through, e.g., M(100, entry=[3,4]) where entry specifies the row and column of the entry (in that order).

Single-shot estimators

Furthermore, the function single_shot_estimators(n) generates single-shot estimators for $a$, $b$, $a'$, $b'$, $\tilde{a}$, and $\tilde{b}$ for all possible numbers $m=0,...,n$ of singlets as an outcome of a two-copy Bell measurement. This function returns six 2D-arrays (one for each quantum weight enumerator in the order as given above) with the estimator for $m$ singlets in the $m$-th column.

High-precision transformation matrices

For some applications, a higher precision than 64 bit floating point is needed for the transformation matrices. For this purpose, each transformation features a precise argument (which defaults to false). If set to true, an mpmath.matrix is returned instead of an np.array. This requires mpmath to be installed. The precision can for example be set via mpmath.mp.dps = 120 (more on precision with mpmath, see here) before calling the transformation generator.

License

This library is distributed under the MIT License.

If you want to support work like this, please cite our paper: https://arxiv.org/abs/2408.16914

Footnotes

  1. P. Shor and R. Laflamme, Phys. Rev. Lett. 78, 1600 (1997)

  2. E. M. Rains, IEEE Trans. Inf. Th., 44, 1388 (1998)

  3. E. M. Rains, IEEE Trans Inf. Th. 45, 2361 (1999)