qml.pauli.string_to_pauli_word¶
- string_to_pauli_word(pauli_string, wire_map=None)[source]¶
Convert a string in terms of
'I'
,'X'
,'Y'
, and'Z'
into a Pauli word for the given wire map.- Parameters
pauli_string (str) – A string of characters consisting of
'I'
,'X'
,'Y'
, and'Z'
indicating a Pauli word.wire_map (dict[Union[str, int], int]) – dictionary containing all wire labels used in the Pauli word as keys, and unique integer labels as their values
- Returns
The Pauli word representing of
pauli_string
on the wires enumerated in the wire map.- Return type
Example
>>> wire_map = {'a' : 0, 'b' : 1, 'c' : 2} >>> string_to_pauli_word('XIY', wire_map=wire_map) X('a') @ Y('c')
code/api/pennylane.pauli.string_to_pauli_word
Download Python script
Download Notebook
View on GitHub