Skip to content

randomized_benchmarking

tergite_autocalibration.lib.nodes.coupler.tqg_randomized_benchmarking.utils.randomized_benchmarking

Functions:

Name Description
add_interleaved_clifford

Adds an interleaved Clifford gate to the sequence.

add_inverse_clifford

Adds the inverse of the total sequence to the end of the sequence.

calculate_net_clifford

Calculate the net-clifford from a list of cliffords indices.

randomized_benchmarking_sequence

Generates a randomized benchmarking sequence using the one- or two-qubit Clifford group.

add_interleaved_clifford

add_interleaved_clifford(clifford_sequence: ndarray, interleaved_clifford_idx: int) -> ndarray

Adds an interleaved Clifford gate to the sequence.

Parameters:

Name Type Description Default
clifford_sequence ndarray

Array of Clifford indices.

required
interleaved_clifford_idx int

ID for interleaving a specific Clifford gate.

required

Returns:

Type Description
ndarray

np.ndarray: Array with interleaved Clifford.

add_inverse_clifford

add_inverse_clifford(clifford_sequence: ndarray, CliffordClass: Type[Clifford]) -> ndarray

Adds the inverse of the total sequence to the end of the sequence.

Parameters:

Name Type Description Default
clifford_sequence ndarray

Array of Clifford indices.

required
CliffordClass Type[Clifford]

The class of the Clifford group used.

required

Returns:

Type Description
ndarray

np.ndarray: Array with appended inverse Clifford.

calculate_net_clifford

calculate_net_clifford(clifford_indices: ndarray, CliffordClass: Type[Clifford]) -> Clifford

Calculate the net-clifford from a list of cliffords indices.

Parameters:

Name Type Description Default
clifford_indices ndarray

Array of integers specifying the Cliffords.

required
CliffordClass Type[Clifford]

Clifford class used to determine the inversion technique and valid indices. Valid choices are SingleQubitClifford and TwoQubitClifford.

required

Returns:

Name Type Description
net_clifford Clifford

a Clifford object containing the net-clifford. the Clifford index is contained in the Clifford.idx attribute.

the order corresponds to the order in a pulse sequence but is

the reverse of what it would be in a chained dot product.

randomized_benchmarking_sequence

randomized_benchmarking_sequence(number_of_cliffords: int, apply_inverse: bool = True, clifford_group: Literal[1, 2] = 1, interleaved_clifford_idx: Optional[int] = None, seed: Optional[int] = None) -> ndarray

Generates a randomized benchmarking sequence using the one- or two-qubit Clifford group.

Parameters:

Name Type Description Default
number_of_cliffords int

Number of Clifford gates in the sequence (excluding the optional inverse).

required
apply_inverse bool

Whether to append the recovery Clifford that inverts the total sequence.

True
clifford_group int

Specifies which Clifford group to use. 1 for single-qubit (24 elements), 2 for two-qubit (11,520 elements).

1
interleaved_clifford_idx Optional[int]

Optional ID for interleaving a specific Clifford gate.

None
seed Optional[int]

Optional seed for reproducibility.

None

Returns:

Type Description
ndarray

np.ndarray: Array of Clifford indices representing the randomized benchmarking sequence.

Raises:

Type Description
ValueError

If number_of_cliffords is negative.

NotImplementedError

If an unsupported Clifford group is specified.