Closed jlapeyre closed 1 year ago
Let me link this since it was about the grouping code Qiskit/retworkx#347 in that the groups being returned is not deterministic and under Aer, which uses the seed with RNG once per job, a change in ordering of groups, and hence the circuits that were executed to measure their expectations, led to different unit test outcomes.
While we working on the retworkx issue couldn't you just do sorted()
on the output dict? The issue is the insertion order is undefined (because the underlying result object is a HashMap that doesn't define an order for iteration) so iteration order is different but the output should be deterministic, it's just a different insertion order. Either way I plan to have that issue resolved for at least the graph_greedy_color()
function for the next release (which I'm targeting to have out before terra 0.19.0)
@irajput will be working on this.
Thanks. Nice proposal. I think it is better after the internal data of SparsePauliOp
is replaced by PauliList
.
I think it is better after the internal data of SparsePauliOp is replaced by PauliList
Yes. The first step would be to implement grouping for PauliList
in quantum_info. This is independent of opflow.
Since OpFlow is deprecated, reorganizing grouping of Paulis is better addressed elsewhere.
Note however that a part of this work that will continue to be useful was done in #6690
The code in abelian_grouper.py does not depend in an essential way on any part of opflow. It could be factored out and moved to quantum_info, or to some organized code whose only qiskit dependency is quantum_info. The opflow class could then call this factored-out code.