Closed jselig-rigetti closed 9 months ago
The test_estimate_observables_symmetrize_calibrate
is failing because calibrate_observable_estimates
calls qc.run_symmetrized_readout
with an empty program made by get_calibration_program
.
Two questions:
get_calibration_program
should return an empty program?qc.run_symmetrized_readout
should accept empty programs, or if not, can observables that produce empty programs be ignored?Running locally, here's an example of observable
to program
:
{
"(1+0j)*Z1": "",
"(1+0j)*Y0*X1": "RX(-1.5707963267948966) 0\nRX(1.5707963267948966) 1\nRZ(1.5707963267948966) 1\nRX(-1.5707963267948966) 1\nRX(1.5707963267948966) 0\nRX(1.5707963267948966) 1\nRZ(-1.5707963267948966) 1\nRX(-1.5707963267948966) 1\n",
"(1+0j)*Y1": "RX(-1.5707963267948966) 1\nRX(1.5707963267948966) 1\n",
"(1+0j)*X1": "RX(1.5707963267948966) 1\nRZ(1.5707963267948966) 1\nRX(-1.5707963267948966) 1\nRX(1.5707963267948966) 1\nRZ(-1.5707963267948966) 1\nRX(-1.5707963267948966) 1\n",
"(1+0j)*I": "",
"(1+0j)*X0*X1": "RX(1.5707963267948966) 0\nRZ(1.5707963267948966) 0\nRX(-1.5707963267948966) 0\nRX(1.5707963267948966) 1\nRZ(1.5707963267948966) 1\nRX(-1.5707963267948966) 1\nRX(1.5707963267948966) 0\nRZ(-1.5707963267948966) 0\nRX(-1.5707963267948966) 0\nRX(1.5707963267948966) 1\nRZ(-1.5707963267948966) 1\nRX(-1.5707963267948966) 1\n",
"(1+0j)*X0*Y1": "RX(-1.5707963267948966) 1\nRX(1.5707963267948966) 0\nRZ(1.5707963267948966) 0\nRX(-1.5707963267948966) 0\nRX(1.5707963267948966) 1\nRX(1.5707963267948966) 0\nRZ(-1.5707963267948966) 0\nRX(-1.5707963267948966) 0\n",
"(1+0j)*X0*Z1": "RX(1.5707963267948966) 0\nRZ(1.5707963267948966) 0\nRX(-1.5707963267948966) 0\nRX(1.5707963267948966) 0\nRZ(-1.5707963267948966) 0\nRX(-1.5707963267948966) 0\n",
"(1+0j)*Y0": "RX(-1.5707963267948966) 0\nRX(1.5707963267948966) 0\n",
"(1+0j)*Y0*Y1": "RX(-1.5707963267948966) 0\nRX(-1.5707963267948966) 1\nRX(1.5707963267948966) 0\nRX(1.5707963267948966) 1\n",
"(1+0j)*Z0*X1": "RX(1.5707963267948966) 1\nRZ(1.5707963267948966) 1\nRX(-1.5707963267948966) 1\nRX(1.5707963267948966) 1\nRZ(-1.5707963267948966) 1\nRX(-1.5707963267948966) 1\n",
"(1+0j)*Y0*Z1": "RX(-1.5707963267948966) 0\nRX(1.5707963267948966) 0\n",
"(1+0j)*Z0*Y1": "RX(-1.5707963267948966) 1\nRX(1.5707963267948966) 1\n",
"(1+0j)*Z0*Z1": "",
"(1+0j)*X0": "RX(1.5707963267948966) 0\nRZ(1.5707963267948966) 0\nRX(-1.5707963267948966) 0\nRX(1.5707963267948966) 0\nRZ(-1.5707963267948966) 0\nRX(-1.5707963267948966) 0\n",
"(1+0j)*Z0": ""
}
get_calibration_program
should return an empty program when the observable is simply the ground state. In order to measure this observable, we need not do anything.A simple solution would be for get_calibration_program
to apply RZ(0) for any qubits which are in the observable but don't have an operation in the calibration program.
@bramathon thank you for the response - from more digging, it seems there's another (or perhaps the primary issue) that _max_weight_operator()
is returning []
for some PauliTerm
s, which causes the same following error even for non-empty programs
api.QVMError: QVM reported a problem running your program: The value of QVM::SIZE is 0, which is not The SIZE wasn't a multiple of 8..
Reviewed. In addition to the comments on the code, the method by which the updates have been made is one of changes not backwards-compatible with
pyquil
v3. This is a major breaking change that will issue a new major version offorest-benchmarking
?
@mhodson-rigetti Yes, that's the case - the version bump from 0.8
to 0.9
in forest/benchmarking/__init__.py
should reflect that, given pre-1.0
minor bumps are considered instable.
Reviewed. In addition to the comments on the code, the method by which the updates have been made is one of changes not backwards-compatible with
pyquil
v3. This is a major breaking change that will issue a new major version offorest-benchmarking
?@mhodson-rigetti Yes, that's the case - the version bump from
0.8
to0.9
inforest/benchmarking/__init__.py
should reflect that, given pre-1.0
minor bumps are considered instable.
Great, I'm good with this.
Description
Closes #236
Update pyquil to v4 and refactor for compatibility.