-
Notifications
You must be signed in to change notification settings - Fork 30
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
[Question] How to run approximate simulation in Python? #224
Comments
Thank you for bringing this issue to our attention. Indeed there was a problem with generating the docs for the bindings. You can have a look at #225. For future reference, the signature for the
Does this help? |
I see. Thank you! I am able to run approximate simulations now in Python. I'm not yet familiar with DDSim's code. I saw the approximation options ( I thought I can pass these options to the
I thought it was similar to passing the
|
The way you propose to use the approximation should work with the current version. The keyword paramaters are passed to the simulator. The relevant snippet from def run_experiment(self, qobj_experiment: QasmQobjExperiment, **options) -> Dict:
start_time = time.time()
approximation_step_fidelity = options.get("approximation_step_fidelity", 1.0)
approximation_steps = options.get("approximation_steps", 1)
approximation_strategy = options.get("approximation_strategy", "fidelity")
seed = options.get("seed", -1)
sim = CircuitSimulator(
qobj_experiment,
approximation_step_fidelity=approximation_step_fidelity,
approximation_steps=approximation_steps,
approximation_strategy=approximation_strategy,
seed=seed,
)
counts = sim.simulate(options.get("shots", 1024))
[...] PR #225 adds some code to get rid of warnings and a simple test for the approximation. I'll add some documentation when I'll have time. |
I initially did not notice that passing those options (
After checking again, I finally noticed that changing the options (specifically I was changing the value of Thanks! |
How do I run approximate simulations (fidelity-driven or memory-driven) in Python?
I am mainly using DDSim's ReadTheDocs.io documentation for information.
(https://ddsim.readthedocs.io/en/latest/)
The CircuitSimulator page (https://ddsim.readthedocs.io/en/latest/simulators/CircuitSimulator.html) mentions that the Circuit Simulator is the “default” simulator in DDSIM with the following features: 1) exact simulation, 2) weak simulation, and 3) approximate simulation with different strategies. It has two sections "Usage in Python" and "Usage as Standalone Executable" but I can't find any instructions on how to do approximate simulations in Python.
For the standalone executable, I run "./ddsim_simple --help" and I can see that the following options can be set in order to run approximate simulations:
--step_fidelity
--steps arg
--approx_when
--approx_state
I can't seem to find any instructions on how to set this options when using Python.
The text was updated successfully, but these errors were encountered: