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 0x7FDA0036A260)[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.

qermit.coherent_pauli_checks.monochromatic_convex_subdag.get_monochromatic_convex_subdag(dag, coloured_nodes)[source]

Retrieve assignment of coloured nodes to sub-DAGs. The assignment aims to minimise the number of sub-DAGs.

Parameters:
  • dag (DiGraph) – Directed Acyclic Graph.

  • coloured_nodes (list[Any]) – The nodes which are coloured.

Return type:

dict[Any, int]

Returns:

Map from node to the sub-DAG to which it belongs.

qermit.coherent_pauli_checks.box_clifford_subcircuits.BoxClifford()[source]

Pass finding clifford subcircuits and wrapping them in circuit boxed called “Clifford Subcircuit”.

Return type:

BasePass

Returns:

Pass finding clifford subcircuits and wrapping them in circuit boxed called “Clifford Subcircuit”.