Source reference

API and Source Reference

Generated from repository source files and first-line comments during the Pages build.

Core MATLAB/Octave Functions

apply_bitflip_noise.m

Apply independent bit-flip noise to a 3-qubit state vector.

m
Open source

apply_error_pattern.m

Deterministically apply a chosen error pattern [e1 e2 e3].

m
Open source

apply_pauli_error.m

Apply an n-qubit Pauli string such as 'IXYZ' to a state vector.

m
Open source

apply_phase_error_pattern.m

Deterministically apply Z errors for a phase-flip pattern [e1 e2 e3].

m
Open source

bacon_shor_layout.m

Return the row-major 3x3 Bacon-Shor data-qubit layout.

m
Open source

bacon_shor_logical_failure.m

Return true when Bacon-Shor residual X/Z chains have logical parity.

m
Open source

bacon_shor_stabilizers.m

Stabilizer generators for the compact 3x3 Bacon-Shor subsystem code.

m
Open source

bacon_shor_x_syndrome.m

Syndrome for X errors in the 3x3 Bacon-Shor code.

m
Open source

bacon_shor_z_syndrome.m

Syndrome for Z errors in the 3x3 Bacon-Shor code.

m
Open source

binary_syndrome_index.m

Find the qubit whose parity-check column matches a syndrome row vector.

m
Open source

code_num_qubits.m

Number of physical qubits for a named code.

m
Open source

collect_syndromes.m

Monte Carlo tally of measured syndromes for N noisy trials.

m
Open source

color7_layout.m

Small triangular color-code layout metadata.

m
Open source

color7_logical_failure.m

Return true for a residual color-code Pauli with logical support.

m
Open source

color7_stabilizers.m

Stabilizer generators for the 7-qubit triangular color code.

m
Open source

computational_basis_state.m

Return computational basis vector |bits> for bits ordered q1...qn.

m
Open source

confusion_bitflip.m

Build confusion matrix between true errors and inferred errors.

m
Open source

correct_bitflip.m

Apply single-qubit correction operator based on syndrome bits.

m
Open source

correct_color7.m

Correct any single-qubit Pauli error on the 7-qubit color code.

m
Open source

correct_fivequbit.m

Correct any single-qubit Pauli error on the 5-qubit perfect code.

m
Open source

correct_phaseflip.m

Apply single-qubit Z correction for the 3-qubit phase-flip code.

m
Open source

correct_shor.m

Correct any single-qubit Pauli error on the 9-qubit Shor code.

m
Open source

correct_steane.m

Correct any single-qubit Pauli error on the 7-qubit Steane code.

m
Open source

correction_for_pauli_syndrome.m

Minimum-weight single-qubit correction for a Pauli syndrome.

m
Open source

decode_bacon_shor_x.m

Decode a Bacon-Shor X-error syndrome to a representative X correction.

m
Open source

decode_bacon_shor_z.m

Decode a Bacon-Shor Z-error syndrome to a representative Z correction.

m
Open source

decode_majority.m

Decode logical bit by majority vote over 3 physical qubits.

m
Open source

decode_repetition_min_weight.m

Minimum-weight decoder for a 1D repetition-code syndrome.

m
Open source

decode_surface3_min_weight.m

Shared exhaustive minimum-weight decoder for compact surface-3 syndromes.

m
Open source

decode_surface3_x_matching.m

Minimum-weight decoder for X errors on the small distance-3 surface layout.

m
Open source

decode_surface3_z_matching.m

Minimum-weight decoder for Z errors on the small distance-3 surface layout.

m
Open source

decode_surface_graph_matching.m

Decode a generic surface-layout syndrome with a bounded syndrome-graph search.

m
Open source

decode_surface_min_weight.m

Decode a generic surface-layout syndrome with a small-code-capacity decoder.

m
Open source

decode_surface_mwpm.m

Decode a generic surface-layout syndrome with an MWPM-style decoder.

m
Open source

decode_surface_union_find.m

Lightweight peeling decoder for the generic surface layout.

m
Open source

detect_four_two_two.m

Detect whether a state or Pauli error has nonzero [[4,2,2]] syndrome.

m
Open source

encode_bitflip.m

Encode |ψ> = α|0>+β|1> into 3-qubit repetition code.

m
Open source

encode_code_state.m

Dispatch encoding for a named code.

m
Open source

encode_color7.m

Encode alpha|0>+beta|1> into the 7-qubit triangular color code.

m
Open source

encode_fivequbit.m

Encode alpha|0>+beta|1> into the 5-qubit perfect code.

m
Open source

encode_four_two_two.m

Encode two logical qubits into the [[4,2,2]] error-detecting code.

m
Open source

encode_phaseflip.m

Encode alpha|0>+beta|1> into the 3-qubit phase-flip repetition code.

m
Open source

encode_shor.m

Encode alpha|0>+beta|1> into the 9-qubit Shor code.

m
Open source

encode_steane.m

Encode alpha|0>+beta|1> into the 7-qubit Steane code.

m
Open source

error_weight_counts.m

Monte Carlo histogram of number of flips under bit-flip channel.

m
Open source

fivequbit_stabilizers.m

Stabilizer generators for the 5-qubit perfect code.

m
Open source

four_two_two_stabilizers.m

Stabilizer generators for the [[4,2,2]] error-detecting code.

m
Open source

infer_from_syndrome_bitflip.m

Map syndrome bits to most likely single-qubit error.

m
Open source

kronN.m

Iterated Kronecker product of all input matrices.

m
Open source

measure_observable.m

Projectively measure a Hermitian observable with eigenvalues +/-1.

m
Open source

noisy_syndrome_bitflip.m

Measure bit-flip syndrome and flip each reported syndrome bit with prob q.

m
Open source

noisy_syndrome_surface3.m

Flip each reported surface-code syndrome bit with probability q.

m
Open source

normalize_state.m

Normalize a state vector and reject the zero vector.

m
Open source

pauli.m

Return standard single-qubit Pauli matrices I,X,Y,Z.

m
Open source

pauli_error_syndrome.m

Return stabilizer syndrome bits for a Pauli error string.

m
Open source

pauli_product_labels.m

Multiply Pauli strings, ignoring global phase.

m
Open source

pauli_recovery_success.m

Fast Pauli-error recovery check using stabilizer syndrome algebra.

m
Open source

pauli_string_operator.m

Build an n-qubit Pauli string operator from characters I, X, Y, Z.

m
Open source

qec_about.m

Print a short package summary.

m
Open source

qec_version.m

Return the package version string.

m
Open source

qstates.m

Return computational basis states |0>,|1>.

m
Open source

recover_bacon_shor_pauli.m

Recover a Bacon-Shor Pauli-frame error string using row/column syndromes.

m
Open source

recover_bitflip.m

Correct the 3-qubit bit-flip code and preserve the encoded state.

m
Open source

recover_bitflip_noisy_syndrome.m

Repeated noisy syndrome extraction for the 3-qubit bit-flip code.

m
Open source

recover_code_state.m

Dispatch recovery for a named code.

m
Open source

recover_color7.m

Measure and correct a 7-qubit triangular color-code state.

m
Open source

recover_color7_pauli.m

Pauli-frame recovery for the 7-qubit triangular color code.

m
Open source

recover_fivequbit.m

Measure and correct a 5-qubit perfect-code state.

m
Open source

recover_phaseflip.m

Correct the 3-qubit phase-flip code and preserve the encoded state.

m
Open source

recover_shor.m

Measure and correct a 9-qubit Shor-code state.

m
Open source

recover_steane.m

Measure and correct a 7-qubit Steane-code state.

m
Open source

recover_surface3_x_noisy_syndrome.m

Decode X errors using repeated noisy Z-check syndrome measurements.

m
Open source

recover_surface3_z_noisy_syndrome.m

Decode Z errors using repeated noisy X-check syndrome measurements.

m
Open source

sample_error_pattern.m

Randomly draw error pattern [e1 e2 e3] from bit-flip prob p.

m
Open source

sample_pauli_error_string.m

Sample an n-qubit independent Pauli error string.

m
Open source

simulate_bacon_shor_pauli_once.m

Simulate one Bacon-Shor Pauli-frame recovery trial under depolarizing noise.

m
Open source

simulate_bitflip_once.m

End-to-end run: encode, apply noise, correct, decode.

m
Open source

simulate_color7_pauli_once.m

Simulate one color-code Pauli-frame correction trial.

m
Open source

simulate_depolarizing_once.m

One depolarizing-noise recovery trial for a named code.

m
Open source

simulate_noisy_syndrome_bitflip_once.m

One bit-flip trial with noisy repeated syndrome measurements.

m
Open source

simulate_surface3_circuit_level_once.m

One circuit-level surface-3 trial with data, measurement, and hook faults.

m
Open source

simulate_surface3_pauli_once.m

One independent Pauli-noise decoding trial for the small surface-code model.

m
Open source

simulate_surface3_x_noisy_syndrome_once.m

One X-noise trial with repeated noisy surface-code syndrome measurements.

m
Open source

simulate_surface3_x_once.m

One X-noise decoding trial for the small surface-code prototype.

m
Open source

simulate_surface3_z_noisy_syndrome_once.m

One Z-noise trial with repeated noisy surface-code syndrome measurements.

m
Open source

simulate_surface3_z_once.m

One Z-noise decoding trial for the small surface-code prototype.

m
Open source

simulate_surface_pauli_once.m

Simulate one generic surface-layout code-capacity Pauli correction trial.

m
Open source

single_pauli_operator.m

Build an n-qubit operator with one non-identity Pauli at qubit q.

m
Open source

stabilizers_for_code.m

Return stabilizer generators for a named small code.

m
Open source

state_fidelity.m

Fidelity between two pure state vectors, insensitive to global phase.

m
Open source

steane_parity_check.m

Parity-check matrix used by the 7-qubit Steane CSS code.

m
Open source

surface3_cache_dir.m

Directory for cached Monte Carlo sweep results.

m
Open source

surface3_cache_meta.m

Metadata stored with cached surface-3 Monte Carlo results.

m
Open source

surface3_cache_version.m

Cache schema/model version for surface-3 Monte Carlo results.

m
Open source

surface3_cached_channel_sweep.m

Cached X/Z/Pauli surface-3 logical-failure sweep.

m
Open source

surface3_cached_noisy_syndrome_sweep.m

Cached repeated noisy-syndrome surface-3 sweep.

m
Open source

surface3_logical_failure.m

Return true when a residual chain has odd overlap with a logical set.

m
Open source

surface3_logical_sets.m

Logical-chain representatives for the compact 3x3 surface-code model.

m
Open source

surface3_majority_syndrome.m

Majority vote each syndrome bit across repeated measurement rounds.

m
Open source

surface3_measurement_schedule.m

Measurement schedule for the compact surface-3 circuit-level model.

m
Open source

surface3_x_checks.m

X-check supports for the small distance-3 surface-code prototype.

m
Open source

surface3_x_syndrome.m

Z-check syndrome caused by X errors on the small surface-code layout.

m
Open source

surface3_z_checks.m

Z-check supports for a small distance-3 rotated surface-code layout.

m
Open source

surface3_z_syndrome.m

X-check syndrome caused by Z errors on the small surface-code layout.

m
Open source

surface_benchmark_options.m

Read generic surface-layout benchmark defaults, environment, and CLI args.

m
Open source

surface_checks.m

Return generic surface-layout CSS check supports.

m
Open source

surface_decoder_lookup.m

Cached bounded minimum-weight lookup for generic surface-layout syndromes.

m
Open source

surface_layout.m

Build a compact odd-distance surface-code-style square layout.

m
Open source

surface_logical_failure.m

Return true when a residual chain has odd overlap with a logical line.

m
Open source

surface_syndrome.m

Syndrome of a binary data-qubit error against generic surface checks.

m
Open source

sweep_depolarizing_logical_error.m

Estimate logical failure under independent depolarizing noise.

m
Open source

sweep_logical_error.m

Estimate logical failure probability vs physical error p.

m
Open source

sweep_noisy_syndrome_bitflip.m

Compare repeated noisy syndrome rounds for the bit-flip code.

m
Open source

sweep_single_pauli_recovery_by_weight.m

Exact logical failure by low Pauli-error weight for a named code.

m
Open source

sweep_surface3_noisy_syndrome.m

Compare repeated noisy syndrome rounds for surface-3 X and Z channels.

m
Open source

sweep_surface3_pauli_logical_error.m

Monte Carlo logical failure sweep for Pauli noise on the surface-code prototype.

m
Open source

sweep_surface3_x_logical_error.m

Monte Carlo logical failure sweep for the small surface-code prototype.

m
Open source

sweep_surface3_z_logical_error.m

Monte Carlo logical failure sweep for Z errors on the small surface-code prototype.

m
Open source

sweep_surface_distance_logical_error.m

Compare generic surface-layout logical failure estimates across distances.

m
Open source

syndrome_bitflip.m

Projectively measure stabilizers Z1Z2, Z2Z3.

m
Open source

syndrome_color7.m

Measure triangular color-code CSS stabilizers.

m
Open source

syndrome_detector_history.m

Convert repeated syndrome measurements into detector-history differences.

m
Open source

syndrome_fivequbit.m

Measure the four stabilizers of the 5-qubit perfect code.

m
Open source

syndrome_four_two_two.m

Measure the two stabilizers of the [[4,2,2]] error-detecting code.

m
Open source

syndrome_phaseflip.m

Projectively measure phase-flip code stabilizers X1X2, X2X3.

m
Open source

syndrome_shor.m

Measure Shor-code bit-flip and phase-flip stabilizer syndromes.

m
Open source

syndrome_steane.m

Measure Steane-code CSS stabilizers.

m
Open source

Examples and Plot Scripts

benchmark_surface_distance_decoder.m

Print a compact benchmark table for the generic surface-layout decoder.

m
Open source

check_generated_images.m

Check that selected plotting examples create their expected image files.

m
Open source

generate_simulation_report.m

Generate a compact Markdown simulation report.

m
Open source

minimal_bacon_shor_recovery.m

Minimal 3x3 Bacon-Shor Pauli-frame recovery example.

m
Open source

minimal_bitflip_recovery.m

Minimal 3-qubit bit-flip recovery example.

m
Open source

minimal_color7_recovery.m

Minimal 7-qubit triangular color-code recovery example.

m
Open source

minimal_fivequbit_recovery.m

Minimal 5-qubit perfect-code recovery example.

m
Open source

minimal_four_two_two_detection.m

Minimal [[4,2,2]] error-detection example.

m
Open source

minimal_phaseflip_recovery.m

Minimal 3-qubit phase-flip recovery example.

m
Open source

minimal_repetition_decoder.m

Minimal variable-length repetition decoder example.

m
Open source

minimal_shor_recovery.m

Minimal 9-qubit Shor-code recovery example.

m
Open source

minimal_steane_recovery.m

Minimal 7-qubit Steane-code recovery example.

m
Open source

minimal_surface3_circuit_level.m

Minimal surface-3 circuit-level schedule example.

m
Open source

minimal_surface3_syndrome.m

Minimal surface-3 syndrome and correction example.

m
Open source

minimal_surface_distance_decoder.m

Minimal variable-distance surface-layout decoder example.

m
Open source

plot_code_recovery_comparison.m

Plot exact recovery failure by Pauli-error weight for several codes.

m
Open source

plot_confusion.m

Plot confusion matrix (true vs inferred errors) as heatmap.

m
Open source

plot_depolarizing_sweep.m

Plot depolarizing-noise logical failure for several QEC codes.

m
Open source

plot_error_weight.m

Plot distribution of error weights (0–3 flips).

m
Open source

plot_logical_vs_p.m

Plot logical failure probability vs bit-flip probability p.

m
Open source

plot_noisy_syndrome_rounds.m

Plot effect of repeated noisy syndrome measurements.

m
Open source

plot_surface3_channel_comparison.m

Compare X-only, Z-only, and Pauli-noise logical failure for surface-3.

m
Open source

plot_surface3_logical_vs_p.m

Plot logical failure for the small distance-3 surface-code prototype.

m
Open source

plot_surface3_noisy_syndrome_rounds.m

Plot effect of repeated noisy surface-3 syndrome measurements.

m
Open source

plot_surface_distance_scaling.m

Plot generic surface-layout logical failure estimates across distances.

m
Open source

plot_syndrome_hist.m

Plot histogram of measured syndromes at fixed p.

m
Open source

run_all_plots.m

Regenerate all PNG figures under images/.

m
Open source

run_bitflip_demo.m

Simulate 3-qubit bit-flip code over range of p and plot fail rate.

m
Open source

run_text_examples.m

Run non-plotting examples that print compact text output.

m
Open source

surface3_walkthrough.m

Longer walkthrough of the compact surface-3 prototype.

m
Open source

Tests

run_all_tests.m

Octave-compatible test runner for the repository.

m
Open source

test_bacon_shor.m

Compact 3x3 Bacon-Shor subsystem-code tests.

m
Open source

test_bitflip.m

3-qubit bit-flip code tests.

m
Open source

test_color7.m

7-qubit triangular color-code tests.

m
Open source

test_decoders_and_simulations.m

Decoder and simulator smoke tests.

m
Open source

test_phaseflip.m

3-qubit phase-flip code tests.

m
Open source

test_stabilizer_codes.m

Single-qubit Pauli recovery tests for stabilizer codes.

m
Open source

test_surface3.m

Small surface-code prototype tests.

m
Open source

test_surface_distance.m

Generic odd-distance surface-layout tests.

m
Open source