hybridq
hybridq copied to clipboard
Avoid having to call ``simulate`` every time whilst sampling
Once the Kraus sampling is more developed, we might want to come up with a neater way for the user to take multiple samples. Currently one would just call simulate
each time, which involves pre-processing and circuit compilation on every call, which could result in a large overhead (e.g. if taking thousands of samples).
It's not 100% clear the best approach, but we should think about it.
One option is we can do the sampling at the backend and return a list of all results (after all pre-processing), however this will result in a large memory overhead if e.g. returning 1000 state vectors.
Another possibility is to allow the user the check the circuit is ok and maybe make some pre-compiled object, and then have a fast sampling function (that just returns a single sample, but avoids having to do most of the regular pre-processing each time). This would be more work on code development however (I guess).