qermit.coherent_pauli_checks

class qermit.coherent_pauli_checks.pauli_sampler.PauliSampler[source]

Abstract base class for Pauli samplers. Pauli samples should sample Paulis to be used a checks.

add_pauli_checks_to_circbox(circuit)[source]

Add checks to all subcircuits labeled “Clifford Subcircuit”.

Parameters:

circuit (Circuit) – Circuit to add checks to.

Return type:

Tuple[Circuit, set[Bit]]

Returns:

Circuit with checks added.

abstract sample(circ)[source]

Sample checks for given circuit.

Parameters:

circ (Circuit) – The circuit for which checks should be sampled.

Return type:

List[QermitPauli]

Returns:

Pauli checks sampled

class qermit.coherent_pauli_checks.pauli_sampler.OptimalPauliSampler(noise_model, n_checks)[source]

Bases: PauliSampler

Samples pauli check based on a noise model. Simulates the noise models action on clifford subcircuits in order to select checks.

Parameters:
  • noise_model (NoiseModel) – The noise model to optimally pick pauli checks for.

  • n_checks (int) – The number of checks to sample.

sample(circ)[source]

Samples checks for the given circuit.

Parameters:

circ (Circuit) – The circuit to sample checks for.

Return type:

List[QermitPauli]

Returns:

Optimal Pauli checks.

class qermit.coherent_pauli_checks.pauli_sampler.RandomPauliSampler(n_checks, rng=Generator(PCG64) at 0x7F9512A3AC00)[source]

Bases: PauliSampler

Sampler returning random Pauli of appropriate length.

Parameters:
  • n_checks (int) – The number of checks to sample

  • rng (Generator) – Randomness generator, defaults to numpy.random.default_rng()

sample(circ)[source]

Sample random Pauli of length equal to the size of the circuit.

Parameters:

circ (Circuit) – Circuit to sample Pauli check for.

Return type:

List[QermitPauli]

Returns:

Random Pauli of length equal to the size of the circuit.