qiskit.quantum_info.PauliList.unique¶
- PauliList.unique(return_index=False, return_counts=False)[Quellcode]¶
Return unique Paulis from the table.
Example
from qiskit.quantum_info.operators import PauliList pt = PauliList(['X', 'Y', '-X', 'I', 'I', 'Z', 'X', 'iZ']) unique = pt.unique() print(unique)
['X', 'Y', '-X', 'I', 'Z', 'iZ']
- Parameter
return_index (bool) – If
True
, also return the indices that result in the unique array. (Default:False
)return_counts (bool) – If
True
, also return the number of times each unique item appears in the table.
- Rückgabe
- unique
the table of the unique rows.
- unique_indices: np.ndarray, optional
The indices of the first occurrences of the unique values in the original array. Only provided if
return_index
isTrue
.- unique_counts: np.array, optional
The number of times each of the unique values comes up in the original array. Only provided if
return_counts
isTrue
.
- Rückgabetyp