Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removing ambiguity in
PauliRot
error message. (#6298)
**Context:** For the input of `PauliRot` the number of wires given must equal the length of the given Pauli word. Otherwise a `ValueError` is raised. For example, `op = qml.PauliRot(0.5, "XY", wires=[0,1,2])` results in `ValueError: The given Pauli word has length 2, length 3 was expected for wires [0,1,2]`. However, this message can be ambiguous. `op = qml.PauliRot(0.5, "XYZZXYI", wires=[0])` raises the exception `ValueError: The given Pauli word has length 7, length 1 was expected for wires [0]`. It's unclear if "length 1" refers to the length of the Pauli word or the length of the wires. **Description of the Change:** This PR changes the error message to remove the ambiguity. Now it will say `ValueError: The number of wires must be equal to the length of the Pauli Word. The Pauli word XY has length 2, and 3 wires were given [0, 1, 2].`
- Loading branch information