Skip to main content

class CompiledStateProbs

Computes measurement probabilities for a given state. Uses joint decomposition [0, n] where:
  • compiled_scalar_graphs[0]: normalization (0 outputs plugged)
  • compiled_scalar_graphs[1]: full joint probability (all outputs plugged)

probability_of

Compute probabilities for a batch of error samples given a measurement state. Parameters:
  • state (np.ndarray) — The measurement outcome state to compute probability for.
  • batch_size (int) — Number of error samples to use for estimation.
Returns:
  • np.ndarray — Array of probabilities P(state | error_sample) for each error sample.

class SteaneEncoder

Transversal encoder for the [[7,1,3]] Steane code.

diagram

Return a timeline-svg diagram of the encoded circuit.

encode_transversally

Encode a program transversally by replacing physicalgates with transversal gates. Transform a program on m qubits into a program on n * m qubits (consisting of n code blocks). Parameters:
  • program_text (str) — The program to encode transversally.

encoding_flow_generators

Return the Pauli flow generators for the encoding circuit.

initialize

Initialize state preparation and apply encoding circuit. Apply the state preparation program for k qubits, then apply an encoding circuit to encode the state into n qubits. Parameters:
  • program_text (str) — The state preparation program for k qubits. Generally, this should be a simple program that prepares each of the k qubits in a single-qubit state.
  • encoding_program_text (optional) — An encoding circuit for a single logical qubit. This should encode a single logical qubit at input self.encoding_qubit into a state of n qubits. If not provided, the encoder will use a noiseless default encoding.

class ColorEncoder5

Transversal encoder for the [[17,1,5]] 2D color code.

diagram

Return a timeline-svg diagram of the encoded circuit.

encode_transversally

Encode a program transversally by replacing physicalgates with transversal gates. Transform a program on m qubits into a program on n * m qubits (consisting of n code blocks). Parameters:
  • program_text (str) — The program to encode transversally.

encoding_flow_generators

Return the Pauli flow generators for the encoding circuit.

initialize

Initialize state preparation and apply encoding circuit. Apply the state preparation program for k qubits, then apply an encoding circuit to encode the state into n qubits. Parameters:
  • program_text (str) — The state preparation program for k qubits. Generally, this should be a simple program that prepares each of the k qubits in a single-qubit state.
  • encoding_program_text (optional) — An encoding circuit for a single logical qubit. This should encode a single logical qubit at input self.encoding_qubit into a state of n qubits. If not provided, the encoder will use a noiseless default encoding.