-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[WIP] Add quantum phase-estimation simulator #7171
Conversation
In some places we do have classical versions of algorithms that you can use on the same input for small problems to check out say the correctness of your input build out logic in that its creating a correct operator, or to use as a reference result. I guess though that this is not a drop in replacement in that regard since it does not implement the PhaseEstimator interface. Had you thought about the textbook as a possible location for the code and text? Though you mention wanting to be able to use this too for correctness checking unit tests for too as a better? test for areas of the current phase estimation logic. |
EDIT: These topics have been addressed in new commits and the PR description above has been edited accordingly. Yes, this is exactly what I am thinking about. To be more clear: I think putting a wrapper around this that subclasses the existing interface is a good idea. And yes, I definitely want to use this as a much more thorough check of the I did not get a chance to do it yet, but I will make an interface as described above and include it in this PR. |
* This gives the simulator the same interface as the existing qiskit classes * Use the simulator in some tests
Compare simulator to circuit-based QPE in test suite.
Can you put a code example to show how I can put a phase estimation subcircuit into a larger circuit and simulate it by evolving gates where needed and using this for the phase estimation part? If it is a drop-in replacement, I would call it PhaseEstimationEmulator, as in https://arxiv.org/pdf/1604.06460.pdf |
According the ideas and nomenclature in that paper, yes, I think "emulator" is the right word. It's useful to have a word to distinguish if from, say, a state vector simulator.
This is interesting. If it's possible, it would require a modification; I think it's worth looking in to. Currently, the emulator includes measurement. There are two registers, call them the phase-readout register and the eigensystem registers. Only the phase-readout register is measured, while the eigensystem register is ignored or traced out. |
I am closing this based on algorithms being moved out and this is rather old now and would need fixing up. If its really wanted to can opened on the new repo for the algorithms. |
Yes, better to open in the new repo if I have time to pick this up again. |
The simulator is implemented as a class that does not depend on qiskit together with a wrapper class that implements the
PhaseEstimator
interface. The classPESimulator
depends only on numpy and scipy. In particular, it does not depend on Qiskit or circuits in general. The classPhaseEstimationSimulator
is a subclass ofPhaseEstimator
providing an alternative to the circuit-basedPhaseEstimation
.It is intended to be used for research and for testing. It is faster than simulating QPE with circuits and a state-vector simulator. It is much simpler, the core is only 20 lines or so, depending only on well-tested and widely used features of scipy. The rather ad-hoc tests of the QPE implementation in qiskit are augmented by comparing with the output of this simulator, which computes the probabilities of all bitstrings. It can also be used for researchers trying to debug code employing the circuit-based QPE classes.
I also have a tutorial-like text explaining the idea and math behind this simulator and the (parallel) QPE in qiskit. I'll post that somewhere after I convert it to a notebook. This does not spend time on the things in books, rather on a few important details that the books leave out when making a working implementation.