Closed antoniomezzacapo closed 5 years ago
@chriseclectic can you help with this request? It is very urgent for Chemistry. Thanks.
@chriseclectic I think you may be able to take Yael's code from the reference-model she built as-is. @yaelbh can comment what is the best way to do it if you prefer to go this way. The reference model was just a density matrix simulator, not optimized for performance of special inputs, but seems this is what they need for now.
@pistoia this is in the roadmap, but it is a major change so won't be done until 0.3. We already have a lot of other things to get done for 0.2.
@yehuda-naveh this simulator needs to be very heavily optimised so i don't think that code is sufficient. The density matrix simulator should be based on the QubitVector base class to incorporate all of its optimizations. I'm currently refactoring the unitary simulator to do this too as a test case. But for the density matrix it will also require significant changes to how noise is handled in the code base so it is not a trivial thing to incorporate.
Ok - thanks. Good with me. I missed the fact that the usecase requires heavily optimized simulator, I thought they are more interested in functional results of simple cases. Yael's code is non-optimized by design, to keep it a lean functional reference
@yaelbh @yehuda-naveh
What does Yael's code do? Can it run a quantum circuit with noise as a backend? We could use it temporarily.
It can simulate any noise and any mixed state in general. It does it slowly (2^(2n)) and with no optimization in order to keep it clean and analyzable. The code is here, you can have a look: https://github.ibm.com/IBMQuantum/qiskit-aer-internal/commit/fce1506066428f65af8d8219f5e31a8330f8aceb
@yaelbh can work with you on more details, probably tomorrow as she's left for now
@yehuda-naveh , that link is not working for me. What kind of optimization are you referring to?
ok, not sure how to give you access, probably @atilag or @chriseclectic can help. Anyway, if you'll be interested in using it we'll figure out where to put it. Optimization I mean working on the code (detailed data structures, caching of variables till they change, c vs python, etc) which make the code much more complex but faster, while preserving functionality. This code has the opposite design - be very clean in order to minimize the probability of bugs, and be able to white-box analyze the development of the density matrix. Runtime was not the drive here.
@antoniomezzacapo When you have access to the repository you'll be able to see a usage example in the function test_by_reference_model
. It looks like this:
den_sim = DensityMatrixSimulator()
qobj = compile(qc, <another backend, e.g. qasm simulator>, shots=...)
den_result = den_sim.run(qobj)
Note that class DensityMatrixSimulator
does not inherit from BaseBackend
, and den_result
is not of type Result
.
Noise is supported by a function called qop
, which receives as input a set of Kraus operators.
As for run time, the code contains multiplications of square matrices with 2^n rows and columns.
@yehuda-naveh , that link is not working for me. What kind of optimization are you referring to?
I'm giving you access @antoniomezzacapo , but this is an IBM internal repo.
Thanks @yaelbh @yehuda-naveh and @atilag !
@chunfuchen see above, this could help running noisy numerics for small systems. @atilag can you give Richard access too?
@gadial added recently the full noise interface to Yael's simulator
We need a density matrix simulator to perform noisy simulations of experiments for small-size systems.