PhaseFitEstimator cannot fit the signal from its own reduced sampling grid
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- quantum-computing
Research direction
Start with PhaseFitEstimator.get_simulation_points and the amplitude fit in openfermion/measurements/vpe_estimators.py; the issue identifies a mismatch between the reduced grid and the fit's default four-point grid. Extend the existing Pauli sampling test to exercise the fit on the two-point grid and confirm it returns the expected 0.6 value without a broadcasting error.
Written by the indexing model from the issue text.
Description
For a two-eigenvalue Hamiltonian, PhaseFitEstimator.get_simulation_points(safe=False) returns two times, but the estimator cannot fit a signal measured at those times. Its amplitude fit reconstructs the default four-point grid, so even noiseless measurements fail when applying the reference phase shift.
import numpy as np
from openfermion.measurements.vpe_estimators import PhaseFitEstimator
energies = np.array([-1., 1.])
est = PhaseFitEstimator(energies)
for safe in (True, False):
t = est.get_simulation_points(safe=safe)
signal = np.exp(1j * np.outer(t, energies)) @ [0.2, 0.8]
print(est.get_expectation_value(signal))
At 34adf319 the four-point grid returns 0.6000000000000001, as expected from -1 × 0.2 + 1 × 0.8. The two-point grid raises ValueError: operands could not be broadcast together with shapes (2,) (4,). The two-point system here is full rank. The existing Pauli sampling test already checks that the reduced grid is [0, π/2]; extending coverage through the fit would catch the mismatch. It would be helpful for callers to be able to pass the sampled times (or the same sampling mode) into the fit.
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 438
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from quantumlib/OpenFermion
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
quantumlib/OpenFermion#1478 ·
-
Switch to Pyrefly for type checking instead of mypyPossibly taken @rosspeili claimed this 133 days ago. Opena: health a: python e: experienced
quantumlib/OpenFermion#1399 · 6 comments · 1 assignee ·
-
Add a CODEOWNERS fileMay be free again @mhucka claimed this 159 days ago, and no pull request is open. Opena: devops e: maintainer
quantumlib/OpenFermion#1337 · 3 comments · 1 assignee ·
-
Add workflow to run create-env-files.sh when Dependabot changes dependenciesPossibly taken @rosspeili claimed this 142 days ago. Opena: devops e: experienced
quantumlib/OpenFermion#1332 · 4 comments · 1 assignee ·
-
Remove global random seed used for testingPossibly taken @SripriyaDevarapalli claimed this 54 days ago. Opena: performance a: python e: experienced no QC knowledge needed
Difficulty 4/5 3-5 days Newbie friendliness 52/100
quantumlib/OpenFermion#1060 · 6 comments ·
All issues in quantumlib/OpenFermion
Similar issues
-
soup prune-prompt exits 1 after writing its output on a file over 100,000 rows, and reports a capped row count otherwisePossibly taken @abdulwaarith0 claimed this today. Openneeds-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
MakazhanAlpamys/Soup#3690 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug data-types native-format
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
ClickHouse/clickhouse-connect#1320 ·
Maintainers usually reply within 1 day
-
accepted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
future-agi/future-agi#6392 ·
Maintainers usually reply within 1 day