PauliTable.unique

PauliTable.unique(return_index=False, return_counts=False)[source]

Return unique Paulis from the table.

Example

from qiskit.quantum_info.operators import PauliTable

pt = PauliTable.from_labels(['X', 'Y', 'X', 'I', 'I', 'Z', 'X', 'Z'])
unique = pt.unique()
print(unique)
PauliTable: ['X', 'Y', 'I', 'Z']
Parameters
  • 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.

Returns

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 is True.

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 is True.

Return type

PauliTable