You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running the latest versions of pyQuil and the Forest SDK
I checked to make sure that this bug has not already been reported
Issue Description
The sample_bitstrings(n) of the wave function is not working as expected. Even when tried sampling with 100 samples as well as the 1000 samples the wave function provides the same state bitstrings.
I was building a testing framework and found these issue when i had to compare results between different compilers.
How to Reproduce
Code Snippet
frompyquilimportProgramfrompyquil.apiimportget_qcfrompyquil.apiimportWavefunctionSimulatordefresult_dict(resarray):
# Function to provide result array as counts dictionaryres_dict= {}
forvalinresarray:
key="".join([str(v) forvinval])
res_dict[key] =res_dict.get(key, 0) +1returnres_dictqc=get_qc("9q-square-qvm")
wf_sim=WavefunctionSimulator()
prog=Program('''DECLARE ro BIT[2]H 0MEASURE 1 ro[1]MEASURE 0 ro[0]''') # Simple program with H gateresult=qc.run(qc.compile(prog).wrap_in_numshots_loop(1000))
print(result_dict(result.readout_data.get("ro")))
print(result_dict(wf_sim.wavefunction(prog).sample_bitstrings(1000))) # Gives only one stateprint(result_dict(wf_sim.run_and_measure(prog, trials=1000))) # Gives only one state
Error Output
{'00': 501, '10': 499}
{'00': 1000}
{'00': 1000}
If i manually run the loop and measure 100 times it works but the number of requests hitting the QVM slows it down. This was my temporary fix which i am working with.
Pre-Report Checklist
Issue Description
The sample_bitstrings(n) of the wave function is not working as expected. Even when tried sampling with 100 samples as well as the 1000 samples the wave function provides the same state bitstrings.
I was building a testing framework and found these issue when i had to compare results between different compilers.
How to Reproduce
Code Snippet
Error Output
If i manually run the loop and measure 100 times it works but the number of requests hitting the QVM slows it down. This was my temporary fix which i am working with.
Environment Context
Operating System:
Python Version (
python -V
): 3.11.9Quilc Version (
quilc --version
): 1.23.0QVM Version (
qvm --version
): 1.17.1The text was updated successfully, but these errors were encountered: