paulie.application.average_pauli_weight.get_pauli_weights#

paulie.application.average_pauli_weight.get_pauli_weights(num_qubits, identity_pos=0)#

Generates the weight \(|P|\) for each of the \(4^{\text{number qubits}}\) Pauli operators.

The weight is the number of non-identity terms in the Pauli string. The ordering corresponds to the output of matrix_decomposition(), default is ‘I’ at position 0.

Parameters:
  • num_qubits (int) – The number of qubits.

  • identity_pos (int, optional) – The position of the identity operator. Defaults to 0.

Returns:

The weights for each of the \(4^{\text{number qubits}}\) Pauli operators.

Return type:

numpy.ndarray