https://github.com/cqcl/phayes
Easy and efficient Bayesian quantum phase estimation
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
✓DOI references
Found 1 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org, iop.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.6%) to scientific vocabulary
Repository
Easy and efficient Bayesian quantum phase estimation
Basic Info
Statistics
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 4
- Releases: 0
Metadata Files
README.md
phayes
phayes is a python package for easy and efficient quantum phase estimation.
Extensive details on Bayesian quantum phase estimation can be found in the accompanying paper, Yamamoto et al, 2023.

Quantum phase estimation
Wiebe et al, 2015,
O'Brien et al, 2018,
van den Berg, 2021 (and
quantum amplitude estimation Suzuki et al, 2019) can be implemented as an instance of Bayesian inference. Shots are generated from a quantum circuit with likelihood
$$p(m \mid \phi, k, \beta) = \frac12\left(1 + (1 - q)\cos(k\phi + \beta - m \pi)\right),$$
where $m \in {0,1}$ is the binary shot produced by the quantum device, $\phi$ is the unknown underlying phase, $q$ is a noise parameter or error rate. $k$ and $\beta$ are circuit parameters that are chosen by the user (or phayes).
Starting with a uniform prior over $\phi$, phayes uses Bayesian inference to hone in on the true value (with uncertainty quantification) through repeated measurements.
Install
pip install phayes
Bayesian updates
The core functions are phayes.get_k_and_beta and phayes.update, which determine the experiment parameters and then update the posterior distribution in light of a new measurement (or series of measurements)
```python from jax import numpy as jnp import phayes
num_shots = 100
posteriorstate = phayes.init()
for _ in range(numshots):
k, beta = phayes.getkandbeta(posteriorstate)
m = getshot(k, beta)
posteriorstate = phayes.update(posteriorstate, m, k, beta)
``
Here the functiongetshot` executes the quantum circuit above and returns a binary shot (or multiple shots) according the likelihood $p(m\mid \phi, k, \beta)$.
There's more
The probability density function can be visualised easily
```python prior_state = phayes.init() m = jnp.array([0, 1, 1, 0, 0, 1]) k = jnp.array([1, 4, 3, 8, 5, 10]) beta = jnp.array([1.4, 0.6, 1.2, 1.1, 1.9, 0.3])
posteriorstate = phayes.update(priorstate, m, k, beta)
import matplotlib.pyplot as plt linsp = jnp.linspace(-jnp.pi, jnp.pi, 1000) pdf = phayes.pdf(linsp, posterior_state) plt.plot(linsp, pdf) ```

phayes also has a host of other useful functions
python
posterior_mean = phayes.circular_mean(posterior_state)
posterior_circular_variance = phayes.circular_variance(posterior_state)
posterior_holevo_variance = phayes.holevo_variance(posterior_state)
Example notebooks can be found in the examples folder.
Precision
By default JAX uses 32-bit precision,
for phase estimation experiments you may well want to enable 64-bit precision by
adding the following to the top of your script
python
from jax.config import config
config.update(“jax_enable_x64”, True)
Citation
@software{phayes,
author={Duffield, Samuel},
title={phayes: A python package for easy and efficient Bayesian quantum phase estimation},
year={2023},
url={https://github.com/CQCL/phayes}
}
Owner
- Name: Cambridge Quantum
- Login: CQCL
- Kind: organization
- Location: Cambridge, UK
- Website: http://www.cambridgequantum.com
- Repositories: 48
- Profile: https://github.com/CQCL
Quantum Software and Technologies
GitHub Events
Total
- Watch event: 2
- Fork event: 1
Last Year
- Watch event: 2
- Fork event: 1
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 6
- Total pull requests: 0
- Average time to close issues: 4 days
- Average time to close pull requests: N/A
- Total issue authors: 1
- Total pull request authors: 0
- Average comments per issue: 1.17
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- SamDuffield (5)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- jax *