guppyalgos.primitives.pauli

Pauli operator primitives.

Functions

pauli_to_cntrl_gate(pauli_string, size[, phase])

Produce a Guppy function for \(e^{i\pi\phi}P\) under one control.

pauli_to_gate(pauli_string, size)

Produce a guppy function to apply a zixy String.

pauli_to_z_basis(pauli_string, size[, dagger])

Produce a guppy function to change basis to/from Z-basis for a zixy String.

guppyalgos.primitives.pauli.pauli_to_cntrl_gate(pauli_string, size, phase=0.0)

Produce a Guppy function for \(e^{i\pi\phi}P\) under one control.

The phase is applied once to the active control branch. If this operation is itself controlled, the phase gate must be promoted to cphase so that it is applied only when both controls are active.

Parameters:
  • pauli_string (String) – Zixy string for the controlled Pauli to be applied.

  • size (int) – Size of the register to apply the Pauli on.

  • phase (float) – Phase applied to the active control branch, in half-turns.

Return type:

GuppyFunctionDefinition[(qubit, array[qubit, TypeVar(n_q, bound= nat)]), None]

Returns:

GuppyFunctionDefinition that takes in a control qubit and array[size] and applies the pauli controlled on the control qubit.

guppyalgos.primitives.pauli.pauli_to_gate(pauli_string, size)

Produce a guppy function to apply a zixy String.

Parameters:
  • pauli_string (zqp.String) – zixy string for the Pauli to be applied

  • size (int) – size of the register to apply the Pauli on

Return type:

GuppyFunctionDefinition[array[qubit, TypeVar(n_q, bound= nat)], None]

Returns:

GuppyFunctionDefinition that takes in a qarray[size] and applies the pauli.

guppyalgos.primitives.pauli.pauli_to_z_basis(pauli_string, size, dagger=False)

Produce a guppy function to change basis to/from Z-basis for a zixy String.

Maps the given Pauli to the Z-basis (or from Z-basis if dagger=True) on a register of given size. Typically should be used as a pair for a GPG^dagger change of basis surrounding a Pauli operation.

Parameters:
  • pauli_string (zqp.String) – zixy string for the Pauli to change basis for

  • size (int) – size of the register to apply the basis change on

  • dagger (bool) – whether to return the dagger operation (i.e. from Z-basis to Pauli basis). Default False (i.e. from Pauli basis to Z-basis).

Return type:

GuppyFunctionDefinition[array[qubit, TypeVar(n_q, bound= nat)], None]

Returns:

GuppyFunctionDefinition that takes in a qarray[size] and applies the basis change.