flip_dict
¶
Helpers for reversing dictionary keys (bitstring endianness).
flip_dict
¶
Return a new dictionary with each string key reversed.
Measurement outcomes are often labeled by bitstrings whose endianness differs between frameworks; reversing the keys converts between those conventions.
Parameters:
-
d(dict[str, Any]) –Mapping whose keys are strings (typically measurement bitstrings).
Returns:
-
dict[str, Any]–A new dictionary with the same values and each key reversed.
Examples:
Flip Qiskit-style bitstring keys: