select_utils
select_utils ¶
apply_controlled_pauli_term ¶
We see this subroutine everywhere we deal with Hamiltonians.
Basically, we inspect the data term to see if we should apply some controlled \(X\), \(Y\), or \(Z\) surrounded by Cliffords indexed by some register to be applied to another.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
list or int
|
A single term of a |
required |
system
|
Qubits
|
System qubits that Paulis apply on. |
required |
ctrl
|
(int, Qubits)
|
Control qubits for the Pauli term to be applied. Defaults to zero. |
required |
get_default_used_indices ¶
Given a PauliSum or a list of integers, return a list of indices where ops are applied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
list or PauliSum
|
Data to be multiplexed over. |
required |
non_zero_only
|
(Optional, bool)
|
Whether to only return indices corresponding to non-zero data elements. Defaults to True. |
True
|
Returns:
| Type | Description |
|---|---|
list
|
List of integers corresponding to the indices where data terms occur. |
get_pauli_weights_symbolic ¶
get_pauli_weights_symbolic(num_tgt: Parameter, data: SymbolicArray | SymbolicPauliSum) -> tuple[Parameter, Parameter, Parameter]
Average weight of terms in a symbolic PauliSum.
This function is meant to facilitate retrieving the X and Z weights for data meant to be loaded by SELECT Qubricks. This function is called inside of estimate methods, and thus is inaccessible to the user, precluding them from inputting any weight information. Any and all information about X and Z weights should be set as attributes of the passed data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_tgt
|
Parameter
|
Number of qubits the |
required |
data
|
SymbolicArray | SymbolicPauliSum
|
Symbolic representation of Hamiltonian terms or bitvalues to load. |
required |
Returns:
| Type | Description |
|---|---|
tuple[Parameter, Parameter, Parameter]
|
Average Pauli X, Y and Z weights of input data. |
Notes
- SELECT Qubricks in Workbench Algorithms can take as input both
PauliSumobjects and lists of bitstrings; correspondingly, symbolic estimators for SELECT Qubricks take bothSymbolicPauliSumobjects andSymbolicArrays. - Loading a b-bit number corresponds to applying a Pauli X gate on each target qubit where the
bit value is 1. Since
SymbolicArraycorresponds to loading a list, we set the Y & Z weights to zero. - Like lists,
SymbolicArrayhas no Hamming weight attribute. If loading aSymbolicArray, this function treats it as arbitrary data and sets X weight to the average Hamming weight. If the user wants to put more knowledge about the average Hamming weight of the loaded values, one can instead pass aSymbolicPauliSumwith zero Z weight and a chosen X weight.