clifford_group
chalmers_qubit.utils.randomized_benchmarking.clifford_group
Classes:
Name | Description |
---|---|
Clifford |
Base class for Clifford operations. |
SingleQubitClifford |
Single Qubit Clifford gate class. |
TwoQubitClifford |
Two Qubit Clifford gate class. |
Clifford
Clifford(idx: int)
Base class for Clifford operations.
Abstract base class for all Clifford operations.
Attributes:
Name | Type | Description |
---|---|---|
idx |
int
|
Index of the Clifford operation. |
GROUP_SIZE |
ClassVar[int]
|
Size of the Clifford group. |
CLIFFORD_HASH_TABLE |
ClassVar[Dict[int, int]]
|
Hash table for fast lookup of Clifford indices. |
Initialize the Clifford object with a given index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index of the Clifford operation. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the index is not valid (0 <= idx < GROUP_SIZE). |
Methods:
Name | Description |
---|---|
find_clifford_index |
Find the index of a Clifford matrix using hash lookup. |
get_inverse |
Get the inverse of this Clifford operation. |
gate_decomposition
property
Returns the gate decomposition of the Clifford gate.
Returns:
Type | Description |
---|---|
list of tuple
|
Gate decomposition as a list of tuples (gate_name, qubit_identifier). |
Raises:
Type | Description |
---|---|
NotImplementedError
|
If not implemented in subclass. |
pauli_transfer_matrix
property
Returns the Pauli transfer matrix of the Clifford operation.
Returns:
Type | Description |
---|---|
ndarray
|
The Pauli transfer matrix. |
Raises:
Type | Description |
---|---|
NotImplementedError
|
If not implemented in subclass. |
find_clifford_index
classmethod
find_clifford_index(matrix: ndarray) -> int
Find the index of a Clifford matrix using hash lookup.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
matrix
|
ndarray
|
The Pauli transfer matrix. |
required |
Returns:
Type | Description |
---|---|
int
|
The index of the Clifford operation. |
Raises:
Type | Description |
---|---|
ValueError
|
If the Clifford index is not found. |
SingleQubitClifford
SingleQubitClifford(idx: int)
Bases: Clifford
Single Qubit Clifford gate class.
The decomposition of the single qubit clifford group follows Epstein et al. Phys. Rev. A 89, 062321 (2014).
Attributes:
Name | Type | Description |
---|---|---|
CLIFFORD_HASH_TABLE |
dict
|
Hash table for fast lookup. |
GROUP_SIZE |
int
|
Size of the single qubit Clifford group. |
Initialize the Clifford object with a given index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index of the Clifford operation. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the index is not valid (0 <= idx < GROUP_SIZE). |
Methods:
Name | Description |
---|---|
find_clifford_index |
Find the index of a Clifford matrix using hash lookup. |
get_inverse |
Get the inverse of this Clifford operation. |
gate_decomposition
property
Returns the gate decomposition of the single qubit Clifford group according to the decomposition by Epstein et al.
Returns:
Type | Description |
---|---|
list of tuple
|
Each tuple contains (gate_name, qubit_identifier). |
pauli_transfer_matrix
property
Returns the Pauli transfer matrix of the single qubit Clifford operation.
Returns:
Type | Description |
---|---|
ndarray
|
Pauli transfer matrix. |
find_clifford_index
classmethod
find_clifford_index(matrix: ndarray) -> int
Find the index of a Clifford matrix using hash lookup.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
matrix
|
ndarray
|
The Pauli transfer matrix. |
required |
Returns:
Type | Description |
---|---|
int
|
The index of the Clifford operation. |
Raises:
Type | Description |
---|---|
ValueError
|
If the Clifford index is not found. |
TwoQubitClifford
TwoQubitClifford(idx: int)
Bases: Clifford
Two Qubit Clifford gate class.
The Clifford decomposition closely follows: 1. Corcoles et al. Process verification ... Phys. Rev. A. 2013. 2. Barends et al. Superconducting quantum circuits ... Nature 2014.
The two qubit Clifford group (C2) consists of 11520 two-qubit Cliffords, subdivided into four classes.
Attributes:
Name | Type | Description |
---|---|---|
CLIFFORD_HASH_TABLE |
dict
|
Hash table for fast lookup. |
_PTM_CACHE |
dict
|
Cache for PTMs. |
_GATE_DECOMP_CACHE |
dict
|
Cache for gate decompositions. |
GROUP_SIZE |
int
|
Size of the two-qubit Clifford group. |
Initialize the Clifford object with a given index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index of the Clifford operation. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the index is not valid (0 <= idx < GROUP_SIZE). |
Methods:
Name | Description |
---|---|
CNOT_like_PTM |
Returns the pauli transfer matrix for gates of the CNOT-like class. |
CNOT_like_gates |
Returns the gates for Cliffords of the CNOT-like class. |
SWAP_like_PTM |
Returns the pauli transfer matrix for gates of the SWAP-like class. |
SWAP_like_gates |
Returns the gates for Cliffords of the SWAP-like class. |
find_clifford_index |
Find the index of a Clifford matrix using hash lookup. |
get_inverse |
Get the inverse of this Clifford operation. |
iSWAP_like_PTM |
Returns the pauli transfer matrix for gates of the iSWAP-like class. |
iSWAP_like_gates |
Returns the gates for Cliffords of the iSWAP-like class. |
single_qubit_like_PTM |
Returns the pauli transfer matrix for gates of the single qubit like class. |
single_qubit_like_gates |
Returns the gates for Cliffords of the single qubit like class. |
gate_decomposition
property
Returns the gate decomposition of the two qubit Clifford group.
Returns:
Type | Description |
---|---|
list of tuple
|
Gate decomposition as a list of tuples (gate_name, qubit_identifier). |
pauli_transfer_matrix
property
Returns the Pauli transfer matrix for the two-qubit Clifford operation.
Returns:
Type | Description |
---|---|
ndarray
|
Pauli transfer matrix. |
CNOT_like_PTM
classmethod
CNOT_like_PTM(idx: int) -> ndarray
Returns the pauli transfer matrix for gates of the CNOT-like class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index within the CNOT-like class. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
Pauli transfer matrix. |
CNOT_like_gates
classmethod
CNOT_like_gates(idx: int)
Returns the gates for Cliffords of the CNOT-like class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index within the CNOT-like class. |
required |
Returns:
Type | Description |
---|---|
list of tuple
|
Each tuple contains (gate_name, qubit_identifier). |
SWAP_like_PTM
classmethod
SWAP_like_PTM(idx: int) -> ndarray
Returns the pauli transfer matrix for gates of the SWAP-like class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index within the SWAP-like class. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
Pauli transfer matrix. |
SWAP_like_gates
classmethod
SWAP_like_gates(idx: int)
Returns the gates for Cliffords of the SWAP-like class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index within the SWAP-like class. |
required |
Returns:
Type | Description |
---|---|
list of tuple
|
Each tuple contains (gate_name, qubit_identifier). |
find_clifford_index
classmethod
find_clifford_index(matrix: ndarray) -> int
Find the index of a Clifford matrix using hash lookup.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
matrix
|
ndarray
|
The Pauli transfer matrix. |
required |
Returns:
Type | Description |
---|---|
int
|
The index of the Clifford operation. |
Raises:
Type | Description |
---|---|
ValueError
|
If the Clifford index is not found. |
get_inverse
get_inverse() -> Clifford
Get the inverse of this Clifford operation.
Returns:
Type | Description |
---|---|
Clifford
|
The inverse operation. |
iSWAP_like_PTM
classmethod
iSWAP_like_PTM(idx: int) -> ndarray
Returns the pauli transfer matrix for gates of the iSWAP-like class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index within the iSWAP-like class. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
Pauli transfer matrix. |
iSWAP_like_gates
classmethod
iSWAP_like_gates(idx: int)
Returns the gates for Cliffords of the iSWAP-like class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index within the iSWAP-like class. |
required |
Returns:
Type | Description |
---|---|
list of tuple
|
Each tuple contains (gate_name, qubit_identifier). |
single_qubit_like_PTM
classmethod
single_qubit_like_PTM(idx: int) -> ndarray
Returns the pauli transfer matrix for gates of the single qubit like class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index within the single qubit like class. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
Pauli transfer matrix. |
single_qubit_like_gates
classmethod
Returns the gates for Cliffords of the single qubit like class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx
|
int
|
Index within the single qubit like class. |
required |
Returns:
Type | Description |
---|---|
list of tuple
|
Each tuple contains (gate_name, qubit_identifier). |