QuantumState.to_dict does not honor decimals input in all cases #14181
Labels
bug
Something isn't working
mod: quantum info
Related to the Quantum Info module (States & Operators)
Environment
What is happening?
When converting a QuantumState (or Statevector) to a dictionary, the _vector_to_dict function accepts an optional "decimals" parameter which should round the values to a given number of decimals.
While it is calculated, in the case where string_labels are present, the return result pulls the unrounded values.
How can we reproduce the issue?
What should happen?
The
to_dict(decimals=3)
should return the results rounded to 3 decimal placesAny suggestions?
At the end of _vector_to_dict, the item of vec[inds] should be changed to vals[inds], see below:
The text was updated successfully, but these errors were encountered: