Skip to content
Construct PsiQDK Algorithms

select_utils

select_utils

apply_controlled_pauli_term

apply_controlled_pauli_term(data, system, ctrl)

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 PauliSum (int), or a list of two elements: a coefficient (float) and a PauliMask.

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

get_default_used_indices(data, non_zero_only=True)

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 data acts/is loaded on.

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 PauliSum objects and lists of bitstrings; correspondingly, symbolic estimators for SELECT Qubricks take both SymbolicPauliSum objects and SymbolicArrays.
  • Loading a b-bit number corresponds to applying a Pauli X gate on each target qubit where the bit value is 1. Since SymbolicArray corresponds to loading a list, we set the Y & Z weights to zero.
  • Like lists, SymbolicArray has no Hamming weight attribute. If loading a SymbolicArray, 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 a SymbolicPauliSum with zero Z weight and a chosen X weight.