Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilizer simulation example utilizing stim backend #211

Closed
refraction-ray opened this issue May 8, 2024 · 14 comments · Fixed by #223
Closed

Stabilizer simulation example utilizing stim backend #211

refraction-ray opened this issue May 8, 2024 · 14 comments · Fixed by #223
Assignees
Labels
good first issue Good for newcomers

Comments

@refraction-ray
Copy link
Contributor

Task description

Add an example python script stabilizer_stim_sim.py in /examples which showcases stabilizer circuit simulation using tc interface with stim backend.

Implementation

The script includes:

  1. Clifford circuit with mid-circuit measurement defined in tc
  2. Transform the circuit object into Stim circuit object with the helper function defined in the same script (input: tc circuit, output: stim circuit)(can utilize c._qir and c._extra_qir, using c.measure_instruction to get the mid circuit measurement recorded in extra_qir and using c.mid_measurement for the real functionality)
  3. Simulate the circuit in stim and extract the stabilizer tableau
  4. Compute the entanglement entropy of the output state with the helper function defined in the same script (input: stabilizer tableau representation, output: entanglement entropy value) (see Ref 3, it would be better to try hard to accelerate this function)
  5. Validate the correctness by directly computing entanglement from tc (mid-circuit measurement results might require to be averaged)

References:

  1. Stabilizer simulator #159
  2. https://github.com/quantumlib/Stim
  3. https://quantumcomputing.stackexchange.com/questions/16718/measuring-entanglement-entropy-using-a-stabilizer-circuit-simulator
  4. https://arxiv.org/abs/quant-ph/0406196
@refraction-ray refraction-ray added the good first issue Good for newcomers label May 8, 2024
@anonymousr007
Copy link

Hi @refraction-ray, Nice to meet you.

I am Rishabh Singh, and I have been learning about quantum computing since 2020.

  • Experience - Qiskit, Pennylane and Cirq.
  • Participation - Quantum Hackathons, Qiskit Summer School and IBM Quantum Challenges.
  • Open Source Contribution - Cirq, Pennylane, Scikit-Learn.
  • I am interested in this issue and want to contribute under UnitaryHack.

Best Regards
Rishabh Singh
LinkedIn | GitHub

@refraction-ray
Copy link
Contributor Author

@anonymousr007 , great, feel free to open a PR for this issue. Should you encounter any further questions or need assistance while working on it, please don't hesitate to reach out. We're here to help and look forward to your contributions.

@AbdullahKazi500
Copy link

Hi @refraction-ray I got the stabilizer example to work now I will be covering the points in the PR Issue

@AbdullahKazi500
Copy link

@refraction-ray I got the stabilizer example to work with mid circuit measurements

@AbdullahKazi500
Copy link

@refraction-ray is their a way to plot in stim

@refraction-ray
Copy link
Contributor Author

@AbdullahKazi500
Copy link

@refraction-ray I am getting stuck here ---------------
AttributeError: 'stim._stim_sse2.TableauSimulator' object has no attribute 'simulate'
probably checking

@AbdullahKazi500
Copy link

@refraction-ray this issue is done now just stuck at the 4 point it is really hard to get that function to work

@AbdullahKazi500
Copy link

@refraction-ray finally the code works after modification I will make a PR

@AbdullahKazi500
Copy link

stim

@AbdullahKazi500
Copy link

@refraction-ray can I get some feedback

@refraction-ray
Copy link
Contributor Author

@AbdullahKazi500 , you can open an PR so that I can review the script if you have already got the example work and the result entanglement is checked to be correct

@AbdullahKazi500
Copy link

@refraction-ray Added

@king-p3nguin
Copy link
Contributor

Hi, I would also like to work on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment