Full Code of quantumlib/Stim for AI

main 75d9cb12626a cached
753 files
13.2 MB
3.5M tokens
3946 symbols
1 requests
Copy disabled (too large) Download .txt
Showing preview only (13,957K chars total). Download the full file to get everything.
Repository: quantumlib/Stim
Branch: main
Commit: 75d9cb12626a
Files: 753
Total size: 13.2 MB

Directory structure:
gitextract_cojjamez/

├── .bazelrc
├── .bazelversion
├── .clang-format
├── .editorconfig
├── .github/
│   ├── SECURITY.md
│   └── workflows/
│       └── ci.yml
├── .gitignore
├── .markdownlintrc
├── BUILD
├── CITATION.cff
├── CMakeLists.txt
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── MANIFEST.in
├── MODULE.bazel
├── README.md
├── SUPPORT.md
├── WORKSPACE
├── dev/
│   ├── canvas_with_texture_for_3d_diagrams.html
│   ├── clean_build_files.sh
│   ├── compile_crumble_into_cpp_string_file.sh
│   ├── compile_crumble_into_single_html_page.sh
│   ├── doctest_proper.py
│   ├── gen_known_gates_for_js.sh
│   ├── gen_sinter_api_reference.py
│   ├── gen_stim_api_reference.py
│   ├── gen_stim_stub_file.py
│   ├── make_logo.html
│   ├── overwrite_dev_versions_with_date.py
│   ├── regen_crumble_cpp_resource.sh
│   ├── regen_docs.sh
│   ├── regen_file_lists.sh
│   ├── regen_texture_to_cpp_base64_string.sh
│   └── util_gen_stub_file.py
├── doc/
│   ├── circuit_data_references.md
│   ├── developer_documentation.md
│   ├── file_format_dem_detector_error_model.md
│   ├── file_format_stim_circuit.md
│   ├── gates.md
│   ├── getting_started.ipynb
│   ├── python_api_reference_vDev.md
│   ├── result_formats.md
│   ├── sinter_api.md
│   ├── sinter_command_line.md
│   ├── stim.pyi
│   └── usage_command_line.md
├── file_lists/
│   ├── perf_files
│   ├── pybind_files
│   ├── source_files_no_main
│   └── test_files
├── glue/
│   ├── cirq/
│   │   ├── README.md
│   │   ├── setup.py
│   │   └── stimcirq/
│   │       ├── __init__.py
│   │       ├── _cirq_to_stim.py
│   │       ├── _cirq_to_stim_test.py
│   │       ├── _cx_swap_gate.py
│   │       ├── _cx_swap_test.py
│   │       ├── _cz_swap_gate.py
│   │       ├── _cz_swap_test.py
│   │       ├── _det_annotation.py
│   │       ├── _det_annotation_test.py
│   │       ├── _i_error_gate.py
│   │       ├── _i_error_gate_test.py
│   │       ├── _ii_error_gate.py
│   │       ├── _ii_error_gate_test.py
│   │       ├── _ii_gate.py
│   │       ├── _ii_gate_test.py
│   │       ├── _measure_and_or_reset_gate.py
│   │       ├── _measure_and_or_reset_gate_test.py
│   │       ├── _obs_annotation.py
│   │       ├── _obs_annotation_test.py
│   │       ├── _shift_coords_annotation.py
│   │       ├── _shift_coords_annotation_test.py
│   │       ├── _stim_sampler.py
│   │       ├── _stim_sampler_test.py
│   │       ├── _stim_to_cirq.py
│   │       ├── _stim_to_cirq_test.py
│   │       ├── _sweep_pauli.py
│   │       ├── _sweep_pauli_test.py
│   │       ├── _two_qubit_asymmetric_depolarize.py
│   │       └── _two_qubit_asymmetric_depolarize_test.py
│   ├── crumble/
│   │   ├── README.md
│   │   ├── base/
│   │   │   ├── cooldown_throttle.js
│   │   │   ├── describe.js
│   │   │   ├── describe.test.js
│   │   │   ├── equate.js
│   │   │   ├── equate.test.js
│   │   │   ├── history_pusher.js
│   │   │   ├── obs.js
│   │   │   ├── obs.test.js
│   │   │   ├── revision.js
│   │   │   ├── revision.test.js
│   │   │   ├── seq.js
│   │   │   └── seq.test.js
│   │   ├── circuit/
│   │   │   ├── circuit.js
│   │   │   ├── circuit.test.js
│   │   │   ├── layer.js
│   │   │   ├── layer.test.js
│   │   │   ├── operation.js
│   │   │   ├── pauli_frame.js
│   │   │   ├── pauli_frame.test.js
│   │   │   ├── propagated_pauli_frames.js
│   │   │   └── propagated_pauli_frames.test.js
│   │   ├── crumble.html
│   │   ├── draw/
│   │   │   ├── config.js
│   │   │   ├── draw_util.js
│   │   │   ├── main_draw.js
│   │   │   ├── main_draw.test.js
│   │   │   ├── state_snapshot.js
│   │   │   └── timeline_viewer.js
│   │   ├── editor/
│   │   │   ├── editor_state.js
│   │   │   ├── editor_state.test.js
│   │   │   └── sync_url_to_state.js
│   │   ├── gates/
│   │   │   ├── gate.js
│   │   │   ├── gate_draw_util.js
│   │   │   ├── gateset.js
│   │   │   ├── gateset.test.js
│   │   │   ├── gateset_controlled_paulis.js
│   │   │   ├── gateset_demolition_measurements.js
│   │   │   ├── gateset_hadamard_likes.js
│   │   │   ├── gateset_markers.js
│   │   │   ├── gateset_mpp.js
│   │   │   ├── gateset_pair_measurements.js
│   │   │   ├── gateset_paulis.js
│   │   │   ├── gateset_quarter_turns.js
│   │   │   ├── gateset_resets.js
│   │   │   ├── gateset_solo_measurements.js
│   │   │   ├── gateset_sqrt_pauli_pairs.js
│   │   │   ├── gateset_swaps.js
│   │   │   └── gateset_third_turns.js
│   │   ├── keyboard/
│   │   │   ├── chord.js
│   │   │   ├── chord.test.js
│   │   │   └── toolbox.js
│   │   ├── main.js
│   │   ├── package.json
│   │   ├── run_tests_headless.js
│   │   └── test/
│   │       ├── generated_gate_name_list.test.js
│   │       ├── test.html
│   │       ├── test_import_all.js
│   │       ├── test_main.js
│   │       ├── test_util.js
│   │       └── test_util.test.js
│   ├── javascript/
│   │   ├── README.md
│   │   ├── build_wasm.sh
│   │   ├── circuit.js.cc
│   │   ├── circuit.js.h
│   │   ├── circuit.test.js
│   │   ├── common.js.cc
│   │   ├── common.js.h
│   │   ├── pauli_string.js.cc
│   │   ├── pauli_string.js.h
│   │   ├── pauli_string.test.js
│   │   ├── stim.js.cc
│   │   ├── stim.test_harness.js
│   │   ├── tableau.js.cc
│   │   ├── tableau.js.h
│   │   ├── tableau.test.js
│   │   ├── tableau_simulator.js.cc
│   │   ├── tableau_simulator.js.h
│   │   └── tableau_simulator.test.js
│   ├── lattice_surgery/
│   │   ├── README.md
│   │   ├── docs/
│   │   │   └── demo.ipynb
│   │   ├── lassynth/
│   │   │   ├── __init__.py
│   │   │   ├── lattice_surgery_synthesis.py
│   │   │   ├── rewrite_passes/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── attach_fixups.py
│   │   │   │   ├── color_z.py
│   │   │   │   └── remove_unconnected.py
│   │   │   ├── sat_synthesis/
│   │   │   │   ├── __init__.py
│   │   │   │   └── lattice_surgery_sat.py
│   │   │   ├── tools/
│   │   │   │   ├── __init__.py
│   │   │   │   └── verify_stabilizers.py
│   │   │   └── translators/
│   │   │       ├── __init__.py
│   │   │       ├── gltf_generator.py
│   │   │       ├── networkx_generator.py
│   │   │       ├── textfig_generator.py
│   │   │       └── zx_grid_graph.py
│   │   ├── setup.py
│   │   └── stimzx/
│   │       ├── __init__.py
│   │       ├── _external_stabilizer.py
│   │       ├── _external_stabilizer_test.py
│   │       ├── _text_diagram_parsing.py
│   │       ├── _text_diagram_parsing_test.py
│   │       ├── _zx_graph_solver.py
│   │       └── _zx_graph_solver_test.py
│   ├── python/
│   │   ├── README.md
│   │   └── src/
│   │       └── stim/
│   │           ├── __init__.py
│   │           ├── __init__.pyi
│   │           └── _main_argv.py
│   ├── sample/
│   │   ├── MANIFEST.in
│   │   ├── README.md
│   │   ├── requirements.txt
│   │   ├── setup.py
│   │   └── src/
│   │       └── sinter/
│   │           ├── __init__.py
│   │           ├── _collection/
│   │           │   ├── __init__.py
│   │           │   ├── _collection.py
│   │           │   ├── _collection_manager.py
│   │           │   ├── _collection_manager_test.py
│   │           │   ├── _collection_test.py
│   │           │   ├── _collection_worker_loop.py
│   │           │   ├── _collection_worker_state.py
│   │           │   ├── _collection_worker_test.py
│   │           │   ├── _mux_sampler.py
│   │           │   ├── _printer.py
│   │           │   ├── _sampler_ramp_throttled.py
│   │           │   └── _sampler_ramp_throttled_test.py
│   │           ├── _command/
│   │           │   ├── __init__.py
│   │           │   ├── _main.py
│   │           │   ├── _main_collect.py
│   │           │   ├── _main_collect_test.py
│   │           │   ├── _main_combine.py
│   │           │   ├── _main_combine_test.py
│   │           │   ├── _main_plot.py
│   │           │   ├── _main_plot_test.py
│   │           │   ├── _main_predict.py
│   │           │   └── _main_predict_test.py
│   │           ├── _data/
│   │           │   ├── __init__.py
│   │           │   ├── _anon_task_stats.py
│   │           │   ├── _anon_task_stats_test.py
│   │           │   ├── _collection_options.py
│   │           │   ├── _collection_options_test.py
│   │           │   ├── _csv_out.py
│   │           │   ├── _existing_data.py
│   │           │   ├── _existing_data_test.py
│   │           │   ├── _task.py
│   │           │   ├── _task_stats.py
│   │           │   ├── _task_stats_test.py
│   │           │   └── _task_test.py
│   │           ├── _decoding/
│   │           │   ├── __init__.py
│   │           │   ├── _decoding.py
│   │           │   ├── _decoding_all_built_in_decoders.py
│   │           │   ├── _decoding_decoder_class.py
│   │           │   ├── _decoding_fusion_blossom.py
│   │           │   ├── _decoding_mwpf.py
│   │           │   ├── _decoding_pymatching.py
│   │           │   ├── _decoding_test.py
│   │           │   ├── _decoding_vacuous.py
│   │           │   ├── _perfectionist_sampler.py
│   │           │   ├── _sampler.py
│   │           │   ├── _stim_then_decode_sampler.py
│   │           │   └── _stim_then_decode_sampler_test.py
│   │           ├── _plotting.py
│   │           ├── _plotting_test.py
│   │           ├── _predict.py
│   │           ├── _predict_test.py
│   │           ├── _probability_util.py
│   │           └── _probability_util_test.py
│   └── zx/
│       ├── README.md
│       ├── setup.py
│       └── stimzx/
│           ├── __init__.py
│           ├── _external_stabilizer.py
│           ├── _external_stabilizer_test.py
│           ├── _text_diagram_parsing.py
│           ├── _text_diagram_parsing_test.py
│           ├── _zx_graph_solver.py
│           └── _zx_graph_solver_test.py
├── package.json
├── puppeteer_run_tests.js
├── pyproject.toml
├── setup.py
├── src/
│   ├── main.cc
│   ├── stim/
│   │   ├── circuit/
│   │   │   ├── circuit.cc
│   │   │   ├── circuit.h
│   │   │   ├── circuit.perf.cc
│   │   │   ├── circuit.pybind.cc
│   │   │   ├── circuit.pybind.h
│   │   │   ├── circuit.test.cc
│   │   │   ├── circuit.test.h
│   │   │   ├── circuit2.pybind.cc
│   │   │   ├── circuit_instruction.cc
│   │   │   ├── circuit_instruction.h
│   │   │   ├── circuit_instruction.pybind.cc
│   │   │   ├── circuit_instruction.pybind.h
│   │   │   ├── circuit_instruction.test.cc
│   │   │   ├── circuit_instruction_pybind_test.py
│   │   │   ├── circuit_pybind_test.py
│   │   │   ├── circuit_repeat_block.pybind.cc
│   │   │   ├── circuit_repeat_block.pybind.h
│   │   │   ├── circuit_repeat_block_test.py
│   │   │   ├── gate_decomposition.cc
│   │   │   ├── gate_decomposition.h
│   │   │   ├── gate_decomposition.test.cc
│   │   │   ├── gate_target.cc
│   │   │   ├── gate_target.h
│   │   │   ├── gate_target.pybind.cc
│   │   │   ├── gate_target.pybind.h
│   │   │   ├── gate_target.test.cc
│   │   │   └── gate_target_pybind_test.py
│   │   ├── cmd/
│   │   │   ├── command_analyze_errors.cc
│   │   │   ├── command_analyze_errors.h
│   │   │   ├── command_analyze_errors.test.cc
│   │   │   ├── command_convert.cc
│   │   │   ├── command_convert.h
│   │   │   ├── command_convert.test.cc
│   │   │   ├── command_detect.cc
│   │   │   ├── command_detect.h
│   │   │   ├── command_detect.test.cc
│   │   │   ├── command_diagram.cc
│   │   │   ├── command_diagram.h
│   │   │   ├── command_diagram.pybind.cc
│   │   │   ├── command_diagram.pybind.h
│   │   │   ├── command_diagram.test.cc
│   │   │   ├── command_explain_errors.cc
│   │   │   ├── command_explain_errors.h
│   │   │   ├── command_explain_errors.test.cc
│   │   │   ├── command_gen.cc
│   │   │   ├── command_gen.h
│   │   │   ├── command_gen.test.cc
│   │   │   ├── command_help.cc
│   │   │   ├── command_help.h
│   │   │   ├── command_m2d.cc
│   │   │   ├── command_m2d.h
│   │   │   ├── command_m2d.test.cc
│   │   │   ├── command_repl.cc
│   │   │   ├── command_repl.h
│   │   │   ├── command_sample.cc
│   │   │   ├── command_sample.h
│   │   │   ├── command_sample.test.cc
│   │   │   ├── command_sample_dem.cc
│   │   │   ├── command_sample_dem.h
│   │   │   └── command_sample_dem.test.cc
│   │   ├── dem/
│   │   │   ├── dem_instruction.cc
│   │   │   ├── dem_instruction.h
│   │   │   ├── dem_instruction.pybind.cc
│   │   │   ├── dem_instruction.pybind.h
│   │   │   ├── dem_instruction.test.cc
│   │   │   ├── dem_instruction_pybind_test.py
│   │   │   ├── detector_error_model.cc
│   │   │   ├── detector_error_model.h
│   │   │   ├── detector_error_model.pybind.cc
│   │   │   ├── detector_error_model.pybind.h
│   │   │   ├── detector_error_model.test.cc
│   │   │   ├── detector_error_model_pybind_test.py
│   │   │   ├── detector_error_model_repeat_block.pybind.cc
│   │   │   ├── detector_error_model_repeat_block.pybind.h
│   │   │   ├── detector_error_model_repeat_block_pybind_test.py
│   │   │   ├── detector_error_model_target.pybind.cc
│   │   │   ├── detector_error_model_target.pybind.h
│   │   │   └── detector_error_model_target_pybind_test.py
│   │   ├── diagram/
│   │   │   ├── ascii_diagram.cc
│   │   │   ├── ascii_diagram.h
│   │   │   ├── ascii_diagram.test.cc
│   │   │   ├── base64.cc
│   │   │   ├── base64.h
│   │   │   ├── base64.test.cc
│   │   │   ├── basic_3d_diagram.cc
│   │   │   ├── basic_3d_diagram.h
│   │   │   ├── circuit_timeline_helper.cc
│   │   │   ├── circuit_timeline_helper.h
│   │   │   ├── coord.h
│   │   │   ├── coord.test.cc
│   │   │   ├── crumble.cc
│   │   │   ├── crumble.h
│   │   │   ├── crumble_data.cc
│   │   │   ├── crumble_data.h
│   │   │   ├── detector_slice/
│   │   │   │   ├── detector_slice_set.cc
│   │   │   │   ├── detector_slice_set.h
│   │   │   │   └── detector_slice_set.test.cc
│   │   │   ├── diagram_util.cc
│   │   │   ├── diagram_util.h
│   │   │   ├── gate_data_3d.cc
│   │   │   ├── gate_data_3d.h
│   │   │   ├── gate_data_3d_texture_data.cc
│   │   │   ├── gate_data_3d_texture_data.h
│   │   │   ├── gate_data_svg.cc
│   │   │   ├── gate_data_svg.h
│   │   │   ├── gltf.cc
│   │   │   ├── gltf.h
│   │   │   ├── graph/
│   │   │   │   ├── match_graph_3d_drawer.cc
│   │   │   │   ├── match_graph_3d_drawer.h
│   │   │   │   ├── match_graph_3d_drawer.test.cc
│   │   │   │   ├── match_graph_svg_drawer.cc
│   │   │   │   ├── match_graph_svg_drawer.h
│   │   │   │   └── match_graph_svg_drawer.test.cc
│   │   │   ├── json_obj.cc
│   │   │   ├── json_obj.h
│   │   │   ├── json_obj.test.cc
│   │   │   ├── lattice_map.cc
│   │   │   ├── lattice_map.h
│   │   │   └── timeline/
│   │   │       ├── timeline_3d_drawer.cc
│   │   │       ├── timeline_3d_drawer.h
│   │   │       ├── timeline_3d_drawer.test.cc
│   │   │       ├── timeline_ascii_drawer.cc
│   │   │       ├── timeline_ascii_drawer.h
│   │   │       ├── timeline_ascii_drawer.test.cc
│   │   │       ├── timeline_svg_drawer.cc
│   │   │       ├── timeline_svg_drawer.h
│   │   │       └── timeline_svg_drawer.test.cc
│   │   ├── gates/
│   │   │   ├── gate_data_annotations.cc
│   │   │   ├── gate_data_blocks.cc
│   │   │   ├── gate_data_collapsing.cc
│   │   │   ├── gate_data_controlled.cc
│   │   │   ├── gate_data_hada.cc
│   │   │   ├── gate_data_heralded.cc
│   │   │   ├── gate_data_noisy.cc
│   │   │   ├── gate_data_pair_measure.cc
│   │   │   ├── gate_data_pauli.cc
│   │   │   ├── gate_data_pauli_product.cc
│   │   │   ├── gate_data_period_3.cc
│   │   │   ├── gate_data_period_4.cc
│   │   │   ├── gate_data_pp.cc
│   │   │   ├── gate_data_swaps.cc
│   │   │   ├── gates.cc
│   │   │   ├── gates.h
│   │   │   ├── gates.perf.cc
│   │   │   ├── gates.pybind.cc
│   │   │   ├── gates.pybind.h
│   │   │   ├── gates.test.cc
│   │   │   └── gates_test.py
│   │   ├── gen/
│   │   │   ├── circuit_gen_params.cc
│   │   │   ├── circuit_gen_params.h
│   │   │   ├── circuit_gen_params.test.cc
│   │   │   ├── gen_color_code.cc
│   │   │   ├── gen_color_code.h
│   │   │   ├── gen_color_code.test.cc
│   │   │   ├── gen_rep_code.cc
│   │   │   ├── gen_rep_code.h
│   │   │   ├── gen_rep_code.test.cc
│   │   │   ├── gen_surface_code.cc
│   │   │   ├── gen_surface_code.h
│   │   │   └── gen_surface_code.test.cc
│   │   ├── io/
│   │   │   ├── README.md
│   │   │   ├── measure_record.cc
│   │   │   ├── measure_record.h
│   │   │   ├── measure_record.test.cc
│   │   │   ├── measure_record_batch.h
│   │   │   ├── measure_record_batch.inl
│   │   │   ├── measure_record_batch.test.cc
│   │   │   ├── measure_record_batch_writer.cc
│   │   │   ├── measure_record_batch_writer.h
│   │   │   ├── measure_record_batch_writer.test.cc
│   │   │   ├── measure_record_reader.h
│   │   │   ├── measure_record_reader.inl
│   │   │   ├── measure_record_reader.perf.cc
│   │   │   ├── measure_record_reader.test.cc
│   │   │   ├── measure_record_writer.cc
│   │   │   ├── measure_record_writer.h
│   │   │   ├── measure_record_writer.test.cc
│   │   │   ├── raii_file.cc
│   │   │   ├── raii_file.h
│   │   │   ├── read_write.pybind.cc
│   │   │   ├── read_write.pybind.h
│   │   │   ├── read_write_pytest.py
│   │   │   ├── sparse_shot.cc
│   │   │   ├── sparse_shot.h
│   │   │   ├── sparse_shot.test.cc
│   │   │   ├── stim_data_formats.cc
│   │   │   └── stim_data_formats.h
│   │   ├── main.perf.cc
│   │   ├── main_namespaced.cc
│   │   ├── main_namespaced.h
│   │   ├── main_namespaced.perf.cc
│   │   ├── main_namespaced.test.cc
│   │   ├── main_namespaced.test.h
│   │   ├── mem/
│   │   │   ├── README.md
│   │   │   ├── bit_ref.cc
│   │   │   ├── bit_ref.h
│   │   │   ├── bit_ref.test.cc
│   │   │   ├── bitword.h
│   │   │   ├── bitword_128_sse.h
│   │   │   ├── bitword_256_avx.h
│   │   │   ├── bitword_64.h
│   │   │   ├── fixed_cap_vector.h
│   │   │   ├── fixed_cap_vector.test.cc
│   │   │   ├── monotonic_buffer.h
│   │   │   ├── monotonic_buffer.test.cc
│   │   │   ├── simd_bit_table.h
│   │   │   ├── simd_bit_table.inl
│   │   │   ├── simd_bit_table.perf.cc
│   │   │   ├── simd_bit_table.test.cc
│   │   │   ├── simd_bits.h
│   │   │   ├── simd_bits.inl
│   │   │   ├── simd_bits.perf.cc
│   │   │   ├── simd_bits.test.cc
│   │   │   ├── simd_bits_range_ref.h
│   │   │   ├── simd_bits_range_ref.inl
│   │   │   ├── simd_bits_range_ref.test.cc
│   │   │   ├── simd_util.cc
│   │   │   ├── simd_util.h
│   │   │   ├── simd_util.test.cc
│   │   │   ├── simd_word.cc
│   │   │   ├── simd_word.h
│   │   │   ├── simd_word.perf.cc
│   │   │   ├── simd_word.test.cc
│   │   │   ├── simd_word.test.h
│   │   │   ├── span_ref.h
│   │   │   ├── sparse_xor_vec.cc
│   │   │   ├── sparse_xor_vec.h
│   │   │   ├── sparse_xor_vec.perf.cc
│   │   │   └── sparse_xor_vec.test.cc
│   │   ├── perf.perf.h
│   │   ├── py/
│   │   │   ├── README.md
│   │   │   ├── base.pybind.cc
│   │   │   ├── base.pybind.h
│   │   │   ├── compiled_detector_sampler.pybind.cc
│   │   │   ├── compiled_detector_sampler.pybind.h
│   │   │   ├── compiled_detector_sampler_pybind_test.py
│   │   │   ├── compiled_measurement_sampler.pybind.cc
│   │   │   ├── compiled_measurement_sampler.pybind.h
│   │   │   ├── compiled_measurement_sampler_pybind_test.py
│   │   │   ├── march.pybind.cc
│   │   │   ├── march.pybind.h
│   │   │   ├── numpy.pybind.cc
│   │   │   ├── numpy.pybind.h
│   │   │   ├── stim.pybind.cc
│   │   │   └── stim_pybind_test.py
│   │   ├── search/
│   │   │   ├── graphlike/
│   │   │   │   ├── algo.cc
│   │   │   │   ├── algo.h
│   │   │   │   ├── algo.perf.cc
│   │   │   │   ├── algo.test.cc
│   │   │   │   ├── edge.cc
│   │   │   │   ├── edge.h
│   │   │   │   ├── edge.test.cc
│   │   │   │   ├── graph.cc
│   │   │   │   ├── graph.h
│   │   │   │   ├── graph.test.cc
│   │   │   │   ├── node.cc
│   │   │   │   ├── node.h
│   │   │   │   ├── node.test.cc
│   │   │   │   ├── search_state.cc
│   │   │   │   ├── search_state.h
│   │   │   │   └── search_state.test.cc
│   │   │   ├── hyper/
│   │   │   │   ├── algo.cc
│   │   │   │   ├── algo.h
│   │   │   │   ├── algo.test.cc
│   │   │   │   ├── edge.cc
│   │   │   │   ├── edge.h
│   │   │   │   ├── edge.test.cc
│   │   │   │   ├── graph.cc
│   │   │   │   ├── graph.h
│   │   │   │   ├── graph.test.cc
│   │   │   │   ├── node.cc
│   │   │   │   ├── node.h
│   │   │   │   ├── node.test.cc
│   │   │   │   ├── search_state.cc
│   │   │   │   ├── search_state.h
│   │   │   │   └── search_state.test.cc
│   │   │   ├── sat/
│   │   │   │   ├── wcnf.cc
│   │   │   │   ├── wcnf.h
│   │   │   │   └── wcnf.test.cc
│   │   │   └── search.h
│   │   ├── simulators/
│   │   │   ├── README.md
│   │   │   ├── dem_sampler.h
│   │   │   ├── dem_sampler.inl
│   │   │   ├── dem_sampler.perf.cc
│   │   │   ├── dem_sampler.pybind.cc
│   │   │   ├── dem_sampler.pybind.h
│   │   │   ├── dem_sampler.test.cc
│   │   │   ├── dem_sampler_pybind_test.py
│   │   │   ├── error_analyzer.cc
│   │   │   ├── error_analyzer.h
│   │   │   ├── error_analyzer.perf.cc
│   │   │   ├── error_analyzer.test.cc
│   │   │   ├── error_matcher.cc
│   │   │   ├── error_matcher.h
│   │   │   ├── error_matcher.test.cc
│   │   │   ├── force_streaming.cc
│   │   │   ├── force_streaming.h
│   │   │   ├── frame_simulator.h
│   │   │   ├── frame_simulator.inl
│   │   │   ├── frame_simulator.perf.cc
│   │   │   ├── frame_simulator.pybind.cc
│   │   │   ├── frame_simulator.pybind.h
│   │   │   ├── frame_simulator.test.cc
│   │   │   ├── frame_simulator_pybind_test.py
│   │   │   ├── frame_simulator_util.h
│   │   │   ├── frame_simulator_util.inl
│   │   │   ├── frame_simulator_util.test.cc
│   │   │   ├── graph_simulator.cc
│   │   │   ├── graph_simulator.h
│   │   │   ├── graph_simulator.test.cc
│   │   │   ├── matched_error.cc
│   │   │   ├── matched_error.h
│   │   │   ├── matched_error.pybind.cc
│   │   │   ├── matched_error.pybind.h
│   │   │   ├── matched_error.test.cc
│   │   │   ├── matched_error_pybind_test.py
│   │   │   ├── measurements_to_detection_events.h
│   │   │   ├── measurements_to_detection_events.inl
│   │   │   ├── measurements_to_detection_events.pybind.cc
│   │   │   ├── measurements_to_detection_events.pybind.h
│   │   │   ├── measurements_to_detection_events.test.cc
│   │   │   ├── measurements_to_detection_events_test.py
│   │   │   ├── sparse_rev_frame_tracker.cc
│   │   │   ├── sparse_rev_frame_tracker.h
│   │   │   ├── sparse_rev_frame_tracker.test.cc
│   │   │   ├── tableau_simulator.h
│   │   │   ├── tableau_simulator.inl
│   │   │   ├── tableau_simulator.perf.cc
│   │   │   ├── tableau_simulator.pybind.cc
│   │   │   ├── tableau_simulator.pybind.h
│   │   │   ├── tableau_simulator.test.cc
│   │   │   ├── tableau_simulator_pybind_test.py
│   │   │   ├── vector_simulator.cc
│   │   │   ├── vector_simulator.h
│   │   │   └── vector_simulator.test.cc
│   │   ├── stabilizers/
│   │   │   ├── README.md
│   │   │   ├── clifford_string.h
│   │   │   ├── clifford_string.perf.cc
│   │   │   ├── clifford_string.pybind.cc
│   │   │   ├── clifford_string.pybind.h
│   │   │   ├── clifford_string.test.cc
│   │   │   ├── clifford_string_pybind_test.py
│   │   │   ├── flex_pauli_string.cc
│   │   │   ├── flex_pauli_string.h
│   │   │   ├── flex_pauli_string.test.cc
│   │   │   ├── flow.h
│   │   │   ├── flow.inl
│   │   │   ├── flow.pybind.cc
│   │   │   ├── flow.pybind.h
│   │   │   ├── flow.test.cc
│   │   │   ├── flow_pybind_test.py
│   │   │   ├── pauli_string.h
│   │   │   ├── pauli_string.inl
│   │   │   ├── pauli_string.perf.cc
│   │   │   ├── pauli_string.pybind.cc
│   │   │   ├── pauli_string.pybind.h
│   │   │   ├── pauli_string.test.cc
│   │   │   ├── pauli_string_iter.h
│   │   │   ├── pauli_string_iter.inl
│   │   │   ├── pauli_string_iter.perf.cc
│   │   │   ├── pauli_string_iter.pybind.cc
│   │   │   ├── pauli_string_iter.pybind.h
│   │   │   ├── pauli_string_iter.test.cc
│   │   │   ├── pauli_string_pybind_test.py
│   │   │   ├── pauli_string_ref.h
│   │   │   ├── pauli_string_ref.inl
│   │   │   ├── pauli_string_ref.test.cc
│   │   │   ├── tableau.h
│   │   │   ├── tableau.inl
│   │   │   ├── tableau.perf.cc
│   │   │   ├── tableau.pybind.cc
│   │   │   ├── tableau.pybind.h
│   │   │   ├── tableau.test.cc
│   │   │   ├── tableau_iter.h
│   │   │   ├── tableau_iter.inl
│   │   │   ├── tableau_iter.perf.cc
│   │   │   ├── tableau_iter.pybind.cc
│   │   │   ├── tableau_iter.pybind.h
│   │   │   ├── tableau_iter.test.cc
│   │   │   ├── tableau_pybind_test.py
│   │   │   ├── tableau_specialized_prepend.inl
│   │   │   ├── tableau_transposed_raii.h
│   │   │   └── tableau_transposed_raii.inl
│   │   ├── util_bot/
│   │   │   ├── arg_parse.cc
│   │   │   ├── arg_parse.h
│   │   │   ├── arg_parse.test.cc
│   │   │   ├── error_decomp.cc
│   │   │   ├── error_decomp.h
│   │   │   ├── error_decomp.perf.cc
│   │   │   ├── error_decomp.test.cc
│   │   │   ├── probability_util.cc
│   │   │   ├── probability_util.h
│   │   │   ├── probability_util.perf.cc
│   │   │   ├── probability_util.test.cc
│   │   │   ├── str_util.h
│   │   │   ├── str_util.test.cc
│   │   │   ├── test_util.test.cc
│   │   │   ├── test_util.test.h
│   │   │   ├── twiddle.h
│   │   │   └── twiddle.test.cc
│   │   └── util_top/
│   │       ├── circuit_flow_generators.h
│   │       ├── circuit_flow_generators.inl
│   │       ├── circuit_flow_generators.test.cc
│   │       ├── circuit_flow_generators_test.py
│   │       ├── circuit_inverse_qec.cc
│   │       ├── circuit_inverse_qec.h
│   │       ├── circuit_inverse_qec.inl
│   │       ├── circuit_inverse_qec.test.cc
│   │       ├── circuit_inverse_qec_test.py
│   │       ├── circuit_inverse_unitary.cc
│   │       ├── circuit_inverse_unitary.h
│   │       ├── circuit_inverse_unitary.test.cc
│   │       ├── circuit_to_dem.h
│   │       ├── circuit_to_dem.test.cc
│   │       ├── circuit_to_detecting_regions.cc
│   │       ├── circuit_to_detecting_regions.h
│   │       ├── circuit_to_detecting_regions.test.cc
│   │       ├── circuit_to_detecting_regions_test.py
│   │       ├── circuit_vs_amplitudes.cc
│   │       ├── circuit_vs_amplitudes.h
│   │       ├── circuit_vs_amplitudes.test.cc
│   │       ├── circuit_vs_tableau.h
│   │       ├── circuit_vs_tableau.inl
│   │       ├── circuit_vs_tableau.test.cc
│   │       ├── count_determined_measurements.h
│   │       ├── count_determined_measurements.inl
│   │       ├── count_determined_measurements.test.cc
│   │       ├── export_crumble_url.cc
│   │       ├── export_crumble_url.h
│   │       ├── export_crumble_url.test.cc
│   │       ├── export_crumble_url_pybind_test.py
│   │       ├── export_qasm.cc
│   │       ├── export_qasm.h
│   │       ├── export_qasm.test.cc
│   │       ├── export_qasm_pybind_test.py
│   │       ├── export_quirk_url.cc
│   │       ├── export_quirk_url.h
│   │       ├── export_quirk_url.test.cc
│   │       ├── export_quirk_url_pybind_test.py
│   │       ├── has_flow.cc
│   │       ├── has_flow.h
│   │       ├── has_flow.inl
│   │       ├── has_flow.test.cc
│   │       ├── mbqc_decomposition.cc
│   │       ├── mbqc_decomposition.h
│   │       ├── mbqc_decomposition.test.cc
│   │       ├── missing_detectors.cc
│   │       ├── missing_detectors.h
│   │       ├── missing_detectors.test.cc
│   │       ├── reference_sample_tree.cc
│   │       ├── reference_sample_tree.h
│   │       ├── reference_sample_tree.inl
│   │       ├── reference_sample_tree.perf.cc
│   │       ├── reference_sample_tree.test.cc
│   │       ├── simplified_circuit.cc
│   │       ├── simplified_circuit.h
│   │       ├── simplified_circuit.test.cc
│   │       ├── stabilizers_to_tableau.h
│   │       ├── stabilizers_to_tableau.inl
│   │       ├── stabilizers_to_tableau.perf.cc
│   │       ├── stabilizers_to_tableau.test.cc
│   │       ├── stabilizers_vs_amplitudes.h
│   │       ├── stabilizers_vs_amplitudes.inl
│   │       ├── stabilizers_vs_amplitudes.test.cc
│   │       ├── transform_without_feedback.cc
│   │       ├── transform_without_feedback.h
│   │       └── transform_without_feedback.test.cc
│   ├── stim.cc
│   ├── stim.h
│   ├── stim.test.cc
│   └── stim_included_twice.test.cc
└── testdata/
    ├── circuit_all_ops_3d.gltf
    ├── classical_feedback.gltf
    ├── collapsing.gltf
    ├── detector_pseudo_targets.gltf
    ├── empty_match_graph.gltf
    ├── lattice_surgery_cnot.gltf
    ├── match_graph_no_coords.gltf
    ├── match_graph_repetition_code.gltf
    ├── match_graph_surface_code.gltf
    ├── measurement_looping.gltf
    ├── noise_gates_1.gltf
    ├── noise_gates_2.gltf
    ├── noise_gates_3.gltf
    ├── repeat.gltf
    ├── repetition_code.gltf
    ├── single_qubits_gates.gltf
    ├── surface_code.gltf
    ├── test_circuit_all_ops.gltf
    ├── tick.gltf
    └── two_qubits_gates.gltf

================================================
FILE CONTENTS
================================================

================================================
FILE: .bazelrc
================================================
test --test_output=errors


================================================
FILE: .bazelversion
================================================
7.2.0


================================================
FILE: .clang-format
================================================
---
Language: Cpp
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 120
AlignAfterOpenBracket: AlwaysBreak
AllowShortBlocksOnASingleLine: Never
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AllowShortLambdasOnASingleLine: None
BinPackArguments: false
BinPackParameters: false
PointerAlignment: Right

IncludeCategories:
  - Regex:           '^<.*>$'
    Priority:        1
  - Regex:           '^"gtest/.*"$'
    Priority:        2
  - Regex:           '^".*"$'
    Priority:        3
...


================================================
FILE: .editorconfig
================================================
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Common editor configurations for this project.
#
# EditorConfig is a file format for specifying some common style parameters.
# Many IDEs & editors read .editorconfig files, either natively or via plugins.
# We mostly follow Google's style guides (https://google.github.io/styleguide/)
# with only a few deviations for line length and indentation in some files.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

root = true

[*]
charset = utf-8
indent_style = space
insert_final_newline = true
spelling_language = en-US
trim_trailing_whitespace = true
max_line_length = 120

[{BUILD,*.BUILD,*.bzl,*.bazel,.bazelrc}]
indent_size = 4

[{*.cc,*.h}]
indent_size = 4

[{*.js,*.ts}]
indent_size = 4

[*.json]
indent_size = 2

[*.py]
indent_size = 4

[*.sh]
indent_size = 4

[{*.yaml,*.yml}]
indent_size = 2


================================================
FILE: .github/SECURITY.md
================================================
# Reporting security issues

The Stim developers and community take security bugs in Stim seriously. We
appreciate your efforts to disclose your findings responsibly, and will make
every effort to acknowledge your contributions.

Please **do not** use GitHub issues to report security vulnerabilities; GitHub
issues are public, and doing so could allow someone to exploit the information
before the problem can be addressed. Instead, please use the GitHub ["Report a
Vulnerability"](https://github.com/quantumlib/Stim/security/advisories/new)
interface from the _Security_ tab of the Stim repository.

Please report security issues in third-party modules to the person or team
maintaining the module rather than the Stim project stewards, unless you
believe that some action needs to be taken with Stim in order to guard
against the effects of a security vulnerability in a third-party module.

## Responses to security reports

The project stewards at Google Quantum AI will send a response indicating the
next steps in handling your report. After the initial reply to your report, the
project stewards will keep you informed of the progress towards a fix and full
announcement, and may ask for additional information or guidance.

## Additional points of contact

Please contact the project stewards at Google Quantum AI via email at
quantum-oss-maintainers@google.com if you have questions or other concerns. If
for any reason you are uncomfortable reaching out to the project stewards,
please email opensource@google.com.


================================================
FILE: .github/workflows/ci.yml
================================================
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: ci
on:
  push:
    branches:
      - main
    tags:
      - v*
  pull_request:
    branches:
      - main
jobs:
  build_dist:
    runs-on: ${{ matrix.os_dist.os }}
    strategy:
      fail-fast: false
      matrix:
        os_dist: [
          {os: ubuntu-24.04, dist: cp38-manylinux_x86_64},
          {os: ubuntu-24.04, dist: cp39-manylinux_x86_64},
          {os: ubuntu-24.04, dist: cp310-manylinux_x86_64},
          {os: ubuntu-24.04, dist: cp311-manylinux_x86_64},
          {os: ubuntu-24.04, dist: cp312-manylinux_x86_64},
          {os: ubuntu-24.04, dist: cp313-manylinux_x86_64},
          {os: ubuntu-24.04, dist: cp314-manylinux_x86_64},

          # cp38-manylinux_i686 disabled because pandas isn't prebuilt and takes 20 minutes to build.
          # {os: ubuntu-latest, dist: cp38-manylinux_i686},
          # cp39-manylinux_i686 disabled because pandas isn't prebuilt and takes 20 minutes to build.
          # {os: ubuntu-latest, dist: cp39-manylinux_i686},
          # cp310-manylinux_i686 disabled because scipy isn't prebuilt and fails to build.
          #
          # The actual error seen in github actions:
          #
          #     numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK
          #     libraries found. To build Scipy from sources, BLAS & LAPACK
          #     libraries need to be installed.
          #
          #{os: ubuntu-latest, dist: cp310-manylinux_i686},

          # pypy manylinux builds disabled because scipy isn't prebuilt and fails to build.
          #
          # The actual error seen in github actions:
          #
          #     numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK
          #     libraries found. To build Scipy from sources, BLAS & LAPACK
          #     libraries need to be installed.
          #
          # {os: ubuntu-latest, dist: pp37-manylinux_x86_64},
          # {os: ubuntu-latest, dist: pp38-manylinux_x86_64},
          # {os: ubuntu-latest, dist: pp39-manylinux_x86_64},
          # {os: ubuntu-latest, dist: pp37-manylinux_i686},
          # {os: ubuntu-latest, dist: pp38-manylinux_i686},
          # {os: ubuntu-latest, dist: pp39-manylinux_i686},

          # musllinux builds disabled because scipy isn't prebuilt and fails to build.
          #
          # The actual error seen in github actions:
          #
          #     numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK
          #     libraries found. To build Scipy from sources, BLAS & LAPACK
          #     libraries need to be installed.
          #
          # {os: ubuntu-latest, dist: cp36-musllinux_x86_64},
          # {os: ubuntu-latest, dist: cp37-musllinux_x86_64},
          # {os: ubuntu-latest, dist: cp38-musllinux_x86_64},
          # {os: ubuntu-latest, dist: cp39-musllinux_x86_64},
          # {os: ubuntu-latest, dist: cp310-musllinux_x86_64},
          # {os: ubuntu-latest, dist: cp36-musllinux_i686},
          # {os: ubuntu-latest, dist: cp37-musllinux_i686},
          # {os: ubuntu-latest, dist: cp38-musllinux_i686},
          # {os: ubuntu-latest, dist: cp39-musllinux_i686},
          # {os: ubuntu-latest, dist: cp310-musllinux_i686},

          {os: macos-14, dist: cp38-macosx_x86_64, macosarch: x86_64},
          {os: macos-14, dist: cp39-macosx_x86_64, macosarch: x86_64},
          {os: macos-14, dist: cp310-macosx_x86_64, macosarch: x86_64},
          {os: macos-14, dist: cp311-macosx_x86_64, macosarch: x86_64},
          {os: macos-14, dist: cp312-macosx_x86_64, macosarch: x86_64},
          {os: macos-14, dist: cp313-macosx_x86_64, macosarch: x86_64},
          {os: macos-14, dist: cp314-macosx_x86_64, macosarch: x86_64},

          {os: macos-14, dist: cp38-macosx_arm64, macosarch: arm64},
          {os: macos-14, dist: cp39-macosx_arm64, macosarch: arm64},
          {os: macos-14, dist: cp310-macosx_arm64, macosarch: arm64},
          {os: macos-14, dist: cp311-macosx_arm64, macosarch: arm64},
          {os: macos-14, dist: cp312-macosx_arm64, macosarch: arm64},
          {os: macos-14, dist: cp313-macosx_arm64, macosarch: arm64},
          {os: macos-14, dist: cp314-macosx_arm64, macosarch: arm64},

          # pypy OSX builds disabled because numpy isn't prebuilt and fails to build.
          #
          # The actual error seen in github actions:
          #
          #     RuntimeError: Found /usr/lib/libcblas.dylib, but that file is a
          #     symbolic link to the MacOS Accelerate framework, which is not
          #     supported by NumPy. You must configure the build to use a
          #     different optimized library, or disable the use of optimized
          #     BLAS and LAPACK by setting the environment variables
          #     NPY_BLAS_ORDER="" and NPY_LAPACK_ORDER="" before building NumPy.
          #
          # {os: macOS-10.15, dist: pp37-macosx_x86_64},
          # {os: macOS-10.15, dist: pp38-macosx_x86_64},
          # {os: macOS-10.15, dist: pp39-macosx_x86_64},

          {os: windows-2025, dist: cp38-win_amd64},
          {os: windows-2025, dist: cp39-win_amd64},
          {os: windows-2025, dist: cp310-win_amd64},
          {os: windows-2025, dist: cp311-win_amd64},
          {os: windows-2025, dist: cp312-win_amd64},
          {os: windows-2025, dist: cp313-win_amd64},
          {os: windows-2025, dist: cp314-win_amd64},

          # cp38-win32 and cp39-win32 disabled because scipy fails to build.
          #
          # The actual error seen in github actions:
          #
          #    Need python for 64-bit, but found 32-bit
          #    ..\..\meson.build:82:0: ERROR: Python dependency not found
          #
          #{os: windows-2025, dist: cp38-win32},
          #{os: windows-2025, dist: cp39-win32},

          # cp310-win32 disabled because numpy isn't prebuilt and fails to build.
          #
          # The actual error seen in github actions:
          #
          #     CCompiler_spawn() got an unexpected keyword argument 'env'
          #
          # {os: windows-2025, dist: cp310-win32},
        ]
    env:
      CIBW_BUILD: "${{ matrix.os_dist.dist }}"
      CIBW_ARCHS_MACOS: "${{ matrix.os_dist.macosarch }}"
      CIBW_TEST_REQUIRES: cirq-core pytest
      CIBW_TEST_COMMAND: pytest {project}/src {project}/glue/cirq && stim help
    steps:
      - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
      - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3
      - run: python dev/overwrite_dev_versions_with_date.py
      - run: python -m pip install pybind11~=2.11.1 cibuildwheel~=3.3.1 setuptools wheel
      - run: python -m cibuildwheel --print-build-identifiers
      - run: python -m cibuildwheel --output-dir dist
      - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
        with:
          name: "dist-stim-${{ matrix.os_dist.os }}-${{ matrix.os_dist.dist }}-${{ matrix.os_dist.macosarch }}"
          path: dist/*
  build_sdist:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
      - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3
      - run: python -m pip install setuptools pybind11~=2.11.1
      - run: python dev/overwrite_dev_versions_with_date.py
      - run: mkdir output
      - run: python setup.py sdist
      - run: cd glue/cirq && python setup.py sdist
      - run: cd glue/cirq && python setup.py bdist_wheel
      - run: cd glue/sample && python setup.py sdist
      - run: cd glue/sample && python setup.py bdist_wheel
      - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
        with:
          name: "dist-sinter"
          path: glue/sample/dist/*.tar.gz
      - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
        with:
          name: "bdist-sinter"
          path: glue/sample/dist/*.whl
      - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
        with:
          name: "dist-stimcirq"
          path: glue/cirq/dist/*.tar.gz
      - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
        with:
          name: "bdist-stimcirq"
          path: glue/cirq/dist/*.whl
      - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
        with:
          name: "dist-stim-sdist"
          path: dist/*.tar.gz
  check_sdist_installs_stim:
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
    - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3
    - run: python -m pip install pybind11~=2.11.1 cibuildwheel~=3.3.1 setuptools wheel
    - run: python setup.py sdist
    - run: pip install dist/*.tar.gz
  check_sdist_installs_sinter:
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
    - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3
    - run: python -m pip install setuptools
    - run: cd glue/sample && python setup.py sdist
    - run: pip install glue/sample/dist/*
    - run: python -c "import sinter"
  merge_upload_artifacts:
    needs: ["build_dist", "build_sdist"]
    runs-on: ubuntu-24.04
    steps:
      - name: Merge Artifacts
        uses: actions/upload-artifact/merge@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
        with:
          name: dist-stim
          pattern: dist-stim-*
  upload_dev_release_to_pypi:
    needs: ["merge_upload_artifacts"]
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
        with:
          name: dist-stim
          path: dist-stim
      - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
        with:
          name: dist-stimcirq
          path: dist-stimcirq
      - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
        with:
          name: dist-sinter
          path: dist-sinter
      - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1
        with:
          user: __token__
          packages_dir: dist-stim
          password: ${{ secrets.pypi_token_stim }}
      - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1
        with:
          user: __token__
          packages_dir: dist-stimcirq
          password: ${{ secrets.pypi_token_stimcirq }}
      - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1
        with:
          user: __token__
          packages_dir: dist-sinter
          password: ${{ secrets.pypi_token_sinter }}
  run_main:
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
    - run: cmake .
    - run: make stim -j 2
    - run: echo -e "H 0 \n CNOT 0 1 \n M 0 1" | out/stim --sample
  build_bazel:
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
    - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5
      with:
        bazelisk-cache: true
        disk-cache: ${{ github.workflow }}
        repository-cache: true
        bazelisk-version: 1.x
    - run: bazel build :all
    - run: bazel test :stim_test
  build_clang_stim_test:
    runs-on: 'ubuntu-24.04'
    steps:
    - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
    - run: |
        cd ..
        git clone https://github.com/google/googletest.git -b release-1.12.1
        mkdir googletest/build && cd googletest/build
        cmake .. -DBUILD_GMOCK=OFF
        make
        sudo make install
    - uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1
      with:
        version: latest
        platform: x64
    - run: cmake . -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++
    - run: cmake --build . --target stim_test
  build_clang_stim:
    runs-on: 'ubuntu-24.04'
    steps:
      - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
      - run: |
          cd ..
          git clone https://github.com/google/googletest.git -b release-1.12.1
          mkdir googletest/build && cd googletest/build
          cmake .. -DBUILD_GMOCK=OFF
          make
          sudo make install
      - uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1
        with:
          version: latest
          platform: x64
      - run: cmake . -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++
      - run: cmake --build . --target stim
  build_clang_stim_perf:
    runs-on: 'ubuntu-24.04'
    steps:
      - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
      - run: |
          cd ..
          git clone https://github.com/google/googletest.git -b release-1.12.1
          mkdir googletest/build && cd googletest/build
          cmake .. -DBUILD_GMOCK=OFF
          make
          sudo make install
      - uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1
        with:
          version: latest
          platform: x64
      - run: cmake . -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++
      - run: cmake --build . --target stim_perf
  build_lib:
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
    - run: cmake .
    - run: make libstim -j 2
    - run: echo -e '#include "stim.h"\nint main(int argc,const char **argv) {return !stim::find_bool_argument("test", argc, argv);}' > test.cc
    - run: g++ -std=c++20 test.cc out/libstim.a -I src
    - run: ./a.out test
  build_lib_install:
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
    - run: mkdir install_dir
    - run: cmake . -DCMAKE_INSTALL_PREFIX=install_dir
    - run: make -j 2
    - run: make install
    - run: echo -e '#include "stim.h"\nint main(int argc,const char **argv) {return !stim::find_bool_argument("test", argc, argv);}' > test.cc
    - run: g++ -std=c++20 test.cc install_dir/lib/libstim.a -I install_dir/include
    - run: ./a.out test
    - run: echo -e "H 0 \n CNOT 0 1 \n M 0 1" | install_dir/bin/stim --sample
  benchmark_windows:
    runs-on: windows-2025
    steps:
      - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
      - uses: microsoft/setup-msbuild@c26a08ba26249b81327e26f6ef381897b6a8754d # v1.0.2
      - run: cmake .
      - run: MSBuild.exe stim_perf.vcxproj /p:Configuration=Release /p:OutDir=msbuild_out /p:O=2
      - run: msbuild_out/stim_perf.exe
  benchmark:
    runs-on: ubuntu-24.04
    strategy:
      matrix:
        simd_width: [64, 128, 256]
    steps:
    - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
    - run: cmake . -DSIMD_WIDTH=${{ matrix.simd_width }}
    - run: make stim_perf -j 2
    - run: out/stim_perf
  test:
    runs-on: ubuntu-24.04
    strategy:
      matrix:
        simd_width: [64, 128, 256]
    steps:
    - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
    - run: |
        cd ..
        git clone https://github.com/google/googletest.git -b release-1.12.1
        mkdir googletest/build && cd googletest/build
        cmake .. -DBUILD_GMOCK=OFF
        make
        sudo make install
    - run: cmake . -DSIMD_WIDTH=${{ matrix.simd_width }}
    - run: make stim_test -j 2
    - run: out/stim_test
  test_o3:
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
    - run: |
        cd ..
        git clone https://github.com/google/googletest.git -b release-1.12.1
        mkdir googletest/build && cd googletest/build
        cmake .. -DBUILD_GMOCK=OFF
        make
        sudo make install
    - run: cmake . -DSIMD_WIDTH=256
    - run: make stim_test_o3 -j 2
    - run: out/stim_test_o3
  test_generated_docs_are_fresh:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
      - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3
      - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5
        with:
          bazelisk-cache: true
          disk-cache: ${{ github.workflow }}
          repository-cache: true
          bazelisk-version: 1.x
      - uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e # v1
        with:
          node-version: 16.x
      - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
        with:
          python-version: '3.13'
      - run: bazel build :stim_dev_wheel
      - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
      - run: diff <(python dev/gen_stim_api_reference.py -dev) doc/python_api_reference_vDev.md
      - run: diff <(python dev/gen_stim_stub_file.py -dev) glue/python/src/stim/__init__.pyi
      - run: diff <(python dev/gen_stim_stub_file.py -dev) doc/stim.pyi
      - run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'gates_markdown'])") doc/gates.md
      - run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'formats_markdown'])") doc/result_formats.md
      - run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'commands_markdown'])") doc/usage_command_line.md
      - run: diff <(dev/gen_known_gates_for_js.sh) glue/crumble/test/generated_gate_name_list.test.js
      - run: python doc/stim.pyi
      - run: npm install -g rollup@3.21.2 uglify-js@3.17.4
      - run: diff <(dev/compile_crumble_into_cpp_string_file.sh) src/stim/diagram/crumble_data.cc
      - run: pip install -e glue/sample
      - run: diff <(python dev/gen_sinter_api_reference.py -dev) doc/sinter_api.md
  test_generated_file_lists_are_fresh:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
      - run: dev/regen_file_lists.sh /tmp
      - run: diff /tmp/perf_files file_lists/perf_files
      - run: diff /tmp/pybind_files file_lists/pybind_files
      - run: diff /tmp/source_files_no_main file_lists/source_files_no_main
      - run: diff /tmp/test_files file_lists/test_files
  test_pybind:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
      - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3
      - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5
        with:
          bazelisk-cache: true
          disk-cache: ${{ github.workflow }}
          repository-cache: true
          bazelisk-version: 1.x
      - run: bazel build :stim_dev_wheel
      - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
      - run: pip install pytest
      - run: pytest src
      - run: dev/doctest_proper.py --module stim
  test_stimcirq:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
      - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3
      - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5
        with:
          bazelisk-cache: true
          disk-cache: ${{ github.workflow }}
          repository-cache: true
          bazelisk-version: 1.x
      - run: bazel build :stim_dev_wheel
      - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
      - run: pip install -e glue/cirq
      - run: pip install pytest
      - run: pytest glue/cirq
      - run: dev/doctest_proper.py --module stimcirq --import cirq sympy
  test_sinter:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
      - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3
      - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5
        with:
          bazelisk-cache: true
          disk-cache: ${{ github.workflow }}
          repository-cache: true
          bazelisk-version: 1.x
      - run: bazel build :stim_dev_wheel
      - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
      - run: pip install -e glue/sample
      - run: pip install pytest pymatching fusion-blossom~=0.1.4 mwpf~=0.1.5
      - run: pytest glue/sample
      - run: dev/doctest_proper.py --module sinter
      - run: sinter help
  test_stimzx:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
      - uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3
      - uses: bazel-contrib/setup-bazel@e403ad507104847c3539436f64a9e9eecc73eeec # 0.8.5
        with:
          bazelisk-cache: true
          disk-cache: ${{ github.workflow }}
          repository-cache: true
          bazelisk-version: 1.x
      - run: bazel build :stim_dev_wheel
      - run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
      - run: pip install -e glue/zx
      - run: pip install pytest
      - run: pytest glue/zx
      - run: dev/doctest_proper.py --module stimzx
  test_stimjs:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
      - uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14
        with:
          version: 4.0.1
          actions-cache-folder: 'emsdk-cache'
      - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
        with:
          node-version: 18.x
      - run: npm install
      - run: bash glue/javascript/build_wasm.sh
      - run: node puppeteer_run_tests.js
  test_crumble:
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
    - uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
      with:
        node-version: 16
    - run: node glue/crumble/run_tests_headless.js


================================================
FILE: .gitignore
================================================
.idea/*
cmake-build-debug/*
a.out
perf.data
perf.data.old
CMakeFiles/*
CMakeCache.txt
googletest-build/*
googletest-download/*
googletest-src
cmake_install.cmake
Makefile
lib
out
stim.cbp
data/*
_deps/*
bazel-*
python_build_stim/*
*.egg-*
stim.cpython*
dist
MANIFEST
*.whl
*.swp
__pycache__
pip-wheel-metadata/*
wheelhouse/*
*.pyd
venv
.venv
**/LastTest.log
*.so
.clwb/*
.cmake/*
coverage/*
cmake-build-debug-coverage/*
compile_commands.json
.cache
build.ninja
.ninja_deps
.ninja_log
.pytest_cache
node_modules
MODULE.bazel.lock
.ninja_lock


================================================
FILE: .markdownlintrc
================================================
{ // -*- jsonc -*-
  // Copyright 2025 Google LLC
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  //     https://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.

  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  // Markdownlint linter configuration for this project.
  //
  // Note: there are multiple programs programs named "markdownlint". We use
  // https://github.com/igorshubovych/markdownlint-cli/, which is the one you
  // get with "brew install markdownlint" on MacOS.
  //
  // These settings try to stay close to the Google Markdown Style as
  // described at https://google.github.io/styleguide/docguide/style.html
  // with very few differences.
  //
  // For a list of configuration options, see the following page:
  // https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
  // (Beware that the above looks similar but is NOT the same as the page
  // https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md.)
  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  "$schema": "https://raw.githubusercontent.com/DavidAnson/markdownlint/main/schema/markdownlint-config-schema.json",

  // Require ATX-style headings.
  // https://google.github.io/styleguide/docguide/style.html#atx-style-headings
  "headings": {
    "style": "atx"
  },

  // Google style does not require that the first line of a file is a heading
  // for the title; it only states that the first heading should be a level 1.
  // https://google.github.io/styleguide/docguide/style.html#document-layout
  "first-line-heading": false,

  // The Google style does not define what to do about trailing punctuation in
  // headings. The markdownlint default disallows exclamation points, which
  // seems likely to be more annoying than useful – I have definitely seen
  // people use exclamation points in headings in README files on GitHub.
  // This setting removes exclamation point from the banned characters.
  "no-trailing-punctuation": {
    "punctuation": ".,;:。,;:"
  },

  // No trailing spaces.
  // https://google.github.io/styleguide/docguide/style.html#trailing-whitespace
  "whitespace": {
    "br_spaces": 0
  },

  // Google style is 80 characters.
  // Google style exempts some constructs from the line-length limit:
  // https://google.github.io/styleguide/docguide/style.html#exceptions
  "line-length": {
    "line_length": 120,
    "code_block_line_length": 120,
    "heading_line_length": 120,
    "code_blocks": false,
    "headings": false,
    "tables": false
  },

  // Google Markdown style specifies 2 spaces after item numbers, 3 spaces
  // after bullets, so that the text itself is consistently indented 4 spaces.
  // https://google.github.io/styleguide/docguide/style.html#nested-list-spacing
  "list-marker-space": {
    "ol_multi": 2,
    "ol_single": 2,
    "ul_multi": 3,
    "ul_single": 3
  },

  "ul-indent": {
    "indent": 4
  },

  // Bare URLs are allowed in GitHub-flavored Markdown and in Google’s style.
  "no-bare-urls": false,

  // Basic Markdown allows raw HTML. Both GitHub & PyPI support subsets of
  // HTML, though it's unclear what subset PyPI supports. Google's style guide
  // recommends against using raw HTML, but does allow it. (C.f. the bottom of
  // https://google.github.io/styleguide/docguide/style.html) Google's in-house
  // documentation system allows many inline and block-level tags, but strips
  // others that can pose security risks (e.g., <object> and standalone <svg>).
  // The list below tries to capture the intersection of what GitHub allows
  // (c.f. https://github.com/github/markup/issues/245#issuecomment-682231577),
  // what PyPI seems to allow, what Google allows, and what seems likely to be
  // most useful in situations where someone needs to reach for HTML.
  "html": {
    "allowed_elements": [
      "a",
      "abbr",
      "b",
      "blockquote",
      "br",
      "caption",
      "cite",
      "code",
      "dd",
      "del",
      "details",
      "dfn",
      "div",
      "dl",
      "dt",
      "em",
      "figcaption",
      "figure",
      "h1",
      "h2",
      "h3",
      "h4",
      "h5",
      "h6",
      "hr",
      "i",
      "img",
      "ins",
      "kbd",
      "li",
      "mark",
      "ol",
      "p",
      "picture",
      "pre",
      "q",
      "s",
      "samp",
      "small",
      "span",
      "strong",
      "sub",
      "summary",
      "sup",
      "table",
      "tbody",
      "td",
      "tfoot",
      "th",
      "thead",
      "time",
      "tr",
      "tt",
      "ul",
      "var",
      "wbr"
    ]
  }
}


================================================
FILE: BUILD
================================================
package(default_visibility = ["//visibility:public"])

load("@rules_python//python:packaging.bzl", "py_wheel")

SOURCE_FILES_NO_MAIN = glob(
    [
        "src/**/*.cc",
        "src/**/*.h",
        "src/**/*.inl",
    ],
    exclude = glob([
        "src/**/*.test.cc",
        "src/**/*.test.h",
        "src/**/*.perf.cc",
        "src/**/*.perf.h",
        "src/**/*.pybind.cc",
        "src/**/*.pybind.h",
        "src/**/main.cc",
    ]),
)

TEST_FILES = glob(
    [
        "src/**/*.test.cc",
        "src/**/*.test.h",
    ],
)

PERF_FILES = glob(
    [
        "src/**/*.perf.cc",
        "src/**/*.perf.h",
    ],
)

PYBIND_FILES = glob(
    [
        "src/**/*.pybind.cc",
        "src/**/*.pybind.h",
    ],
)

cc_library(
    name = "stim_lib",
    srcs = SOURCE_FILES_NO_MAIN,
    copts = [
        "-std=c++20",
    ],
    includes = ["src/"],
)

cc_binary(
    name = "stim",
    srcs = SOURCE_FILES_NO_MAIN + glob(["src/**/main.cc"]),
    copts = [
        "-std=c++20",
        "-march=native",
        "-O3",
    ],
    includes = ["src/"],
)

cc_binary(
    name = "stim_benchmark",
    srcs = SOURCE_FILES_NO_MAIN + PERF_FILES,
    copts = [
        "-std=c++20",
        "-march=native",
        "-O3",
    ],
    includes = ["src/"],
)

cc_test(
    name = "stim_test",
    srcs = SOURCE_FILES_NO_MAIN + TEST_FILES,
    copts = [
        "-std=c++20",
        "-march=native",
    ],
    data = glob(["testdata/**"]),
    includes = ["src/"],
    deps = [
        "@googletest//:gtest",
        "@googletest//:gtest_main",
    ],
)

cc_binary(
    name = "stim.so",
    srcs = SOURCE_FILES_NO_MAIN + PYBIND_FILES,
    copts = [
        "-O3",
        "-std=c++20",
        "-fvisibility=hidden",
        "-march=native",
        "-DSTIM_PYBIND11_MODULE_NAME=stim",
        "-DVERSION_INFO=0.0.dev0",
    ],
    includes = ["src/"],
    linkshared = 1,
    deps = ["@pybind11//:pybind11"],
)

genrule(
    name = "stim_wheel_files",
    srcs = ["doc/stim.pyi"],
    outs = ["stim.pyi"],
    cmd = "cp $(location doc/stim.pyi) $@",
)

py_wheel(
    name = "stim_dev_wheel",
    distribution = "stim",
    requires = ["numpy"],
    version = "0.0.dev0",
    deps = [
        ":stim.so",
        ":stim_wheel_files",
    ],
)


================================================
FILE: CITATION.cff
================================================
# Citation information for this repository.                         -*- yaml -*-
#
# CITATION.cff files provide human- & machine-readable citation information for
# software and datasets. GitHub, Zenodo, and the Zotero browser plugin all use
# CFF files automatically if provided. https://citation-file-format.github.io/.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cff-version: 1.2.0
message: If you use Stim, please cite it using this metadata.

# CITATION.cff files describe how to cite software or datasets, with the goal of
# making software and data be citable in their own right. However, sometimes
# projects want citations to go to a paper instead. 'Preferred-citation' serves
# to communicate that. The distinction matters in different situations. If this
# field is present, GitHub uses the value for the "cite this repository" button
# and ignores the rest of this file; conversely, the Zenodo-GitHub integration
# ignores this field when creating an entry for a new software release because
# the Zenodo entry is specifically about the software in this repository.
preferred-citation:
  type: article
  authors:
    - family-names: Gidney
      given-names: Craig
  title: 'Stim: a fast stabilizer circuit simulator'
  journal: Quantum
  year: 2021
  month: 7
  volume: 5
  start: 497
  issn: 2521-327X
  url: https://doi.org/10.22331/q-2021-07-06-497
  publisher:
    name: >-
      Verein zur Förderung des Open Access Publizierens in den
      Quantenwissenschaften

# The remaining metadata in this file describes the current software release.

title: Stim
abstract: >-
  Stim is a tool for high performance simulation and analysis of quantum
  stabilizer circuits, especially quantum error correction (QEC) circuits.
authors:
  - family-names: Gidney
    given-names: Craig
version: 1.14.0
date-released: 2024-09-24
url: https://github.com/quantumlib/stim
repository-code: https://github.com/quantumlib/stim
license: Apache-2.0
type: software
identifiers:
  - description: The GitHub repository for Stim
    value: https://github.com/quantumlib/Stim
    type: url
  - description: PyPI project for Stim
    value: https://pypi.org/project/Stim
    type: url
  - description: Publication about Stim
    value: 10.22331/q-2021-07-06-497
    type: doi
keywords:
  - algorithms
  - API
  - application programming interface
  - C++
  - Clifford gates
  - Clifford operations
  - high performance
  - open-source software
  - physics
  - Python
  - QEC
  - quantum
  - quantum algorithms
  - quantum circuits
  - quantum computing
  - quantum error correction
  - quantum error decoder
  - quantum gates
  - quantum programming
  - quantum simulation
  - quantum state
  - qubit
  - science
  - SDK
  - simulation
  - simulator
  - software
  - software development toolkit
  - stabilizer circuits


================================================
FILE: CMakeLists.txt
================================================
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.13)
project(stim)
include_directories(src)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY out)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY out)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY out)

# Convert desired SIMD_WIDTH into machine architecture flags.

if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|I386|ARM64)$")
    if(NOT(SIMD_WIDTH))
        set(MACHINE_FLAG "-march=native")
    elseif(SIMD_WIDTH EQUAL 256)
        set(MACHINE_FLAG "-mavx2" "-msse2")
    elseif(SIMD_WIDTH EQUAL 128)
        set(MACHINE_FLAG "-mno-avx2" "-msse2")
    elseif(SIMD_WIDTH EQUAL 64)
        set(MACHINE_FLAG "-mno-avx2" "-mno-sse2")
    endif()
else ()
    set(MACHINE_FLAG "")
endif()

# make changes to file_lists trigger a reconfigure
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS file_lists/source_files_no_main)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS file_lists/test_files)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS file_lists/perf_files)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS file_lists/pybind_files)

file(STRINGS file_lists/source_files_no_main SOURCE_FILES_NO_MAIN)
file(STRINGS file_lists/test_files TEST_FILES)
file(STRINGS file_lists/perf_files PERF_FILES)
file(STRINGS file_lists/pybind_files PYBIND_FILES)

add_executable(stim src/main.cc ${SOURCE_FILES_NO_MAIN})
if(NOT(MSVC))
    target_compile_options(stim PRIVATE -O3 -Wall -Wpedantic -fno-strict-aliasing ${MACHINE_FLAG})
    target_link_options(stim PRIVATE -O3)
else()
    target_compile_options(stim PRIVATE ${MACHINE_FLAG} /O1)
endif()
install(TARGETS stim RUNTIME DESTINATION bin)

add_library(libstim ${SOURCE_FILES_NO_MAIN})
set_target_properties(libstim PROPERTIES PREFIX "")
target_include_directories(libstim PUBLIC src)
if(NOT(MSVC))
    target_compile_options(libstim PRIVATE -O3 -Wall -Wpedantic -fPIC -fno-strict-aliasing ${MACHINE_FLAG})
    target_link_options(libstim PRIVATE -O3)
else()
    target_compile_options(libstim PRIVATE ${MACHINE_FLAG} /O1)
endif()
install(TARGETS libstim LIBRARY DESTINATION)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/" DESTINATION "include" FILES_MATCHING PATTERN "*.h" PATTERN "*.inl")

add_executable(stim_perf ${SOURCE_FILES_NO_MAIN} ${PERF_FILES})
if(NOT(MSVC))
    target_compile_options(stim_perf PRIVATE -Wall -Wpedantic -O3 -fno-strict-aliasing ${MACHINE_FLAG})
    target_link_options(stim_perf PRIVATE)
else()
    target_compile_options(stim_perf PRIVATE ${MACHINE_FLAG} /O1)
endif()

find_package(GTest QUIET)
if(${GTest_FOUND})
    add_executable(stim_test ${SOURCE_FILES_NO_MAIN} ${TEST_FILES})
    target_link_libraries(stim_test GTest::gtest GTest::gtest_main)
    target_compile_options(stim_test PRIVATE -Wall -Wpedantic -g -fno-omit-frame-pointer -fno-strict-aliasing -fsanitize=undefined -fsanitize=address ${MACHINE_FLAG})
    target_link_options(stim_test PRIVATE -g -fno-omit-frame-pointer -fsanitize=undefined -fsanitize=address)

    add_executable(stim_test_o3 ${SOURCE_FILES_NO_MAIN} ${TEST_FILES})
    target_link_libraries(stim_test_o3 GTest::gtest GTest::gtest_main)
    target_compile_options(stim_test_o3 PRIVATE -O3 -Wall -Wpedantic -fno-strict-aliasing ${MACHINE_FLAG})
    target_link_options(stim_test_o3 PRIVATE)
else()
    message("WARNING: Skipped stim_test target. `GTest` not found. To fix, follow Standalone CMake Project install instructions at https://github.com/google/googletest/blob/master/googletest/README.md")
endif()

find_package(Python COMPONENTS Interpreter Development)
find_package(pybind11 CONFIG)
if (${pybind11_FOUND} AND ${Python_FOUND})
  pybind11_add_module(stim_python_bindings ${PYBIND_FILES} ${SOURCE_FILES_NO_MAIN})
  set_target_properties(stim_python_bindings PROPERTIES OUTPUT_NAME stim)
  add_compile_definitions(STIM_PYBIND11_MODULE_NAME=stim)
  if(NOT(MSVC))
      target_compile_options(stim_python_bindings PRIVATE -O3 -Wall -Wpedantic -fno-strict-aliasing ${MACHINE_FLAG})
      target_link_options(stim_python_bindings PRIVATE -O3)
  else()
      target_compile_options(stim_python_bindings PRIVATE ${MACHINE_FLAG} /O1)
  endif()

else()
  message("WARNING: Skipped stim_python_bindings target. `pybind11` not found. To fix, install pybind11. On debian based distributions, the package name is `pybind11-dev`")
endif()


================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of
experience, education, socio-economic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

*   Using welcoming and inclusive language
*   Being respectful of differing viewpoints and experiences
*   Gracefully accepting constructive criticism
*   Focusing on what is best for the community
*   Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

*   The use of sexualized language or imagery and unwelcome sexual attention or
    advances
*   Trolling, insulting/derogatory comments, and personal or political attacks
*   Public or private harassment
*   Publishing others' private information, such as a physical or electronic
    address, without explicit permission
*   Other conduct which could reasonably be considered inappropriate in a
    professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

This Code of Conduct also applies outside the project spaces when the Project
Stewards have a reasonable belief that an individual's behavior may have a
negative impact on the project or its community.

## Conflict Resolution

We do not believe that all conflict is bad; healthy debate and disagreement
often yield positive results. However, it is never okay to be disrespectful or
to engage in behavior that violates the project’s Code of Conduct.

If you see someone violating the Code of Conduct, you are encouraged to address
the behavior directly with those involved. Many issues can be resolved quickly
and easily, and this gives people more control over the outcome of their
dispute. If you are unable to resolve the matter for any reason, or if the
behavior is threatening or harassing, report it. We are dedicated to providing
an environment where participants feel welcome and safe.

Reports should be directed to quantumai-oss-maintainers@googlegroups.com,
the project stewards at Google Quantum AI. They will then work with a committee
consisting of representatives from the Open Source Programs Office and the
Google Open Source Strategy team. If for any reason you are uncomfortable
reaching out to the Project Stewards, please email opensource@google.com.

We will investigate every complaint, but you may not receive a direct response.
We will use our discretion in determining when and how to follow up on reported
incidents, which may range from not taking action to permanent expulsion from
the project and project-sponsored spaces. We will notify the accused of the
report and provide them an opportunity to discuss it before any action is taken.
The identity of the reporter will be omitted from the details of the report
supplied to the accused. In potentially harmful situations, such as ongoing
harassment or threats to anyone's safety, we may take action without notice.

## Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
available at
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html


================================================
FILE: CONTRIBUTING.md
================================================
# How to contribute

We'd love to accept your patches and contributions to this project. We do have
some guidelines to follow, covered in this document, but don't be concerned
about getting everything right the first time! Create a pull request (discussed
below) and we'll nudge you in the right direction.

## Before you begin

### Sign our Contributor License Agreement

Contributions to this project must be accompanied by a [Contributor License
Agreement](https://cla.developers.google.com/about) (CLA). You (or your
employer) retain the copyright to your contribution; the CLA simply gives us
permission to use and redistribute your contributions as part of the project.
Please visit https://cla.developers.google.com/ to see your current agreements
on file or to sign a new one. You generally only need to submit a Google CLA
once, so if you've already submitted one (even if it was for a different
project), you probably don't need to do it again.

> [!WARNING]
> Please note carefully clauses [#5](https://cla.developers.google.com/about/google-corporate#:~:text=You%20represent%20that%20each%20of%20Your%20Contributions%20is%20Your%20original%20creation)
> and [#7](https://cla.developers.google.com/about/google-corporate#:~:text=Should%20You%20wish%20to%20submit%20work%20that%20is%20not%20Your%20original%20creation%2C%20You%20may%20submit%20it%20to%20Google%20separately)
> in the CLA. Any code that you contribute to this project must be **your**
> original creation. Code generated by artificial intelligence tools **does
> not** qualify as your original creation.

### Review our community guidelines

We have a [code of conduct](CODE_OF_CONDUCT.md) to make the Stim project an open
and welcoming community environment. Please make sure to read and abide by the
code of conduct.

## Contribution process

All submissions, including submissions by project members, require review. We
use the tools provided by GitHub for [pull
requests](https://help.github.com/articles/about-pull-requests/) for this
purpose. The preferred manner for submitting pull requests is to fork the Stim
[repository](https://github.com/quantumlib/Stim), create a [git
branch](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell) in
this fork to do your work, and when ready, create a pull request from this
branch to the main Stim repository.

### Repository forks

1.  Fork the Stim repository (you can use the _Fork_ button in upper right
    corner of the [repository page](https://github.com/quantumlib/Stim)).
    Forking creates a new GitHub repo at the location
    `https://github.com/USERNAME/Stim`, where `USERNAME` is your GitHub user
    name.

1.  Clone (using `git clone`) or otherwise download your forked repository to
    your local computer, so that you have a local copy where you can do your
    development work using your preferred editor and development tools.

1.  Check out the `main` branch and create a new git branch from `main`:

    ```shell
    git checkout main -b YOUR_BRANCH_NAME
    ```

    where `YOUR_BRANCH_NAME` is the name of your new branch.

### Development and testing

Please follow the detailed instructions in
[`doc/developer_documentation.md`](doc/developer_documentation.md) for
developing and testing Stim.

### Pull requests and code reviews

1.  If your local copy has drifted out of sync with the `main` branch of the
    main Stim repository, you may need to merge the latest changes into
    your branch. To do this, first update your local `main` and then merge your
    local `main` into your branch:

    ```shell
    # Track the upstream repo (if your local repo hasn't):
    git remote add upstream https://github.com/quantumlib/Stim.git

    # Update your local main.
    git fetch upstream
    git checkout main
    git merge upstream/main
    # Merge local main into your branch.
    git checkout YOUR_BRANCH_NAME
    git merge main
    ```

    If git reports conflicts during one or both of these merge processes, you
    may need to [resolve the merge conflicts](
    https://docs.github.com/articles/about-merge-conflicts) before continuing.

1.  Finally, push your changes to your fork of the Stim repo on GitHub:

    ```shell
    git push origin YOUR_BRANCH_NAME
    ```

1.  Now when you navigate to the Stim repository on GitHub
    (https://github.com/quantumlib/Stim), you should see the option to create a
    new pull request from your forked repository. Alternatively, you can create
    the pull request by navigating to the "Pull requests" tab near the top of
    the page, and selecting the appropriate branches.

1.  A reviewer from the Stim team will comment on your code and may ask for
    changes. You can perform the necessary changes locally, commit them to your
    branch as usual, and then push changes to your fork on GitHub following the
    same process as above. When you do that, GitHub will update the code in the
    pull request automatically.


================================================
FILE: LICENSE
================================================

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

================================================
FILE: MANIFEST.in
================================================
include glue/python/src/stim/__init__.pyi
include glue/python/README.md
recursive-include src *.cc *.h *.inl


================================================
FILE: MODULE.bazel
================================================
bazel_dep(name = "googletest", version = "1.14.0")
bazel_dep(name = "pybind11_bazel", version = "2.11.1")


================================================
FILE: README.md
================================================
# Stim

<img align="right" width="125em" alt="Stim logo" src="https://raw.githubusercontent.com/quantumlib/Stim/refs/heads/main/doc/logo_128x128.svg">

High-performance simulation of quantum stabilizer circuits for quantum error correction.

◼︎︎&nbsp;&nbsp;[What is Stim?](#what-is-stim)<br>
◼︎︎&nbsp;&nbsp;[How do I use Stim?](#how-use-stim)<br>
◼︎&nbsp;&nbsp;[How does Stim work?](#how-stim-work)<br>
◼︎&nbsp;&nbsp;[How do I cite Stim?](#how-cite-stim)<br>
◼︎&nbsp;&nbsp;[*Subproject*: Sinter decoding sampler](glue/sample)<br>
◼︎&nbsp;&nbsp;[*Subproject*: Crumble interactive editor](glue/crumble)<br>

## <a name="what-is-stim"></a>What is Stim?

Stim is a tool for high performance simulation and analysis of quantum stabilizer circuits,
especially quantum error correction (QEC) circuits.
Typically Stim is used as a Python package (`pip install stim`), though Stim can also be used as
a command-line tool or a C++ library.

*   [Watch the 15 minute lightning talk presenting Stim at QPL2021](https://youtu.be/7m_JrJIskPM?t=895)
*   [Watch Stim being used to estimate the threshold of the honeycomb code over a
    weekend](https://www.youtube.com/watch?v=E9yj0o1LGII)

Stim's key features:

1.  **<em>Really</em> fast simulation of stabilizer circuits**.
    Have a circuit with thousands of qubits and millions of operations?
    [`stim.Circuit.compile_sampler()`](doc/python_api_reference_vDev.md#stim.Circuit.compile_sampler) will perform a few
    seconds of analysis and then produce an object that can sample shots at kilohertz rates.

2.  **Semi-automatic decoder configuration**.
    [`stim.Circuit.detector_error_model()`](doc/python_api_reference_vDev.md#stim.Circuit.detector_error_model) converts
    a noisy circuit into a detector error model (a [Tanner graph](https://en.wikipedia.org/wiki/Tanner_graph)) which can
    be used to configure decoders.
    Adding the option `decompose_operations=True` will additionally suggest how hyper errors can be decomposed into
    graphlike errors, making it easier to configure matching-based decoders.

3.  **Useful building blocks for working with stabilizers**, such as
    [`stim.PauliString`](doc/python_api_reference_vDev.md#stim.PauliString),
    [`stim.Tableau`](doc/python_api_reference_vDev.md#stim.Tableau),
    and [`stim.TableauSimulator`](doc/python_api_reference_vDev.md#stim.TableauSimulator).

Stim's main limitations are:

1.  There is no support for non-Clifford operations, such as T gates and Toffoli gates. Only stabilizer operations are
    supported.

2.  `stim.Circuit` only supports Pauli noise channels (eg. no amplitude decay). For more complex noise you must manually
    drive a `stim.TableauSimulator`.

3.  `stim.Circuit` only supports single-control Pauli feedback. For multi-control feedback, or non-Pauli feedback, you
    must manually drive a `stim.TableauSimulator`.

Stim's design philosophy:

*   **Performance is king.**
    The goal is not to be fast *enough*, it is to be fast in an absolute sense.
    Think of it this way.
    The difference between doing one thing per second (human speeds) and doing ten billion things
    per second (computer speeds) is 100 decibels (100 factors of 1.26).
    Because software slowdowns tend to compound exponentially, the choices we make can be thought of multiplicatively;
    they can be thought of as spending or saving decibels.
    For example, under default usage, Python is 100 times slower than C++.
    That's 20dB of the 100dB budget!
    A *fifth* of the multiplicative performance budget allocated to *language choice*!
    Too expensive!
    Although Stim will never achieve the glory of [30 GiB per second of
    FizzBuzz](https://codegolf.stackexchange.com/a/236630/74349), it at least *wishes* it could.

*   **Bottom up.**
    Stim is intended to be like an assembly language: a mostly straightforward layer upon which more complex layers
    can be built.
    The user may define QEC constructions at some high level, perhaps as a set of stabilizers or as a parity check
    matrix, but these concepts are explained to Stim at a low level (e.g., as circuits).
    Stim is not necessarily the abstraction that the user wants, but Stim wants to implement low-level
    pieces simple enough and fast enough that the high-level pieces that the user wants can be built on top.

*   **Backwards compatibility.**
    Stim's Python package uses semantic versioning.
    Within a major version (1.X), Stim guarantees backwards compatibility of its Python API and of its command-line API.
    Note Stim DOESN'T guarantee backwards compatibility of the underlying C++ API.

## <a name="how-use-stim"></a>How do I use Stim?

See the [Getting Started Notebook](doc/getting_started.ipynb).

Stuck?
[Get help on the quantum computing stack exchange](https://quantumcomputing.stackexchange.com)
and use the [`stim`](https://quantumcomputing.stackexchange.com/questions/tagged/stim) tag.

See the reference documentation:

*   [Stim Python API Reference](doc/python_api_reference_vDev.md)
*   [Stim Supported Gates Reference](doc/gates.md)
*   [Stim Command Line Reference](doc/usage_command_line.md)
*   [Stim Circuit File Format (.stim)](doc/file_format_stim_circuit.md)
*   [Stim Detector Error model Format (.dem)](doc/file_format_dem_detector_error_model.md)
*   [Stim Results Format Reference](doc/result_formats.md)
*   [Stim Internal Developer Reference](doc/developer_documentation.md)

## <a name="how-stim-work"></a>How does Stim work?

See [the paper describing Stim](https://quantum-journal.org/papers/q-2021-07-06-497/).
Stim makes three core improvements over previous stabilizer simulators:

1.  **Vectorized code.**
    Stim's hot loops are heavily vectorized, using 256 bit wide AVX instructions.
    This makes them very fast.
    For example, Stim can multiply Pauli strings with 100 billion terms in one second.

2.  **Reference Frame Sampling.**
    When bulk sampling, Stim only uses a general stabilizer simulator for an initial reference sample.
    After that, it cheaply derives as many samples as needed by propagating simulated errors diffed against the
    reference.
    This simple trick is *ridiculously* cheaper than the alternative: constant cost per gate, instead of linear cost
    or even quadratic cost.

3.  **Inverted Stabilizer Tableau.**
    When doing general stabilizer simulation, Stim tracks the inverse of the stabilizer tableau that was historically
    used.
    This has the unexpected benefit of making measurements that commute with the current stabilizers take
    linear time instead of quadratic time. This is beneficial in error correcting codes, because the measurements
    they perform are usually redundant and so commute with the current stabilizers.

## <a name="how-cite-stim"></a>How do I cite Stim?

When using Stim for research, [please cite](https://quantum-journal.org/papers/q-2021-07-06-497/):

```latex
@article{gidney2021stim,
  doi = {10.22331/q-2021-07-06-497},
  url = {https://doi.org/10.22331/q-2021-07-06-497},
  title = {Stim: a fast stabilizer circuit simulator},
  author = {Gidney, Craig},
  journal = {{Quantum}},
  issn = {2521-327X},
  publisher = {{Verein zur F{\"{o}}rderung des Open Access Publizierens
                in den Quantenwissenschaften}},
  volume = 5,
  pages = 497,
  month = jul,
  year = 2021
}
```

## Contact

For any questions or concerns not addressed here, please email quantum-oss-maintainers@google.com.

## Disclaimer

This is not an officially supported Google product. This project is not eligible for the [Google Open Source Software
Vulnerability Rewards Program](https://bughunters.google.com/open-source-security).

Copyright 2025 Google LLC.

<div align="center">
  <a href="https://quantumai.google">
    <img width="15%" alt="Google Quantum AI"
         src="./doc/quantum-ai-vertical.svg">
  </a>
</div>


================================================
FILE: SUPPORT.md
================================================
# Support

Thank you for your interest in this project! If you are experiencing problems
or have questions, the following are some suggestions for how to get help.

> [!NOTE]
> Before participating in our community, please read our [code of
> conduct](CODE_OF_CONDUCT.md). By interacting with this repository,
> organization, or community, you agree to abide by its terms.

## Report an issue or request a feature

To report an issue or request a feature in Stim, please first search the
[issue tracker on GitHub](https://github.com/quantumlib/Stim/issues) to
check if there is already an open issue identical or similar to your bug
report/feature request. If there is none, go ahead and file a new issue in the
issue tracker.

## Contact the maintainers

For any questions or concerns not addressed here, please email
[quantum-oss-maintainers@google.com](mailto:quantum-oss-maintainers@google.com).


================================================
FILE: WORKSPACE
================================================
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@pybind11_bazel//:python_configure.bzl", "python_configure")

http_archive(
    name = "pybind11",
    build_file = "@pybind11_bazel//:pybind11.BUILD",
    sha256 = "bf8f242abd1abcd375d516a7067490fb71abd79519a282d22b6e4d19282185a7",
    strip_prefix = "pybind11-2.12.0",
    urls = ["https://github.com/pybind/pybind11/archive/refs/tags/v2.12.0.tar.gz"],
)

python_configure(name = "local_config_python")


================================================
FILE: dev/canvas_with_texture_for_3d_diagrams.html
================================================
<meta charset="utf-8">
<body style="margin: 0">
<canvas width="512" height="512" id="cv" style="border: 1px solid black; margin: 0; padding: 0">
</canvas>
<script>

/**
 *
 * @param {!int} i
 * @returns {{x: !number, y: !number}}
 */
function pickRect(i) {
    if (i >= 6 * 16 && i < 9 * 16) {
        i -= 6 * 16;
        i = Math.floor(i / 3) + (i % 3) * 16;
        i += 6 * 16;
    }
    let x = i % 16;
    let y = Math.floor(i / 16);
    return {x, y}
}

/**
 *
 * @param {!CanvasRenderingContext2D} ctx
 * @param {!string} text
 * @param {!string} fill
 * @param {!string} stroke
 * @param {!int} i
 */
function drawRect(ctx, text, fill, stroke, i) {
    let {x, y} = pickRect(i);
    ctx.fillStyle = fill;
    ctx.fillRect(x * 32, y * 32, 32, 32);

    ctx.fillStyle = 'black';
    let main = "";
    let sub = "";
    let sup = "";
    if (text.indexOf("_") !== -1 && text !== '_') {
        [main, sub] = text.split("_");
    } else {
        main = text;
    }
    if (main.indexOf("^") !== -1 && main !== '^') {
        [main, sup] = main.split("^");
    }
    if (sub.indexOf("^") !== -1 && sub !== '^') {
        [sub, sup] = sub.split("^");
    }
    let vert = Math.max(sub.length, sup.length, main.length) >= 3 && sub.length > 0;
    let bigFontSize = 18;
    let smallFontSize = 18 * 0.75;
    while (bigFontSize > 6) {
        let bigFont = bigFontSize + 'pt serif';
        let smallFont = (smallFontSize * 0.75) + 'pt serif';
        ctx.font = bigFont;
        let w_main = ctx.measureText(main).width;
        ctx.font = smallFont;
        let w_sub = ctx.measureText(sub).width;
        let w_sup = ctx.measureText(sup).width;
        let w_subsup = Math.max(ctx.measureText(sub).width, ctx.measureText(sup).width);
        if (vert) {
            if (w_main > 32) {
                bigFontSize -= 1;
                smallFontSize -= 0.75;
                continue;
            } else if (w_subsup > 32) {
                smallFontSize -= 0.75;
                continue;
            }
        } else {
            if (w_main + w_subsup > 32) {
                bigFontSize -= 1;
                smallFontSize -= 0.75;
                continue;
            }
        }
        if (vert) {
            let dy = 0;
            if (w_sub < w_main * 0.8) {
                smallFont = bigFont;
                dy = -2;
            }
            ctx.fillStyle = stroke;
            ctx.font = bigFont;
            ctx.textBaseline = 'middle'
            ctx.fillText(main, x * 32 + 16 - w_main / 2, y * 32 + 11);
            ctx.font = smallFont;
            ctx.textBaseline = 'bottom';
            ctx.fillText(sub, x * 32 + 16 - w_sub / 2, y * 32 + 34 + dy);
            ctx.textBaseline = 'hanging';
            ctx.fillText(sup, x * 32 + 16 - w_sup / 2, y * 32);
        } else {
            ctx.fillStyle = stroke;
            ctx.font = bigFont;
            ctx.textBaseline = 'middle'
            ctx.fillText(main, x * 32 + 16 - w_main / 2 - w_subsup / 2, y * 32 + 18);
            ctx.font = smallFont;
            ctx.textBaseline = 'bottom';
            ctx.fillText(sub, x * 32 + 16 + w_main / 2 - w_sub / 2, y * 32 + (sup !== "" ? 34 : 32));
            ctx.textBaseline = 'hanging';
            ctx.fillText(sup, x * 32 + 16 + w_main / 2 - w_sup / 2, y * 32);
        }
        break;
    }
}

function drawHeraldErase(ctx, i) {
    let {x, y} = pickRect(i);
    ctx.fillStyle = 'black';
    ctx.fillRect(x * 32, y * 32, 32, 32);
    ctx.fillStyle = 'yellow';
    ctx.font = '6pt serif';
    ctx.fillText('HERALD', x * 32 + 16 - ctx.measureText('HERALD').width / 2, y * 32 + 11);
    ctx.font = '7pt serif';
    ctx.fillText('ERASE', x * 32 + 16 - ctx.measureText('ERASE').width / 2, y * 32 + 18);
}

function drawCpp(ctx, c1, c2, i) {
    let {x, y} = pickRect(i);
    ctx.fillStyle = '#' + (c1 === 'X' || c2 === 'X' ? 'f' : '4') + (c1 === 'Y' || c2 === 'Y' ? 'f' : '4') + (c1 === 'Z' || c2 === 'Z' ? 'f' : '4');
    ctx.fillRect(x * 32, y * 32, 32, 32);
    ctx.fillStyle = 'black';
    ctx.font = '12pt serif';
    let t1 = 'CPP';
    ctx.fillText(t1, x * 32 + 16 - ctx.measureText(t1).width / 2, y * 32 + 5);
    let t2 = c1 + ':' + c2;
    ctx.font = '12pt serif';
    ctx.fillText(t2, x * 32 + 16 - ctx.measureText(t2).width / 2, y * 32 + 18);
}

function drawHeraldPauliError1(ctx, i) {
    let {x, y} = pickRect(i);
    ctx.fillStyle = 'black';
    ctx.fillRect(x * 32, y * 32, 32, 32);
    ctx.fillStyle = 'yellow';
    ctx.font = '6pt serif';
    ctx.fillText('HERALD', x * 32 + 16 - ctx.measureText('HERALD').width / 2, y * 32 + 3);
    ctx.font = '9pt serif';
    ctx.fillText('Pauli', x * 32 + 16 - ctx.measureText('Pauli').width / 2, y * 32 + 11);
    ctx.fillText('Err1', x * 32 + 16 - ctx.measureText('Err1').width / 2, y * 32 + 21);
}

/**
 * @param {!CanvasRenderingContext2D} ctx
 */
function draw(ctx) {
    for (let a = 32; a < 127; a++) {
        drawRect(ctx, String.fromCharCode(a), "#fff", "#000", a - 32);
    }
    drawRect(ctx, "?", "white", 127 - 32);
    let n = 128 - 32;

    drawRect(ctx, "X", "#FEE", "#000", n++);
    drawRect(ctx, "Y", "#EFE", "#000", n++);
    drawRect(ctx, "Z", "#EEF", "#000", n++);

    drawRect(ctx, "H_YZ", "#FAA", "#000", n++);
    drawRect(ctx, "H", "#AFA", "#000", n++);
    drawRect(ctx, "H_XY", "#AAF", "#000", n++);

    drawRect(ctx, "S_X", "#FAA", "#000", n++);
    drawRect(ctx, "S_Y", "#AFA", "#000", n++);
    drawRect(ctx, "S", "#AAF", "#000", n++);
    drawRect(ctx, "S_X^†", "#FAA", "#000", n++);
    drawRect(ctx, "S_Y^†", "#AFA", "#000", n++);
    drawRect(ctx, "S^†", "#AAF", "#000", n++);

    drawRect(ctx, "M_X", "#F44", "#000", n++);
    drawRect(ctx, "M_Y", "#4F4", "#000", n++);
    drawRect(ctx, "M", "#44F", "#000", n++);

    drawRect(ctx, "R_X", "#F44", "#000", n++);
    drawRect(ctx, "R_Y", "#4F4", "#000", n++);
    drawRect(ctx, "R", "#44F", "#000", n++);

    drawRect(ctx, "MR_X", "#F44", "#000", n++);
    drawRect(ctx, "MR_Y", "#4F4", "#000", n++);
    drawRect(ctx, "MR", "#44F", "#000", n++);

    drawRect(ctx, "X_ERR", "#000", "#F44", n++);
    drawRect(ctx, "Y_ERR", "#000", "#4F4", n++);
    drawRect(ctx, "Z_ERR", "#000", "#44F", n++);

    drawRect(ctx, "X_CErr", "#000", "#F44", n++);
    drawRect(ctx, "Y_CErr", "#000", "#4F4", n++);
    drawRect(ctx, "Z_CErr", "#000", "#44F", n++);

    drawRect(ctx, "X_ElErr", "#000", "#F44", n++);
    drawRect(ctx, "Y_ElErr", "#000", "#4F4", n++);
    drawRect(ctx, "Z_ElErr", "#000", "#44F", n++);

    drawRect(ctx, "MPP_X", "#F44", "#000", n++);
    drawRect(ctx, "MPP_Y", "#4F4", "#000", n++);
    drawRect(ctx, "MPP_Z", "#44F", "#000", n++);

    drawRect(ctx, "√XX", "#FAA", "#000", n++);
    drawRect(ctx, "√YY", "#AFA", "#000", n++);
    drawRect(ctx, "√ZZ", "#AAF", "#000", n++);

    drawRect(ctx, "√XX_†", "#FAA", "#000", n++);
    drawRect(ctx, "√YY_†", "#AFA", "#000", n++);
    drawRect(ctx, "√ZZ_†", "#AAF", "#000", n++);

    drawRect(ctx, "X^rec", "#FEE", "#000", n++);
    drawRect(ctx, "Y^rec", "#EFE", "#000", n++);
    drawRect(ctx, "Z^rec", "#EEF", "#000", n++);

    drawRect(ctx, "sweep_X", "#FEE", "#000", n++);
    drawRect(ctx, "sweep_Y", "#EFE", "#000", n++);
    drawRect(ctx, "sweep_Z", "#EEF", "#000", n++);
    n += 2;
    drawRect(ctx, "I_ERR", "#FFF", "#000", n++);

    n = 128 + 16;
    drawRect(ctx, "I", "#FFF", "#000", n++);
    drawRect(ctx, "C_XYZ", "#FFA", "#000", n++);
    drawRect(ctx, "C_ZYX", "#AFF", "#000", n++);
    drawRect(ctx, "DEP_1", "#000", "#FFF", n++);
    drawRect(ctx, "DEP_2", "#000", "#FFF", n++);
    drawRect(ctx, "iSw_ap", "#FFF", "#000", n++);
    drawRect(ctx, "iSw_ap†", "#FFF", "#000", n++);
    drawRect(ctx, "SWAP", "#FFF", "#000", n++);
    drawRect(ctx, "Pauli_Err1", "#000", "#FFF", n++);
    drawRect(ctx, "Pauli_Err2", "#000", "#FFF", n++);

    drawRect(ctx, "M_XX", "#F44", "#000", n++);
    drawRect(ctx, "M_YY", "#4F4", "#000", n++);
    drawRect(ctx, "M_ZZ", "#44F", "#000", n++);
    drawRect(ctx, "M_PAD", "#888", "#000", n++);
    drawHeraldErase(ctx, n++);
    drawHeraldPauliError1(ctx, n++);

    drawRect(ctx, "SPP_X", "#F44", "#000", n++);
    drawRect(ctx, "SPP_Y", "#4F4", "#000", n++);
    drawRect(ctx, "SPP_Z", "#44F", "#000", n++);
    drawRect(ctx, "SPP_X†", "#F44", "#000", n++);
    drawRect(ctx, "SPP_Y†", "#4F4", "#000", n++);
    drawRect(ctx, "SPP_Z†", "#44F", "#000", n++);
    drawRect(ctx, "C_NXYZ", "#FFA", "#000", n++);
    drawRect(ctx, "C_XNYZ", "#FFA", "#000", n++);
    drawRect(ctx, "C_XYNZ", "#FFA", "#000", n++);
    drawRect(ctx, "C_NZYX", "#AFF", "#000", n++);
    drawRect(ctx, "C_ZNYX", "#AFF", "#000", n++);
    drawRect(ctx, "C_ZYNX", "#AFF", "#000", n++);
    drawRect(ctx, "H_NXY", "#FAA", "#000", n++);
    drawRect(ctx, "H_NXZ", "#AFA", "#000", n++);
    drawRect(ctx, "H_NYZ", "#AAF", "#000", n++);
    drawRect(ctx, "II", "#FFF", "#000", n++);

    n = 128 + 48;
    drawCpp(ctx, 'I', 'X', n++);
    drawCpp(ctx, 'I', 'Y', n++);
    drawCpp(ctx, 'I', 'Z', n++);
    drawCpp(ctx, 'X', 'I', n++);
    drawCpp(ctx, 'X', 'X', n++);
    drawCpp(ctx, 'X', 'Y', n++);
    drawCpp(ctx, 'X', 'Z', n++);
    drawCpp(ctx, 'Y', 'I', n++);
    drawCpp(ctx, 'Y', 'X', n++);
    drawCpp(ctx, 'Y', 'Y', n++);
    drawCpp(ctx, 'Y', 'Z', n++);
    drawCpp(ctx, 'Z', 'I', n++);
    drawCpp(ctx, 'Z', 'X', n++);
    drawCpp(ctx, 'Z', 'Y', n++);
    drawCpp(ctx, 'Z', 'Z', n++);
    drawRect(ctx, "II_ERR", "#FFF", "#000", n++);
}

draw(document.getElementById('cv').getContext('2d'))

</script>
</body>


================================================
FILE: dev/clean_build_files.sh
================================================
#!/bin/bash
set -e

#########################################################################
# Deletes files created by cmake, python setup.py, and other build steps.
#########################################################################

# Get to this script's git repo root.
cd "$( dirname "${BASH_SOURCE[0]}" )"
cd "$(git rev-parse --show-toplevel)"

rm CMakeFiles -rf
rm CMakeCache.txt -f
rm Makefile -f
rm dist -rf
rm cmake_install.cmake -f
rm cmake-build-debug-coverage -rf
rm coverage -rf
rm stim.egg-info -rf
rm bazel-bin -rf
rm bazel-out -rf
rm bazel-stim -rf
rm bazel-testlogs -rf
rm Testing -rf
rm out -rf
rm cmake-build-debug -rf
rm .cmake -rf


================================================
FILE: dev/compile_crumble_into_cpp_string_file.sh
================================================
#!/bin/bash
set -e

# Get to this script's git repo root.
cd "$( dirname "${BASH_SOURCE[0]}" )"
cd "$(git rev-parse --show-toplevel)"

echo '#include "stim/diagram/crumble_data.h"'
echo '';
echo 'std::string stim_draw_internal::make_crumble_html() {'
echo '    std::string result;'
dev/compile_crumble_into_single_html_page.sh | python -c '
import sys
for line in sys.stdin:
    for k in range(0, len(line), 1024):
        part = line[k:k+1024]
        print(f"""    result.append(R"CRUMBLE_PART({part})CRUMBLE_PART");""")';
echo '    return result;'
echo '}'


================================================
FILE: dev/compile_crumble_into_single_html_page.sh
================================================
#!/bin/bash
set -e

cd "$( dirname "${BASH_SOURCE[0]}" )"
cd "$(git rev-parse --show-toplevel)"

cat glue/crumble/crumble.html | grep -v "^<script";
echo "<script>";
# HACK: this temp file is to work around https://github.com/rollup/rollup/issues/5097
rollup glue/crumble/main.js --silent > tmp_crumble.tmp
uglifyjs -c -m --mangle-props --toplevel < tmp_crumble.tmp;
rm tmp_crumble.tmp
echo "</script>";


================================================
FILE: dev/doctest_proper.py
================================================
#!/usr/bin/env python3

"""Runs doctests on a module, including any objects imported into the module."""
import argparse
import doctest
import inspect
import sys
from typing import Dict


SKIPPED_FIELDS = {
    '__base__',
    '__name__',
    '__path__',
    '__spec__',
    '__version__',
    '__package__',
    '__subclasshook__',
    '__abstractmethods__',
    '__bases__',
    '__basicsize__',
    '__class__',
    '__builtins__',
    '__cached__',
    '__doc__',
    '__loader__',
    '__file__',
}


def no_really_i_have_a_doc_why_is_this_needed_argh(v: object, fullname: str) -> object:
    def so_much_doc():
        pass
    so_much_doc.__doc__ = v.__doc__
    so_much_doc.__qualname__ = fullname
    return so_much_doc


def gen(*, obj: object, fullname: str, out: Dict[str, object]) -> None:
    if obj is None:
        return
    if inspect.isfunction(obj) or inspect.ismethod(obj) or inspect.isbuiltin(obj) or inspect.isroutine(obj):
        if hasattr(obj, '__doc__'):
            out[fullname] = obj
        return
    if not inspect.ismodule(obj) and not inspect.isclass(obj):
        if hasattr(obj, '__doc__'):
            out[fullname] = no_really_i_have_a_doc_why_is_this_needed_argh(obj, fullname)
        return
    if hasattr(obj, '__doc__'):
        out[fullname] = obj

    for sub_name in dir(obj):
        if sub_name in SKIPPED_FIELDS:
            continue
        if sub_name.startswith('__pybind11_module'):
            continue
        sub_obj = getattr(obj, sub_name, None)
        if inspect.ismodule(sub_obj):
            continue
        sub_full_name = fullname + "." + sub_name
        gen(obj=sub_obj, fullname=sub_full_name, out=out)


def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--module",
        type=str,
        required=True,
        nargs='+',
        help="The module to test. "
             "This module will be imported, "
             "its imported values will be recursively explored, "
             "and doctests will be run on them.")
    parser.add_argument(
        '--import',
        default=(),
        nargs='*',
        type=str,
        help="Modules to import for each doctest.")
    args = parser.parse_args()

    globs = {
        k: __import__(k) for k in getattr(args, 'import')
    }
    any_failed = False
    for module_name in args.module:
        module = __import__(module_name)
        out = {}
        gen(obj=module, fullname=module_name, out=out)
        for k, v in out.items():
            if v.__doc__ is None:
                continue
            v = v.__doc__.lower()
            if '\n' in v.strip() and 'examples:' not in v and 'example:' not in v and '[deprecated]' not in v:
                if k.split('.')[-1] not in ['__format__', '__next__', '__iter__', '__init_subclass__', '__module__', '__eq__', '__ne__', '__str__', '__repr__']:
                    if all(not (e.startswith('_') and not e.startswith('__')) for e in k.split('.')):
                        print(f"    Warning: Missing 'examples:' section in docstring of {k!r}", file=sys.stderr)

        module.__test__ = {k: v for k, v in out.items()}
        if doctest.testmod(module, globs=globs).failed:
            any_failed = True
    if any_failed:
        sys.exit(1)


if __name__ == '__main__':
    main()


================================================
FILE: dev/gen_known_gates_for_js.sh
================================================
#!/bin/bash
set -e

#########################################################################
# Generates javascript exporting a string KNOWN_GATE_NAMES_FROM_STIM.
#########################################################################

echo "const KNOWN_GATE_NAMES_FROM_STIM = \`"
python -c "import stim; stim.main(command_line_args=['help', 'gates'])" | grep "    " | sed 's/^ *//g'
echo "\`"
echo
echo "export {KNOWN_GATE_NAMES_FROM_STIM};"


================================================
FILE: dev/gen_sinter_api_reference.py
================================================
"""
Iterates over modules and classes, listing their attributes and methods in markdown.
"""

import sinter

import sys

from util_gen_stub_file import generate_documentation


def main():
    version = sinter.__version__
    if "dev" in version or version == "VERSION_INFO" or "-dev" in sys.argv:
        version = "(Development Version)"
        is_dev = True
    else:
        version = "v" + version
        is_dev = False
    objects = [
        obj
        for obj in generate_documentation(obj=sinter, full_name="sinter", level=0)
        if all('[DEPRECATED]' not in line for line in obj.lines)
    ]

    print(f"# Sinter {version} API Reference")
    print()
    if is_dev:
        print("*CAUTION*: this API reference is for the in-development version of sinter.")
        print("Methods and arguments mentioned here may not be accessible in stable versions, yet.")
        print("API references for stable versions are kept on the [stim github wiki](https://github.com/quantumlib/Stim/wiki)")
        print()
    print("## Index")
    for obj in objects:
        level = obj.level
        print((level - 1) * "    " + f"- [`{obj.full_name}`](#{obj.full_name})")

    print(f'''
```python
# Types used by the method definitions.
from typing import overload, TYPE_CHECKING, Any, Counter, Dict, Iterable, List, Optional, Tuple, Union
import abc
import dataclasses
import io
import numpy as np
import pathlib
import stim
```
'''.strip())

    replace_rules = []
    for package in ['stim', 'sinter']:
        p = __import__(package)
        for name in dir(p):
            x = getattr(p, name)
            if isinstance(x, type) and 'class' in str(x):
                desired_name = f'{package}.{name}'
                if '._' in str(x):
                    bad_name = str(x).split("'")[1]
                    replace_rules.append((bad_name, desired_name))
                lonely_name = desired_name.split(".")[-1]
                for q in ['"', "'"]:
                    replace_rules.append(('ForwardRef(' + q + lonely_name + q + ')', desired_name))
                    replace_rules.append(('ForwardRef(' + q + desired_name + q + ')', desired_name))
                    replace_rules.append((q + desired_name + q, desired_name))
                    replace_rules.append((q + lonely_name + q, desired_name))
                replace_rules.append(('ForwardRef(' + desired_name + ')', desired_name))
                replace_rules.append(('ForwardRef(' + lonely_name + ')', desired_name))

    for obj in objects:
        print()
        print(f'<a name="{obj.full_name}"></a>')
        print("```python")
        print(f'# {obj.full_name}')
        print()
        if len(obj.full_name.split('.')) > 2:
            print(f'# (in class {".".join(obj.full_name.split(".")[:-1])})')
        else:
            print(f'# (at top-level in the sinter module)')
        for line in obj.lines:
            for a, b in replace_rules:
                line = line.replace(a, b)
            print(line)
        print("```")


if __name__ == '__main__':
    main()


================================================
FILE: dev/gen_stim_api_reference.py
================================================
"""
Iterates over modules and classes, listing their attributes and methods in markdown.
"""

import stim

import sys

from util_gen_stub_file import generate_documentation


def main():
    version = stim.__version__
    if "dev" in version or version == "VERSION_INFO" or "-dev" in sys.argv:
        version = "(Development Version)"
        is_dev = True
    else:
        version = "v" + version
        is_dev = False
    objects = [
        obj
        for obj in generate_documentation(obj=stim, full_name="stim", level=0)
        if all('[DEPRECATED]' not in line for line in obj.lines)
    ]

    print(f"# Stim {version} API Reference")
    print()
    if is_dev:
        print("*CAUTION*: this API reference is for the in-development version of stim.")
        print("Methods and arguments mentioned here may not be accessible in stable versions, yet.")
        print("API references for stable versions are kept on the [stim github wiki](https://github.com/quantumlib/Stim/wiki)")
        print()
    print("## Index")
    for obj in objects:
        level = obj.level
        print((level - 1) * "    " + f"- [`{obj.full_name}`](#{obj.full_name})")

    print(f'''
```python
# Types used by the method definitions.
from typing import overload, TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Tuple, Union
import io
import pathlib
import numpy as np
```
'''.strip())

    for obj in objects:
        print()
        print(f'<a name="{obj.full_name}"></a>')
        print("```python")
        print(f'# {obj.full_name}')
        print()
        if len(obj.full_name.split('.')) > 2:
            print(f'# (in class {".".join(obj.full_name.split(".")[:-1])})')
        else:
            print(f'# (at top-level in the stim module)')
        print('\n'.join(obj.lines))
        print("```")


if __name__ == '__main__':
    main()


================================================
FILE: dev/gen_stim_stub_file.py
================================================
#!/usr/bin/env python3

"""
Produces a .pyi file for stim, describing the contained classes and functions.
"""

import stim
import sys

from util_gen_stub_file import generate_documentation


def main():
    version = stim.__version__
    if "dev" in version or version == "VERSION_INFO" or "-dev" in sys.argv:
        version = "(Development Version)"
    else:
        version = "v" + version
    print(f'''
"""Stim {version}: a fast quantum stabilizer circuit library."""
# (This is a stubs file describing the classes and methods in stim.)
from __future__ import annotations
from typing import overload, TYPE_CHECKING, List, Dict, Tuple, Any, Union, Iterable, Optional, Sequence, Literal
if TYPE_CHECKING:
    import io
    import pathlib
    import numpy as np
    import stim
'''.strip())

    for obj in generate_documentation(obj=stim, full_name="stim", level=-1):
        text = '\n'.join(("    " * obj.level + line).rstrip()
                        for paragraph in obj.lines
                        for line in paragraph.splitlines())
        assert "stim::" not in text, "CONTAINS C++ STYLE TYPE SIGNATURE!!:\n" + text
        print(text)


if __name__ == '__main__':
    main()


================================================
FILE: dev/make_logo.html
================================================
<!DOCTYPE html>
<html lang="en">
<body style="margin: 0">
</body>
<script type="module">
    function make_svg(diam) {
        let svg = `<svg width="${diam}" height="${diam}" viewBox="0 0 ${diam} ${diam}" xmlns="http://www.w3.org/2000/svg">\n`;
        let angles = [
            Math.PI * 1 / 6,
            Math.PI * 5 / 6,
            Math.PI * 9 / 6,
        ]

        let cx = diam / 2;
        let cy = diam / 2 + 10 * (diam / 256);
        let rad = 46 * (diam / 256);
        let rect_group = (a1, a2, color1, color2) => {
            for (let k1 = 0; k1 < 2; k1++) {
                for (let k2 = 0; k2 < 3; k2++) {
                    rect(a1, a2, k1, k2, (k1 + k2) % 2 === 0 ? color1 : color2);
                }
            }
        }
        let rnd = x => Math.round(x * 10000) / 10000;
        let rect = (a1, a2, d1, d2, color) => {
            let dx1 = Math.cos(angles[a1]) * rad;
            let dy1 = Math.sin(angles[a1]) * rad;
            let dx2 = Math.cos(angles[a2]) * rad;
            let dy2 = Math.sin(angles[a2]) * rad;
            let xys = [];
            let eps = 0.05;
            for (let [e1, e2] of [[eps, eps], [eps, 1-eps], [1-eps, 1-eps], [1-eps, eps]]) {
                let [x, y] = [cx + dx1*(d1 + e1) + dx2*(d2 + e2), cy + dy1*(d1 + e1) + dy2*(d2 + e2)];
                xys.push([rnd(x), rnd(y)]);
            }
            svg += '<path d="';
            svg += `M${xys[0][0]},${xys[0][1]} `
            svg += `L${xys[1][0]},${xys[1][1]} `
            svg += `L${xys[2][0]},${xys[2][1]} `
            svg += `L${xys[3][0]},${xys[3][1]} `
            svg += `Z" fill="${color}"/>\n`
        };
        let r = '#FBBC04'
        let g = '#FF8207'
        let b = '#174EA6'
        rect_group(0, 1, r, b)
        rect_group(1, 2, b, g)
        rect_group(2, 0, g, r)
        svg += '</svg>';
        return svg;
    }
    for (let diam of [32, 64, 128, 256]) {
        let div = document.createElement('div');
        div.textContent = `${diam}x${diam}`;
        let img = document.createElement('img');
        img.src = `data:image/svg+xml;base64,${btoa(make_svg(diam))}`;
        let span = document.createElement('span');
        document.body.appendChild(div);
        document.body.appendChild(img);
    }
</script>
</html>


================================================
FILE: dev/overwrite_dev_versions_with_date.py
================================================
#!/usr/bin/env python3

#########################################################
# Sets version numbers to a date-based dev version.
#
# Does nothing if not on a dev version.
#########################################################
# Example usage (from repo root):
#
# ./dev/overwrite_dev_versions_with_date.sh
#########################################################

import os
import pathlib
import re
import subprocess


def main():
    os.chdir(pathlib.Path(__file__).parent)
    os.chdir(subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).decode().strip())

    # Generate dev version starting from major.minor version.
    # (Requires the existing version to have a 'dev' suffix.)
    # (Uses the timestamp of the HEAD commit, to ensure consistency when run multiple times.)
    with open('setup.py') as f:
        maj_min_version_line, = [line for line in f.read().splitlines() if re.match("^__version__ = '[^']+'", line)]
        maj_version, min_version, patch = maj_min_version_line.split()[-1].strip("'").split('.')
        if 'dev' not in patch:
            return  # Do nothing for non-dev versions.
    timestamp = subprocess.check_output(['git', 'show', '-s', '--format=%ct', 'HEAD']).decode().strip()
    new_version = f"{maj_version}.{min_version}.dev{timestamp}"

    # Overwrite existing versions.
    package_setup_files = [
        "setup.py",
        "glue/cirq/setup.py",
        "glue/cirq/stimcirq/__init__.py",
        "glue/zx/stimzx/__init__.py",
        "glue/zx/setup.py",
        "glue/sample/setup.py",
        "glue/sample/src/sinter/__init__.py",
    ]
    for path in package_setup_files:
        with open(path) as f:
            content = f.read()
        assert maj_min_version_line in content
        content = content.replace(maj_min_version_line, f"__version__ = '{new_version}'")
        with open(path, 'w') as f:
            print(content, file=f, end='')


if __name__ == '__main__':
    main()


================================================
FILE: dev/regen_crumble_cpp_resource.sh
================================================
#!/bin/bash
set -e

# Get to this script's git repo root.
cd "$( dirname "${BASH_SOURCE[0]}" )"
cd "$(git rev-parse --show-toplevel)"

dev/compile_crumble_into_cpp_string_file.sh > src/stim/diagram/crumble_data.cc


================================================
FILE: dev/regen_docs.sh
================================================
#!/bin/bash
set -e

#########################################################################
# Regenerates doc files using the installed version of stim.
#########################################################################

# Get to this script's git repo root.
cd "$( dirname "${BASH_SOURCE[0]}" )"
cd "$(git rev-parse --show-toplevel)"

python dev/gen_stim_api_reference.py -dev > doc/python_api_reference_vDev.md
python dev/gen_stim_stub_file.py -dev > glue/python/src/stim/__init__.pyi
python dev/gen_stim_stub_file.py -dev > doc/stim.pyi
python dev/gen_sinter_api_reference.py -dev > doc/sinter_api.md
python -c "import stim; stim.main(command_line_args=['help', 'gates_markdown'])" > doc/gates.md
python -c "import stim; stim.main(command_line_args=['help', 'formats_markdown'])" > doc/result_formats.md
python -c "import stim; stim.main(command_line_args=['help', 'commands_markdown'])" > doc/usage_command_line.md
dev/gen_known_gates_for_js.sh > glue/crumble/test/generated_gate_name_list.test.js


================================================
FILE: dev/regen_file_lists.sh
================================================
#!/bin/bash
set -e

#########################################################################
# Regenerate file_lists
#########################################################################

if [ "$#" -ne 1 ]; then
    FOLDER=file_lists
else
    FOLDER=$1
fi

# Get to this script's git repo root.
cd "$( dirname "${BASH_SOURCE[0]}" )"
cd "$(git rev-parse --show-toplevel)"

# LC_ALL=C forces sorting to happen by byte value
find src | grep "\\.cc$" | grep -v "\\.\(test\|perf\|pybind\)\\.cc$" | grep -v "src/main\\.cc" | LC_ALL=C sort > "${FOLDER}/source_files_no_main"
find src | grep "\\.test\\.cc$" | LC_ALL=C sort > "${FOLDER}/test_files"
find src | grep "\\.perf\\.cc$" | LC_ALL=C sort > "${FOLDER}/perf_files"
find src | grep "\\.pybind\\.cc$" | LC_ALL=C sort > "${FOLDER}/pybind_files"

# Regenerate 'stim.h' to include all relevant headers.
{
    echo "#ifndef _STIM_H";
    echo "#define _STIM_H";
    echo "/// WARNING: THE STIM C++ API MAKES NO COMPATIBILITY GUARANTEES.";
    echo "/// It may change arbitrarily and catastrophically from minor version to minor version.";
    echo "/// If you need a stable API, use stim's Python API.";
    find src | grep "\\.h$" | grep -v "\\.\(test\|perf\|pybind\)\\.h$" | grep -v "src/stim\\.h" | grep -v "src/stim/mem/simd_word_.*" | LC_ALL=C sort | sed 's/src\/\(.*\)/#include "\1"/g';
    echo "#endif";
} > src/stim.h

# Regenerate crumble's unit test imports.
find glue/crumble | grep "\\.test.js$" | LC_ALL=C sort | sed 's/glue\/crumble\(.*\)/import "..\1"/g' > "glue/crumble/test/test_import_all.js"


================================================
FILE: dev/regen_texture_to_cpp_base64_string.sh
================================================
#!/bin/bash
set -e

#########################################################################
# Transforms binary data into an array of string literals containing the
# base 64 data encoding the data. The strings are split into an array
# to avoid exceeding C++'s maximum string literal length.
#########################################################################

# Get to this script's git repo root.
cd "$( dirname "${BASH_SOURCE[0]}" )"
cd "$(git rev-parse --show-toplevel)"

{
    echo '#include "stim/diagram/gate_data_3d_texture_data.h"';
    echo '';
    echo 'std::string stim_draw_internal::make_gate_3d_texture_data_uri() {';
    echo '    std::string result;';
    echo '    result.append("data:image/png;base64,");';
    base64 -w 1024 | sed 's/.*/    result.append("\0");/g';
    echo '    return result;';
    echo '}';
} > "src/stim/diagram/gate_data_3d_texture_data.cc"


================================================
FILE: dev/util_gen_stub_file.py
================================================
import dataclasses
import types
from typing import Any
from typing import Optional, Iterator, List

import inspect
from typing import Tuple

keep = {
    "__add__",
    "__ipow__",
    "__radd__",
    "__eq__",
    "__call__",
    "__ge__",
    "__getitem__",
    "__gt__",
    "__iadd__",
    "__imul__",
    "__init__",
    "__truediv__",
    "__itruediv__",
    "__ne__",
    "__neg__",
    "__le__",
    "__len__",
    "__lt__",
    "__mul__",
    "__setitem__",
    "__str__",
    "__pos__",
    "__pow__",
    "__repr__",
    "__rmul__",
    "__hash__",
    "__iter__",
    "__next__",
}
skip = {
    "__annotate_func__",
    "__annotations_cache__",
    "__firstlineno__",
    "__static_attributes__",
    "__replace__",
    "__builtins__",
    "__cached__",
    "__getstate__",
    "__setstate__",
    "__path__",
    "__class__",
    "__delattr__",
    "__dir__",
    "__doc__",
    "__file__",
    "__format__",
    "__getattribute__",
    "__init_subclass__",
    "__loader__",
    "__module__",
    "__name__",
    "__new__",
    "__package__",
    "__reduce__",
    "__reduce_ex__",
    "__setattr__",
    "__sizeof__",
    "__spec__",
    "__subclasshook__",
    "__version__",
    "__annotations__",
    "__dataclass_fields__",
    "__dataclass_params__",
    "__dict__",
    "__match_args__",
    "__post_init__",
    "__weakref__",
    "__abstractmethods__",
    "__annotate_func__",
    "__annotations_cache__",
}


def normalize_doc_string(d: str) -> str:
    lines = d.splitlines()
    indented_lines = [e for e in lines[1:] if e.strip()]
    indentation = min([len(line) - len(line.lstrip()) for line in indented_lines], default=0)
    return "\n".join(lines[:1] + [e[indentation:] for e in lines[1:]])


def indented(*, paragraph: str, indentation: str) -> str:
    return "".join(
        indentation * (line != '\n') + line
        for line in paragraph.splitlines(keepends=True)
    )


class DescribedObject:
    def __init__(self):
        self.full_name = ""
        self.level = 0
        self.lines = []


def splay_signature(sig: str) -> List[str]:
    # Maintain backwards compatibility with python 3.6
    sig = sig.replace('list[', 'List[')
    sig = sig.replace('dict[', 'Dict[')
    sig = sig.replace('tuple[', 'Tuple[')
    sig = sig.replace('set[', 'Set[')
    sig = sig.replace('pathlib._local.Path', 'pathlib.Path')

    assert sig.startswith('def')
    out = []

    level = 0

    start = sig.index('(') + 1
    mark = start
    out.append(sig[:mark])
    for k in range(mark, len(sig)):
        c = sig[k]
        if c in '([':
            level += 1
        if c in '])':
            level -= 1
        if (c == ',' and level == 0) or level < 0:
            k2 = k + (0 if level < 0 else 1)
            s = sig[mark:k2].lstrip()
            if s:
                if not s.endswith(','):
                    s += ','
                out.append('    ' + s)
            mark = k2
        if level < 0:
            break
    assert level == -1
    out.append(sig[mark:])
    return out


def _handle_pybind_method(
    *,
    obj: Any,
    is_property: bool,
    out_obj: DescribedObject,
    parent: Any,
    full_name: str,
) -> Tuple[str, bool, str, str]:
    doc = normalize_doc_string(getattr(obj, "__doc__", ""))
    if is_property:
        out_obj.lines.append("@property")
    doc_lines = doc.splitlines()
    new_args_name = None
    was_args = False
    sig_handled = False
    has_setter = False
    doc_lines_left = []
    term_name = full_name.split(".")[-1]
    for line in doc_lines:
        if was_args and line.strip().startswith('*') and ':' in line:
            new_args_name = line[line.index('*'):line.index(':')]
        if '@overload ' in line:
            _, sig = line.split('@overload ')
            out_obj.lines.append("@overload")
            is_static = '(self' not in sig and inspect.isclass(parent)
            if is_static:
                out_obj.lines.append("@staticmethod")
            out_obj.lines.extend(splay_signature(sig))
            out_obj.lines.append("    pass")
        elif '@signature ' in line:
            _, sig = line.split('@signature ')
            is_static = '(self' not in sig and inspect.isclass(parent)
            if term_name not in sig:
                raise ValueError(f"Expected name {term_name!r} to appear in signature override for {full_name!r}:\n    {line}")
            if is_static:
                out_obj.lines.append("@staticmethod")
            out_obj.lines.extend(splay_signature(sig))
            sig_handled = True
        else:
            doc_lines_left.append(line)
        was_args = 'Args:' in line

    if is_property:
        if hasattr(obj, 'fget'):
            sig_name = term_name + obj.fget.__doc__.replace('arg0', 'self').strip()
        else:
            sig_name = f'{term_name}(self)'
        if getattr(obj, 'fset', None) is not None:
            has_setter = True
    elif doc_lines_left[0].startswith(term_name):
        sig_name = term_name + doc_lines_left[0][len(term_name):]
        doc_lines_left = doc_lines_left[1:]
    else:
        sig_name = term_name

    doc = "\n".join(doc_lines_left).lstrip()
    text = ""
    if not sig_handled:
        if "(self: " in sig_name:
            k_low = sig_name.index("(self: ") + len('(self')
            k_high = len(sig_name)
            if '->' in sig_name: k_high = sig_name.index('->', k_low, k_high)
            k_high = sig_name.index(", " if ", " in sig_name[k_low:k_high] else ")", k_low, k_high)
            sig_name = sig_name[:k_low] + sig_name[k_high:]
        if not sig_handled:
            is_static = '(self' not in sig_name and inspect.isclass(parent)
            if is_static:
                out_obj.lines.append("@staticmethod")
        sig_name = sig_name.replace(': handle', ': Any')
        sig_name = sig_name.replace('numpy.', 'np.')
        if new_args_name is not None:
            sig_name = sig_name.replace('*args', new_args_name)
        text = "\n".join(splay_signature(f"def {sig_name}:"))
    return text, has_setter, doc, sig_name


def print_doc(*, full_name: str, parent: object, obj: object, level: int) -> Optional[DescribedObject]:
    out_obj = DescribedObject()
    out_obj.full_name = full_name
    out_obj.level = level
    doc = getattr(obj, "__doc__", None) or ""
    doc = normalize_doc_string(doc)
    if full_name.endswith("__") and len(doc.splitlines()) <= 2:
        return None

    term_name = full_name.split(".")[-1]
    is_property = isinstance(obj, property)
    is_method = doc.startswith(term_name)
    has_setter = False
    is_normal_method = isinstance(obj, types.FunctionType)
    sig_name = ''
    if 'sinter' in full_name and is_normal_method:
        text = ''
        if term_name in getattr(parent, '__abstractmethods__', []):
            text += '@abc.abstractmethod\n'
        sig_name = f'{term_name}{inspect.signature(obj)}'
        text += "\n".join(splay_signature(f"def {sig_name}:"))

        # Replace default value lambdas with their source.
        if 'lambda' in str(text):
            for name, param in inspect.signature(obj).parameters.items():
                if 'lambda' in str(param.default):
                    _, lambda_src = inspect.getsource(param.default).split('lambda ')
                    lambda_src = lambda_src.strip()
                    assert lambda_src.endswith(',')
                    lambda_src = 'lambda ' + lambda_src[:-1]
                    text = text.replace(str(param.default), lambda_src)

        text = text.replace('numpy.', 'np.')
    elif is_method or is_property:
        text, has_setter, doc, sig_name = _handle_pybind_method(
            obj=obj,
            is_property=is_property,
            out_obj=out_obj,
            parent=parent,
            full_name=full_name,
        )
    elif isinstance(obj, (int, str)):
        text = f"{term_name}: {type(obj).__name__} = {obj!r}"
        doc = ''
    elif term_name == term_name.upper():
        return None  # Skip constants because they lack a doc string.
    else:
        text = f"class {term_name}"
        if inspect.isabstract(obj):
            text += '(metaclass=abc.ABCMeta)'
        text += ':'
    if doc:
        if text:
            text += "\n"
        text += indented(paragraph=f"\"\"\"{doc.rstrip()}\n\"\"\"",
                         indentation="    ")

    dataclass_fields = getattr(obj, "__dataclass_fields__", [])
    if dataclass_fields:
        dataclass_prop ='@dataclasses.dataclass'
        if getattr(obj, '__dataclass_params__').frozen:
            dataclass_prop += '(frozen=True)'
        out_obj.lines.append(dataclass_prop)

    out_obj.lines.append(text.replace('._stim_avx2', '').replace('._stim_sse2', ''))
    if has_setter:
        if '->' in sig_name:
            setter_type = sig_name[sig_name.index('->') + 2:].strip().replace('._stim_avx2', '')
        else:
            setter_type = 'Any'
        out_obj.lines.append(f"@{term_name}.setter")
        out_obj.lines.append(f"def {term_name}(self, value: {setter_type}):")
        out_obj.lines.append(f"    pass")

    if dataclass_fields:
        for f in dataclasses.fields(obj):
            if str(f.type).startswith('typing'):
                t = str(f.type).replace('typing.', '')
            else:
                t = f.type.__name__
            t = t.replace('''Union[Dict[str, ForwardRef('JSON_TYPE')], List[ForwardRef('JSON_TYPE')], str, int, float]''', 'Any')
            if f.default is dataclasses.MISSING:
                out_obj.lines.append(f'    {f.name}: {t}')
            else:
                out_obj.lines.append(f'    {f.name}: {t} = {f.default}')

    return out_obj


def generate_documentation(*, obj: object, level: int, full_name: str) -> Iterator[DescribedObject]:
    if full_name.endswith("__"):
        return
    if not inspect.ismodule(obj) and not inspect.isclass(obj):
        return

    for sub_name in dir(obj):
        if sub_name in getattr(obj, '__dataclass_fields__', []):
            continue
        if sub_name in skip:
            continue
        if sub_name.startswith("__pybind11"):
            continue
        if sub_name.startswith('_') and not sub_name.startswith('__'):
            continue
        if sub_name.endswith("__") and sub_name not in keep:
            raise ValueError("Need to classify " + sub_name + " as keep or skip.")
        sub_full_name = full_name + "." + sub_name
        sub_obj = getattr(obj, sub_name)
        v = print_doc(full_name=sub_full_name, obj=sub_obj, level=level + 1, parent=obj)
        if v is not None:
            yield v
        yield from generate_documentation(
            obj=sub_obj,
            level=level + 1,
            full_name=sub_full_name)


================================================
FILE: doc/circuit_data_references.md
================================================
## 2021

- [arXiv:2103.02202](https://arxiv.org/abs/2103.02202) → [Ancillary files of "Stim: a fast stabilizer circuit simulator"](https://arxiv.org/src/2103.02202v3/anc)
- [arXiv:2108.10457](https://arxiv.org/abs/2108.10457) → [Ancillary files of "A Fault-Tolerant Honeycomb Memory"](https://arxiv.org/src/2108.10457v2/anc)

## 2022

- [arXiv:2202.11845](https://arxiv.org/abs/2202.11845) → [Data for "Benchmarking the Planar Honeycomb Code"](https://zenodo.org/records/7072889)
- [arXiv:2204.13834](https://arxiv.org/abs/2204.13834) → [Data for "Stability Experiments: The Overlooked Dual of Memory Experiments"](https://zenodo.org/records/6859486)
- [arXiv:2206.12780](https://arxiv.org/abs/2206.12780) → [Data for "A Pair Measurement Surface Code on Pentagons"](https://zenodo.org/records/6626417)
- [arXiv:2207.06431](https://arxiv.org/abs/2207.06431) → [Data for "Suppressing quantum errors by scaling a surface code logical qubit"](https://zenodo.org/records/6804040)
- [arXiv:2209.08552](https://arxiv.org/abs/2209.08552) → [Parallel window decoding enables scalable fault tolerant quantum computation](https://doi.org/10.5281/zenodo.8422904)

## 2023

- [arXiv:2302.02192](https://arxiv.org/abs/2302.02192) → [Data for "Relaxing Hardware Requirements for Surface Code Circuits using Time-dynamics"](https://zenodo.org/records/7587578)
- [arXiv:2302.07395](https://arxiv.org/abs/2302.07395) → [Data for "Inplace Access to the Surface Code Y Basis"](https://zenodo.org/records/7487893)
- [arXiv:2302.12292](https://arxiv.org/abs/2302.12292) → [Data for "Cleaner magic states with hook injection"](https://zenodo.org/records/7575030)
- [arXiv:2305.12046](https://arxiv.org/abs/2305.12046) → [Data for "Less Bacon More Threshold"](https://zenodo.org/records/7901729)
- [arXiv:2307.10147](https://arxiv.org/abs/2307.10147) → [Stim circuits for "Tangling schedules eases hardware connectivity requirements for quantum error correction" manuscript](https://zenodo.org/records/8391674)
- [arXiv:2308.03750](https://arxiv.org/abs/2308.03750) → [Ancillary data for the paper "Constructions and performance of hyperbolic and semi-hyperbolic Floquet codes" ](https://github.com/oscarhiggott/hyperbolic-floquet-data)
- [arXiv:2309.05558](https://arxiv.org/abs/2309.05558) → [Data supporting "A real-time, scalable, fast and resource-efficient decoder for a quantum computer"](https://zenodo.org/records/11621878)
- [arXiv:2312.04522](https://arxiv.org/abs/2312.04522) → [Data for "Yoked Surface Codes"](https://zenodo.org/records/10277397)
- [arXiv:2312.08813](https://arxiv.org/abs/2312.08813) → [Data for "New circuits and an open source decoder for the colorcode"](https://zenodo.org/records/10375289)
- [arXiv:2312.11605](https://arxiv.org/abs/2312.11605) → [Stim circuits and collected data for "Error-corrected Hadamard gate simulated at the circuit level" manuscript](https://zenodo.org/records/10391116)
- [arXiv:2312.14060](https://arxiv.org/abs/2312.14060) → [Data for "Fault-tolerant quantum architectures based on erasure qubits"](https://zenodo.org/records/13730128)

## 2024

- [arXiv:2405.15854](https://arxiv.org/abs/2405.15854) → [Stim circuits for 'Accommodating Fabrication Defects on Floquet Codes with Minimal Hardware Requirements' manuscript](https://zenodo.org/records/11241876)
- [arXiv:2406.02700](https://arxiv.org/abs/2406.02700) → [Data for "Optimization of decoder priors for accurate quantum error correction"](https://zenodo.org/records/11403595)
- [arXiv:2407.13826](https://arxiv.org/abs/2407.13826) → [Stim circuits for 'Designing fault-tolerant circuits using detector error models'](https://github.com/peter-janderks/short_measurement_schedules_simulations/tree/main/stim_circuits)
- [arXiv:2408.00758](https://arxiv.org/abs/2408.00758) → [Stim circuits for ``To reset, or not to reset -- that is the question" manuscript](https://zenodo.org/records/13152440)
- [arXiv:2408.11894](https://arxiv.org/abs/2408.11894) → [Stim circuits for 'Automated Synthesis of Fault-Tolerant State Preparation Circuits for Quantum Error Correction Codes'](https://github.com/cda-tum/mqt-qecc/tree/main/src/mqt/qecc/ft_stateprep/eval/circuits)
- [arXiv:2408.13687](https://arxiv.org/abs/2408.13687) → [Data for "Quantum error correction below the surface code threshold"](https://zenodo.org/records/13273331)
- [arXiv:2409.04628](https://arxiv.org/abs/2409.04628) → [Stim implementation of the [[16,4,4]] Tesseract Code](https://github.com/DeDuckProject/tesseract-code-stim) (circuits are in the stim_circuits/ directory)
- [arXiv:2409.17595](https://arxiv.org/abs/2409.17595) → [Data for "Magic state cultivation: growing T states as cheap as CNOT gates"](https://zenodo.org/records/13777072)
- [arXiv:2412.01391](https://arxiv.org/abs/2412.01391) → [GitHub repo for "Transversal Logical Clifford gates on rotated surface codes with reconfigurable neutral atom arrays"](https://github.com/Zihan-Chen-PhMA/Dynamical-S-gate-decoding/) (circuits are in the circuit_garage/ directory)
- [arXiv:2412.14256](https://arxiv.org/abs/2412.14256) → [Data for "Scaling and logic in the color code on a superconducting quantum processor"](https://zenodo.org/records/14238944)
- [arXiv:2412.14360](https://arxiv.org/abs/2412.14360) → [Data for "Demonstrating dynamic surface codes"](https://zenodo.org/records/14238907)
- [arXiv:2412.15187](https://arxiv.org/abs/2412.15187) → [Stim circuits and results for "Universal quantum computation via scalable measurement-free error correction"](https://zenodo.org/records/15707012)

## 2025

- [arXiv:2503.04968](https://arxiv.org/abs/2503.04968) → [GitHub repo for "Optimized Noise-Resilient Surface Code Teleportation Interfaces"](https://github.com/QEC-pages/Modular-Surface-code-simulations/) (circuits are in the out/ directory)
- [arXiv:2503.18657](https://arxiv.org/abs/2503.18657) → [GitHub repo for "Efficient Magic State Cultivation on RP^2"](https://github.com/Zihan-Chen-PhMA/Cultiv_T_RP2/) (circuits are in the circuit_garage/ directory)
- [arXiv:2504.02935](https://arxiv.org/abs/2504.02935) → [Scripts, Stim circuits and simulation results for "Magic State Injection with Erasure Qubits"](https://zenodo.org/records/15874462)
- [arXiv:2507.08069](https://arxiv.org/abs/2507.08069) → [Stim circuits and simulation results for "A dynamic circuit for the honeycomb Floquet code"](https://zenodo.org/records/15854678)
- [arXiv:2507.19430](https://arxiv.org/abs/2507.19430) → [Stim circuits and parity check matrices for "Directional Codes: a new family of quantum LDPC codes on hexagonal- and square-grid connectivity hardware" manuscript](https://zenodo.org/records/16422162)
- [arXiv:2512.17999](https://arxiv.org/abs/2512.17999) → [Stim circuits for "Logical gates on Floquet codes via folds and twists"](https://zenodo.org/records/17966122)


================================================
FILE: doc/developer_documentation.md
================================================
# Stim Developer Documentation

This is documentation for programmers working with stim, e.g. how to build it.
These notes generally assume you are on a Linux system.

# Index

- [compatibility guarantees across versions](#compatibility)
- [releasing a new version](#release-checklist)
- [building `stim` command line tool](#build)
    - [with cmake](#build.cmake)
    - [with bazel](#build.bazel)
    - [with gcc](#build.gcc)
- [linking to `libstim` shared library](#link)
    - [with cmake](#link.cmake)
    - [with bazel](#link.bazel)
- [running C++ tests](#test)
    - [with cmake](#test.cmake)
    - [with bazel](#test.bazel)
- [running performance benchmarks](#perf)
    - [with cmake](#perf.cmake)
    - [with bazel](#perf.bazel)
    - [interpreting output from `stim_perf`](#perf.output)
    - [profiling with gcc and perf](#perf.profile)
- [creating a python dev environment](#venv)
- [running python unit tests](#test.pytest)
    - [running sinter tests against a custom decoder](#test.pytest.sinter.custom)
- [python packaging `stim`](#pypackage.stim)
    - [with cibuildwheels](#pypackage.stim.cibuildwheels)
    - [with bazel](#pypackage.stim.bazel)
    - [with python setup.py](#pypackage.stim.python)
    - [with pip install -e](#pypackage.stim.pip)
    - [with cmake](#pypackage.stim.cmake)
- [python packaging `stimcirq`](#pypackage.stimcirq)
    - [with python setup.py](#pypackage.stimcirq.python)
    - [with pip install -e](#pypackage.stimcirq.pip)
- [python packaging `sinter`](#pypackage.sinter)
    - [with python setup.py](#pypackage.sinter.python)
    - [with pip install -e](#pypackage.sinter.pip)
- [javascript packaging `stimjs`](#jspackage.stimjs)
    - [with emscripten](#jspackage.stimjs.emscripten)
- [autoformating code](#autoformat)
    - [with clang-format](#autoformat.clang-format)
- [adding new c++ files](#newfile)
- [adding new CLI commands](#newcmd)

# <a name="compatibility"></a>Compatibility guarantees across versions

A *bug* is bad behavior that wasn't intended. For example, the program crashing instead of returning empty results when sampling from an empty circuit would be a bug.

A *trap* is originally-intended behavior that leads to the user making mistakes. For example, allowing the user to take a number of shots that wasn't a multiple of 64 when using the data format `ptb64` was a trap because the shots were padded up to a multiple of 64 using zeroes (and these fake shots could then easily be treated as real by later analysis steps).

A *spandrel* is an implementation detail that has observable effects, but which is not really required to behave in that specific way. For example, when stim derives a detector error model from a circuit, the exact probability of an error instruction depends on minor details such as floating point error (which is sensitive to compiler optimizations). The exact floating point error that occurs is a spandrel.

- **Stim Python API**
    - The python API must maintain backwards compatibility from minor version to minor version (except for bug fixes, trap fixes, and spandrels). Violating this requires a new major version.
    - Trap fixes must be documented as breaking changes in the release notes.
    - The exact behavior of random seeding is a spandrel. The behavior must be consistent on a single machine for a single version, with the same seed always producing the same results, but it is **not** stable between minor versions. This is enforced by intentionally introducing changes for every single minor version.
- **Stim Command Line API**
    - The command land API must maintain backwards compatibility from minor version to minor version (except for bug fixes, trap fixes, and spandrels). Violating this requires a new major version.
    - Trap fixes must be documented as breaking changes in the release notes.
    - It is explicitly **not** allowed for a command to stop working due to, for example, a cleanup effort to make the commands more consistent. Violating this requires a new major version.
    - The exact behavior of random seeding is a spandrel. The behavior must be consistent on a single machine for a single version, with the same seed always producing the same results, but it is **not** stable between minor versions. This is enforced by intentionally introducing changes for every single minor version.
- **Stim C++ API**
    - The C++ API makes no compatibility guarantees. It may change arbitrarily and catastrophically from minor version to minor version.

# <a name="release-checklist"></a>Releasing a new version

- Create an off-main-branch release commit
    - [ ] `git checkout main -b SOMEBRANCHNAME`
    - [ ] Global search replace `__version__ = 'X.Y.dev0'` with `__version__ = 'X.Y.0'`
    - [ ] `git commit -a -m "Bump to vX.Y.0"`
    - [ ] `git tag vX.Y.0`
    - [ ] Push tag to github
    - [ ] Check github `Actions` tab and confirm ci is running on the tag
    - [ ] Wait for ci to finish validating and producing artifacts for the tag
    - [ ] Get `stim`, `stimcirq`, and `sinter` wheels/sdists [from cibuildwheels](#pypackage.stim.cibuildwheels) of this tag
- Bump to next dev version on main branch
    - [ ] `git checkout main -b SOMEBRANCHNAME`
    - [ ] Global search replace `__version__ = 'X.Y.dev0'` with `__version__ = 'X.(Y+1).dev0'`
    - [ ] Increment `INTENTIONAL_VERSION_SEED_INCOMPATIBILITY` in `src/stim/circuit/circuit.h`
    - [ ] `git commit -a -m "Start vX.(Y+1).dev"`
    - [ ] Push to github as a branch and merge into main using a pull request
- Write release notes on github
    - [ ] In title, use two-word theming of most important changes
    - [ ] Flagship changes section
    - [ ] Notable changes section
    - [ ] Include wheels/sdists as attachments
- Do these irreversible and public viewable steps last!
    - [ ] Upload wheels/sdists to pypi using `twine`
    - [ ] Publish the github release notes
    - [ ] Add gates reference page to wiki for the new version
    - [ ] Add python api reference page to wiki for the new version
    - [ ] Update main wiki page to point to latest reference pages
    - [ ] Tweet about the release


# <a name="build"></a>Building `stim` command line tool

The stim command line tool is a binary program `stim` that accepts commands like
`stim sample -shots 100 -in circuit.stim`
(see [the command line reference](usage_command_line.md)).
It can be built [with cmake](#build.cmake), [with bazel](#build.bazel), or
manually [with gcc](#build.gcc).

## <a name="build.cmake"></a>Building `stim` command line tool with cmake

```bash
# from the repository root:
cmake .
make stim

# output binary ends up at:
# ./out/stim
```

Stim can also be installed:
```bash
# from the repository root:
cmake .
make stim
make install

# output binary ends up at:
# -CMAKE_INSTALL_PREFIX/bin
# output library ends up at:
# -CMAKE_INSTALL_PREFIX/lib
# output headers end up at:
# -CMAKE_INSTALL_PREFIX/include
```
by default `make install` will install to the system default directory (e.g.
`/usr/local`). The install path can be controlled by passing the flag
`-DCMAKE_INSTALL_PREFIX=/path/to/install` to `cmake`.

Vectorization can be controlled by passing the flag `-DSIMD_WIDTH` to `cmake`:

- `cmake . -DSIMD_WIDTH=256` means "use 256 bit avx operations" (forces `-mavx2`)
- `cmake . -DSIMD_WIDTH=128` means "use 128 bit sse operations" (forces `-msse2`)
- `cmake . -DSIMD_WIDTH=64` means "don't use simd operations" (no machine arch flags)
- `cmake .` means "use the best thing possible on this machine" (forces `-march=native`)

A `compile_commands.json` (used by clangd to provide IDE features over lsp)
can be generated by passing the flag `-DCMAKE_EXPORT_COMPILE_COMMANDS=1` to `cmake`.


## <a name="build.bazel"></a>Building `stim` command line tool with bazel

```bash
bazel build stim
```

or, to build and run:

```bash
bazel run stim
```

## <a name="build.gcc"></a>Building `stim` command line tool with gcc

```bash
# from the repository root:
find src \
    | grep "\\.cc$" \
    | grep -v "\\.\(test\|perf\|pybind\)\\.cc$" \
    | xargs g++ -I src -pthread -std=c++20 -O3 -march=native

# output binary ends up at:
# ./a.out
```


# <a name="link"></a>Linking to `libstim` shared library

**!!!CAUTION!!!
Stim's C++ API is not kept stable!
Always pin to a specific version!
I *WILL* break your downstream code when I update stim if you don't!
The API is also not extensively documented;
what you can find in the headers is what you get.**

To use Stim functionality within your C++ program, you can build `libstim` and
link to it to gain direct access to underlying Stim types and methods.

If you want a stim API that promises backwards compatibility, use the python API.

## <a name="link.cmake"></a>Linking to `libstim` shared library with cmake

**!!!CAUTION!!!
Stim's C++ API is not kept stable!
Always pin to a specific version!
I *WILL* break your downstream code when I update stim if you don't!
The API is also not extensively documented;
what you can find in the headers is what you get.**

In your `CMakeLists.txt` file, use `FetchContent` to automatically fetch stim
from github when running `cmake .`:

```
# in CMakeLists.txt file

include(FetchContent)
FetchContent_Declare(stim
        GIT_REPOSITORY https://github.com/quantumlib/stim.git
        GIT_TAG v1.4.0)  # [[[<<<<<<< customize the version you want!!]]]
FetchContent_MakeAvailable(stim)
```

(Replace `v1.4.0` with another version tag as appropriate.)

For build targets that need to use stim functionality, add `libstim` to them
using `target_link_libraries`:

```
# in CMakeLists.txt file

target_link_libraries(some_cmake_target PRIVATE libstim)
```

In your source code, use `#include "stim.h"` to access stim types and functions:

```
// in a source code file

#include "stim.h"

stim::Circuit make_bell_pair_circuit() {
    return stim::Circuit(R"CIRCUIT(
        H 0
        CNOT 0 1
        M 0 1
        DETECTOR rec[-1] rec[-2]
    )CIRCUIT");
}
```

## <a name="link.bazel"></a>Linking to `libstim` shared library with bazel

**!!!CAUTION!!!
Stim's C++ API is not kept stable!
Always pin to a specific version!
I *WILL* break your downstream code when I update stim if you don't!
The API is also not extensively documented;
what you can find in the headers is what you get.**

In your `WORKSPACE` file, include stim's git repo using `git_repository`:

```
# in WORKSPACE file

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
    name = "stim",
    commit = "v1.4.0",
    remote = "https://github.com/quantumlib/stim.git",
)
```

(Replace `v1.4.0` with another version tag or commit SHA as appropriate.)

In your `BUILD` file, add `@stim//:stim_lib` to the relevant target's `deps`:

```
# in BUILD file

cc_binary(
    ...
    deps = [
        ...
        "@stim//:stim_lib",
        ...
    ],
)
```

In your source code, use `#include "stim.h"` to access stim types and functions:

```
// in a source code file

#include "stim.h"

stim::Circuit make_bell_pair_circuit() {
    return stim::Circuit(R"CIRCUIT(
        H 0
        CNOT 0 1
        M 0 1
        DETECTOR rec[-1] rec[-2]
    )CIRCUIT");
}
```


# <a name="test"></a>Running unit tests

Stim's code base includes a variety of types of tests, spanning over a few
packages and languages.

## <a name="test.cmake"></a>Running C++ unit tests with cmake

Unit testing with cmake requires the GTest library to be installed on your
system in a place that cmake can find it.
Follow the ["Standalone CMake Project" instructions from the GTest README](https://github.com/google/googletest/tree/master/googletest)
to get GTest installed correctly.

Run tests with address and memory sanitization, without compile time optimization:

```bash
# from the repository root:
cmake .
make stim_test
./out/stim_test
```

Run tests without sanitization, with compile time optimization:

```bash
# from the repository root:
cmake .
make stim_test_o3
./out/stim_test_o3
```

Stim supports 256 bit (AVX), 128 bit (SSE), and 64 bit (native) vectorization.
The type to use is chosen at compile time.
To force this choice (so that each case can be tested on one machine),
add `-DSIMD_WIDTH=256` or `-DSIMD_WIDTH=128` or `-DSIMD_WIDTH=64`
to the `cmake .` command.

## <a name="test.bazel"></a>Running C++ unit tests with bazel

```bash
# from the repository root:
bazel test stim_test
```

# <a name="perf"></a>Running performance benchmarks

## <a name="perf.cmake"></a>Running performance benchmarks with cmake

```bash
cmake .
make stim_perf
./out/stim_perf
```

## <a name="perf.cmake"></a>Running performance benchmarks with bazel

```bash
bazel run stim_perf
```

## <a name="perf.output"></a>Interpreting output from `stim_perf`

When you run `stim_perf` you will see output like:

```
[....................*....................] 460 ns (vs 450 ns) ( 21 GBits/s) simd_bits_randomize_10K
[...................*|....................]  24 ns (vs  20 ns) (400 GBits/s) simd_bits_xor_10K
[....................|>>>>*...............] 3.6 ns (vs 4.0 ns) (270 GBits/s) simd_bits_not_zero_100K
[....................*....................] 5.8 ms (vs 6.0 ms) ( 17 GBits/s) simd_bit_table_inplace_square_transpose_diam10K
[...............*<<<<|....................] 8.1 ms (vs 5.0 ms) ( 12 GOpQubits/s) FrameSimulator_depolarize1_100Kqubits_1Ksamples_per1000
[....................*....................] 5.3 ms (vs 5.0 ms) ( 18 GOpQubits/s) FrameSimulator_depolarize2_100Kqubits_1Ksamples_per1000
```

The bars on the left show how fast each task is running compared to baseline expectations (on my dev machine).
Each tick away from the center `|` is 1 decibel slower or faster (i.e. each `<` or `>` represents a factor of `1.26`).

Basically, if you see `[......*<<<<<<<<<<<<<|....................]` then something is *seriously* wrong, because the
code is running 25x slower than expected.

The `stim_perf` binary supports a `--only=BENCHMARK_NAME` filter flag.
Multiple filters can be specified by separating them with commas `--only=A,B`.
Ending a filter with a `*` turns it into a prefix filter `--only=sim_*`.

## <a name="perf.profile"></a>Profiling with gcc and perf

```bash
find src \
    | grep "\\.cc" \
    | grep -v "\\.\(test\|perf\|pybind\)\\.cc" \
    | xargs g++ -I src -pthread -std=c++20 -O3 -march=native -g -fno-omit-frame-pointer
sudo perf record -g ./a.out  # [ADD STIM FLAGS FOR THE CASE YOU WANT TO PROFILE]
sudo perf report
```


## <a name="venv"></a>Creating a python dev environment

First, create a fresh python 3.6+ virtual environment using your favorite
method:
[`python -m venv`](https://docs.python.org/3/library/venv.html),
[`virtualenvwrapper`](https://virtualenvwrapper.readthedocs.io/en/latest/),
[`conda`](https://docs.conda.io/en/latest/),
or etc.

Second, build and install a stim wheel.
Follow the [python packaging stim](#pypackage.stim) instructions to
create a wheel.
I recommend [packaging with bazel](#pypackage.stim) because it is **BY FAR** the
fastest.
Once you have the wheel, run `pip install [that_wheel]`.
For example:

```base
# from the repository root in a python virtual environment
bazel build :stim_dev_wheel
pip uninstall stim --yes
pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
```

Note that you need to repeat the above steps each time you make a change to
`stim`.

Third, use `pip install -e` to install development references to the pure-python
glue packages:

```
# install test dependencies
pip install pytest pymatching

# install stimcirq dev reference:
pip install -e glue/cirq

# install sinter dev reference:
pip install -e glue/sample

# install stimzx dev reference:
pip install -e glue/zx
```

## <a name="test.pytest"></a>Running python unit tests

See [creating a python dev environment](#venv) for instructions on creating a
python virtual environment with your changes to stim installed.

Unit tests are run using `pytest`.
Examples in docstrings are tested using the `dev/doctest_proper` script,
which uses python's [`doctest`](https://docs.python.org/3/library/doctest.html) module
but ensures values added to a module at import time are also tested (instead of requiring
them to be [manually listed in a `__test__` property](https://docs.python.org/3/library/doctest.html#which-docstrings-are-examined)).

To test everything:

```bash
# from the repository root in a virtualenv with development wheels installed:
pytest src glue
dev/doctest_proper.py --module stim
dev/doctest_proper.py --module stimcirq --import cirq sympy
dev/doctest_proper.py --module sinter
dev/doctest_proper.py --module stimzx
```

Test only `stim`:

```bash
# from the repository root in a virtualenv with development wheels installed:
pytest src
dev/doctest_proper.py --module stim
```

Test only `stimcirq`:

```bash
# from the repository root in a virtualenv with development wheels installed:
pytest glue/cirq
dev/doctest_proper.py --module stimcirq --import cirq sympy
```

Test only `sinter`:

```bash
# from the repository root in a virtualenv with development wheels installed:
pytest glue/sample
dev/doctest_proper.py --module sinter
```

Test only `stimzx`:

```bash
# from the repository root in a virtualenv with development wheels installed:
pytest glue/zx
dev/doctest_proper.py --module stimzx
```

## <a name="test.pytest.sinter.custom"></a>Running sinter's python unit tests against a custom decoder

Some of sinter's python unit tests verify that a decoder is behaving correctly.
It can be useful, when creating a custom decoder, to run these tests against the
decoder.
This can be done by setting the environment `SINTER_PYTEST_CUSTOM_DECODERS`
variable to `custom_package:custom_method` where `custom_package` is a python
package to import and `custom_method` is a method name implemented by that
package that returns a `Dict[str, sinter.Decoder]`. This is the same form of
argument that's given to `sinter collect --custom_decoders`.

Example:

```
SINTER_PYTEST_CUSTOM_DECODERS="my_custom_package:my_custom_sinter_decoder_dict_method" pytest glue/sample
```


# <a name="pypackage.stim"></a>python packaging `stim`

Because stim is a C++ extension, it is non-trivial to create working
python packages for it.
To make cross-platform release wheels, we rely heavily on cibuildwheels.
To make development wheels, various other options are possible.

## <a name="pypackage.stim.cibuildwheels"></a>python packaging `stim` with cibuildwheels

When a commit is merged into the `main` branch of stim's GitHub repository,
there are GitHub actions that use [cibuildwheels](https://github.com/pypa/cibuildwheel)
to build wheels for all supported platforms.

cibuildwheels can also be invoked locally, assuming you have Docker installed, using a command like:

```bash
CIBW_BUILD=cp39-manylinux_x86_64 cibuildwheel --platform linux
# output goes into wheelhouse/
````

When these wheels are finished building, they are automatically uploaded to
pypi as a dev version of stim.
For release versions, the artifacts created by the github action must be
manually downloaded and uploaded using `twine`:

```bash
twine upload --username="${PROD_TWINE_USERNAME}" --password="${PROD_TWINE_PASSWORD}" artifacts_directory/*
```

## <a name="pypackage.stim.bazel"></a>python packaging `stim` with bazel

Bazel can be used to create dev versions of the stim python wheel:

```bash
# from the repository root:
bazel build stim_dev_wheel
# output is at bazel-bin/stim-0.0.dev0-py3-none-any.whl
```

## <a name="pypackage.stim.python"></a>python packaging `stim` with python setup.py

Python can be used to create dev versions of the stim python wheel (very slow):

Binary distribution:

```bash
# from the repository root in a python venv with pybind11 installed:
python setup.py bdist
# output is at dist/*
```

Source distribution:

```bash
# from the repository root in a python venv with pybind11 installed:
python setup.py sdist
# output is at dist/*
```

## <a name="pypackage.stim.pip"></a>python packaging `stim` with pip install -e

You can directly install stim as a development python wheel by using pip (very slow):

```bash
# from the repository root
pip install -e .
# stim is now installed in current virtualenv as dev reference
```

## <a name="pypackage.stim.cmake"></a>python packaging `stim` with cmake

A python module can be built using cmake. The output can be imported as `import stim`, but is not packaged, so if you want to pip install, prefer building the bindings with Bazel.

```bash
# from the repository root
cmake stim_python_bindings
# output is at out/stim.cpython-${PYTHON_VERSION}-${ARCH}.so
PYTHONPATH=out python -c "import stim; print(stim.__version__)"
```


# <a name="pypackage.stimcirq"></a>Python packaging `stimcirq`

## <a name="pypackage.stimcirq.python"></a>Python packaging `stimcirq` with python setup.py

```bash
# from repo root
cd glue/cirq
python setup.py sdist
cd -
# output in glue/cirq/dist/*
```

## <a name="pypackage.stimcirq.pip"></a>Python packaging `stimcirq` with pip install -e

```bash
# from repo root
pip install -e glue/cirq
# stimcirq is now installed in current virtualenv as dev reference
```

# <a name="pypackage.sinter"></a>Python packaging `sinter`

## <a name="pypackage.sinter.python"></a>Python packaging `sinter` with python setup.py

```bash
# from repo root
cd glue/sample
python setup.py sdist
cd -
# output in glue/sample/dist/*
```

## <a name="pypackage.sinter.pip"></a>Python packaging `sinter` with pip install -e

```bash
# from repo root
pip install -e glue/sample
# sinter is now installed in current virtualenv as dev reference
```

# <a name="pypackage.stimzx"></a>Python packaging `stimzx`

## <a name="pypackage.stimzx.python"></a>Python packaging `stimzx` with python setup.py

```bash
# from repo root
cd glue/zx
python setup.py sdist
cd -
# output in glue/zx/dist/*
```

## <a name="pypackage.stimzx.pip"></a>Python packaging `stimzx` with pip install -e

```bash
# from repo root
pip install -e glue/zx
# stimzx is now installed in current virtualenv as dev reference
```


# <a name="jspackage"></a>Javascript packaging `stimjs`

## <a name="jspackage.stimjs"></a>Javascript packaging `stimjs` with emscripten

Install and activate enscriptem (`emcc` must be in your PATH).
Example:

```bash
# [outside of repo]
git clone git@github.com:emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source emsdk_env.sh
```

Run the bash build script:

```bash
# [from repo root]
glue/javascript/build_wasm.sh
```

Outputs are the binary `out/stim.js` and the test runner `out/all_stim_tests.html`.
Run tests by opening in a browser and checking for an `All tests passed.` message in the browser console:

```bash
firefox out/all_stim_tests.html
```


# <a name="autoformat"></a>Autoformating code

## <a name="autoformat.clang-format"></a>Autoformating code with clang-format

Run the following command from the repo root to auto-format all C++ code:

```bash
find src | grep "\.\(cc\|h\)$" | grep -Pv "crumble_data.cc|gate_data_3d_texture_data.cc" | xargs clang-format -i
```

# <a name="newfile"></a>Adding new C++ files

For the cmake build system, we maintain C++ file lists in the folder `file_lists`.
When you add a new C++ file, they can be updated using `dev/regen_file_lists.sh`

# <a name="newcmd"></a>Adding new CLI commands

A [reference](usage_command_line.md) is maintained to document the CLI usage. This is generated using
`dev/regen_docs.sh` which assumes the script is run from a virtualenv with
a [dev wheel of stim](#python-packaging-stim) installed.


================================================
FILE: doc/file_format_dem_detector_error_model.md
================================================
# The Detector Error Model File Format (.dem)

A detector error model file (.dem) is a human-readable specification of error mechanisms.
The intent of the file format is to act as a reasonably flexible configuration language that can be easily consumed by
*decoders*, which attempt to predict the logical observable frame from symptoms within the context of an error model.

## Index

- [Encoding](#Encoding)
- [Syntax](#Syntax)
- [Semantics](#Semantics)
    - [Instruction Types](#Instruction-Types)
        - [`detector` instruction](#detector-instruction)
        - [`logical_observable` instruction](#logical_observable-instruction)
        - [`shift_detectors` instruction](#shift_detectors-instruction)
        - [`error` instruction](#error-instruction)
        - [`repeat` block](#repeat-block)
    - [Target Types](#State-Space)
        - [`D#`: relative detector target](#relative-detector-target)
        - [`L#`: logical observable target](#logical-observable-target)
        - [`#`: numeric target](#numeric-target)
        - [`^`: separator target](#separator-target)
    - [State Space](#State-Space)
- [Examples](#Examples)
    - [Circular Error Model](#circular-error-model)
    - [Repetition Code Error Model](#repetition-code-error-model)
    - [Surface Code Error Model](#surface-code-error-model)


## Encoding

Detector error model files are always encoded using UTF-8.
Furthermore, the only place in the file where non-ASCII characters are permitted is inside of comments.

## Syntax

A detector error model file is made up of a series of lines.
Each line is either blank, an instruction, a block initiator, or a block terminator.
Also, each line may be indented with spacing characters and may end with a comment indicated by a hash (`#`).

```
<DETECTOR_ERROR_MODEL> ::= <LINE>*
<LINE> ::= <INDENT> (<INSTRUCTION> | <BLOCK_START> | <BLOCK_END>)? <COMMENT>? '\n'
<INDENT> ::= /[ \t]*/
<COMMENT> ::= '#' /[^\n]*/
```

An *instruction* is composed of a name,
then (introduced in stim v1.15) an optional tag inside square brackets,
then an optional comma-separated list of arguments inside of parentheses,
then a list of space-separated targets.
For example, the line `error[test](0.1) D5 D6 L0` is an instruction with
a name (`error`), a tag (`test`), one argument (`0.1`), and three targets
(`D5`, `D6`, and `L0`).

```
<INSTRUCTION> ::= <NAME> <TAG>? <PARENS_ARGUMENTS>? <TARGETS>
<TAG> ::= '[' /[^\r\]\n]/* ']'
<PARENS_ARGUMENTS> ::= '(' <ARGUMENTS> ')' 
<ARGUMENTS> ::= /[ \t]*/ <ARG> /[ \t]*/ (',' <ARGUMENTS>)?
<TARGETS> ::= /[ \t]+/ <TARG> <TARGETS>?
```

An instruction *name* starts with a letter and then contains a series of letters, digits, and underscores.
Names are case-insensitive.

An instruction *tag* is an arbitrary string enclosed by square brackets.
Certain characters cannot appear directly in the tag, and must instead be included using escape sequences.
The closing square bracket character `]` cannot appear directly, and is instead encoded using the escape sequence `\C`.
The carriage return character cannot appear directly, and is instead encoded using the escape sequence `\r`.
The line feed character cannot appear directly, and is instead encoded using the escape sequence `\n`.
The backslash character `\` cannot appear directly, and is instead encoded using the escape sequence `\B`.
(This backslash escape sequence differs from the common escape sequence `\\` because that sequence causes exponential explosions when escaping multiple times.)

An *argument* is a double precision floating point number.

A *target* can either be a relative detector target (a non-negative integer prefixed by `D`),
a logical observable target (a non-negative integer prefixed by `L`),
a component separator (`^`),
or an unsigned integer target (a non-negative integer).

```
<NAME> ::= /[a-zA-Z][a-zA-Z0-9_]*/ 
<ARG> ::= <double> 
<TARG> ::= <RELATIVE_DETECTOR_TARGET> | <LOGICAL_OBSERVABLE_TARGET> | <NUMBER_TARGET> | <SEPARATOR>  
<RELATIVE_DETECTOR_TARGET> ::= 'D' <uint>
<LOGICAL_OBSERVABLE_TARGET> ::= 'L' <uint>
<NUMBER_TARGET> = <uint>
<SEPARATOR> = '^'
```

A *block initiator* is an instruction suffixed with `{`.
Every block initiator must be followed, eventually, by a matching *block terminator* which is just a `}`.
The `{` always goes in the same line as its instruction, and the `}` always goes on a line by itself. 

```
<BLOCK_START> ::= <INSTRUCTION> /[ \t]*/ '{'
<BLOCK_END> ::= '}' 
```

## Semantics

A *detector error model* is a list of independent error mechanisms.
Each error mechanism has a *probability*,
*symptoms* (the detectors that the error flips),
and *frame changes* (the logical observables that the error flips).
Error mechanisms may also suggest a *decomposition* into simpler error mechanisms.

A detector error model can be sampled by independently keeping or discarding each error mechanism,
with a keep probability equal to each error mechanism's probability.
The resulting sample contains the symptoms and frame changes that appeared an odd number of times total in the kept
error mechanisms.

A detector error model file (.dem) specifies a detector error model by a series of instructions which are interpreted
one by one, from start to finish. The instructions iteratively build up a detector error model by introducing error
mechanisms.

### Instruction Types

A detector error model file can contain several different types of instructions and blocks.

#### detector instruction

A `detector` instruction declares a particular symptom that is in the error model.
It is not necessary to explicitly declare detectors using detector instructions.
Detectors can also be implicitly declared simply by being mentioned in an error mechanism,
or by a detector with a larger absolute index being declared.
However, an explicit declaration is the only way to annotate the detector with coordinates,
suggesting a spacetime location for the detector.

The detector instruction should have a detector target (the detector being declared, relative to the
current detector index offset) and can include  any number of arguments specifying the detector's
coordinates (relative to the current coordinate offset).
Note that when the current coordinate offset has more coordinates than the detector,
the additional coordinates are skipped.
For example, if the offset is `(1,2,3)` and the detector relative position is `(10,10)` then the
detector's absolute position would be `11,12`; not `11,12,3`. 

Example: `detector D4` declares a detector with index 4 (relative to the current detector index offset).

Example: `detector D5 D6` declares a detector with index 5 (relative to the current detector index offset)
and also a detector with index 6 (relative to the current detector index offset).

Example: `detector(2.5,3.5,6) D7` declares a detector with index 7
(relative to the current detector index offset)
and coordinates `2.5`, `3.5`, `6` (relative to the current coordinate offset).

#### logical_observable instruction

A `logical_observable` instruction ensures a particular frame change's existence is noted by the error model,
even if no error mechanism affects it.
Frame changes can also be implicitly declared simply by being mentioned in an error mechanism or other
instruction, or by a frame change with a larger absolute index being declared.

Example: `logical_observable L1` declares a logical observable with index 1.

Example: `logical_observable L1 L2` declares a logical observable with index 1 and also a logical observable with
index 2.

#### shift_detectors instruction

A `shift_detectors` instruction adds an offset into the current detector offset and the current coordinate offset.
Takes 1 numeric target indicating the detector offset.
Takes a variable number of arguments indicating the coordinate offset.
Shifting is useful when writing loops, because otherwise the detectors declared by each iteration
of the loop would all lie on top of each other.
The detector offset can only be increased, not decreased.

Example: `shift_detectors(0, 0.5) 2` leaves the first coordinate's offset alone,
increases the second coordinate's offset by `0.5`,
leaves all other coordinate offsets alone,
and increases the detector offset by 2.

Example: declaring a diagonal line of detectors.
```
detector(0, 0) D0
repeat 1000 {
    detector(0.5, 0.5) D1
    error(0.01) D0 D1
    shift_detectors(0.5, 0.5) 1
}
```

#### error instruction

An `error` instruction adds an error mechanism to the error model.
The error instruction takes 1 argument (the probability of the error) and multiple targets.
The targets can include detectors, observables, and separators.
Separators are used to suggest a way to decompose complicated error mechanisms into simpler ones.

For example: `error(0.1) D2 D3 L0` adds an error mechanism with
probability equal to 10%,
two symptoms (`D2`, `D3`),
one frame change (`L0`),
and no suggested decomposition.

Another example: `error(0.02) D2 L0 ^ D5 D6` adds an error mechanism with
probability equal to 2%,
three symptoms (`D2`, `D5`, `D6`),
one frame change (`L0`),
and a suggested decomposition into `D2 L0` and `D5 D6`.

Yet another example: `error(0.03) D2 L0 ^ D3 L0` adds an error mechanism with
probability equal to 3%,
two symptoms (`D2`, `D3`),
no frame changes (because the two `L0` cancel out),
and a suggested decomposition into `D2 L0` and `D3 L0`.

An example of a situation where the decomposition is relevant is a surface code with X and Z basis stabilizers.
In such a surface code, Y errors can be factored into correlated X and Z errors.
So, error mechanisms in the detector error model corresponding to Y errors in the circuit can suggest decomposing
into the X and Z parts.

It is valid for multiple error mechanisms to have the exact same targets.
Typically they would be fused as part of building the error model (via the equation
`p_{combined} = p_1 (1 - p_2) + p_2 (1 - p_1)`).
It is also valid for error mechanisms to have the same symptoms but different frame changes
(though this guarantees the error correcting code has distance at most 2).
Similarly, an error mechanism may have frame changes with no symptoms (guaranteeing a code distance equal to 1).

#### repeat block

A detector error model file can also contain `REPEAT K { ... }` blocks,
which indicate that the block's instructions should be iterated over `K` times instead of just once.

Example: declaring a diagonal line of detectors.

```
detector(0, 0) D0
repeat 1000 {
    detector(0.5, 0.5) D1
    error(0.01) D0 D1
    shift_detectors(0.5, 0.5) 1
}
```

### Target Types

There are four types of targets that can be given to instructions:
relative detector targets,
logical observable targets,
numeric targets,
and separator targets.

#### relative detector target

A relative detector target is a non-negative integer prefixed by `D`, such as `D5`.
It refers to a symptom in the error model.
To get the actual detector target specified by the relative detector target, the integer after the `D`
has to be added into the current relative detector offset.

#### logical observable target

A logical observable target is a non-negative integer prefixed by `L`, such as `L5`.
It refers to a possible frame change that an error can cause.

#### numeric target

A numeric target is a non-negative integer.
For example, the `REPEAT` block instruction takes a single numeric target indicating the number of repetitions
and the `shift_detectors` instruction takes a single numeric target indicating the detector index shift.


#### separator target

A separator target (`^`) is not an actual thing to target, but rather a marker used to split up the targets of an error
mechanism into a suggested decomposition.

### State Space

Interpreting a detector error model file, to produce a detector error model,
involves tracking several pieces of state.

1. **The Offsets**
    As the error model file is interpreted, the *relative detector index* and *relative coordinate offset* are shifted
    by `shift_detectors` instructions.
    Interpreting relative detector targets and coordinate annotations requires tracking these
    two values, since they shift the targets and coordinates.
2. **The Nodes (possible symptoms and frame changes)**.
    The error model must include every explicitly and implicitly declared detector (symptom) and
    logical observable (frame change).
    In practice this means computing the absolute index of the largest detector, and including
    a number of detectors equal to that index plus one.
    The same is done for frame changes: find the largest mentioned frame change index, and include
    a number of frame changes equal to that index plus one.
    Getting the number of nodes correct is important when parsing densely packed data that does not
    include explicit detector indices or frame change indices.
3. **The Edges (error mechanisms)**.
    The error model must include the mentioned error mechanisms.

## Examples

### Circular Error Model

This error model defines 10 symptoms, and 10 error mechanisms with two symptoms.
One of the error mechanisms, the "bad error", also has a frame change (`L0`).
If the symptoms are nodes, and error mechanisms connect two nodes, then the model forms
the 10 node circular graph.

```
error(0.1) D9 D0 L0
error(0.1) D0 D1
error(0.1) D1 D2
error(0.1) D2 D3
error(0.1) D3 D4
error(0.1) D4 D5
error(0.1) D5 D6
error(0.1) D6 D7
error(0.1) D7 D8
error(0.1) D8 D9
```

This model can be defined more succinctly by using a `repeat` block:

```
error(0.1) D9 D0 L0
repeat 9 {
    error(0.1) D0 D1
    shift_detectors 1
}
```

### Repetition Code Error Model

This is the output from
`stim --gen repetition_code --task memory --rounds 1000 --distance 4 --after_clifford_depolarization 0.001 | stim --analyze_errors --fold_loops`.
It includes coordinate annotations for the spacetime layout of the detectors.

```
error(0.0002667378157289137966) D0
error(0.0002667378157289137966) D0 D1
error(0.0005333333333331479603) D0 D3
error(0.0005333333333331479603) D0 D4
error(0.0002667378157289137966) D1 D2
error(0.0005333333333331479603) D1 D4
error(0.0005333333333331479603) D1 D5
error(0.0005333333333331479603) D2 D5
error(0.0002667378157289137966) D2 L0
error(0.0002667378157289137966) D3
error(0.0002667378157289137966) D3 D4
error(0.0002667378157289137966) D4 D5
error(0.0002667378157289137966) D5 L0
detector(1, 0) D0
detector(3, 0) D1
detector(5, 0) D2
repeat 998 {
    error(0.0002667378157289137966) D3
    error(0.0002667378157289137966) D3 D4
    error(0.0005333333333331479603) D3 D6
    error(0.0005333333333331479603) D3 D7
    error(0.0002667378157289137966) D4 D5
    error(0.0005333333333331479603) D4 D7
    error(0.0005333333333331479603) D4 D8
    error(0.0005333333333331479603) D5 D8
    error(0.0002667378157289137966) D5 L0
    error(0.0002667378157289137966) D6
    error(0.0002667378157289137966) D6 D7
    error(0.0002667378157289137966) D7 D8
    error(0.0002667378157289137966) D8 L0
    shift_detectors(0, 1) 0
    detector(1, 0) D3
    detector(3, 0) D4
    detector(5, 0) D5
    shift_detectors 3
}
error(0.0002667378157289137966) D3
error(0.0002667378157289137966) D3 D4
error(0.0005333333333331479603) D3 D6
error(0.0005333333333331479603) D3 D7
error(0.0002667378157289137966) D4 D5
error(0.0005333333333331479603) D4 D7
error(0.0005333333333331479603) D4 D8
error(0.0005333333333331479603) D5 D8
error(0.0002667378157289137966) D5 L0
error(0.0002667378157289137966) D6
error(0.0002667378157289137966) D6 D7
error(0.0002667378157289137966) D7 D8
error(0.0002667378157289137966) D8 L0
shift_detectors(0, 1) 0
detector(1, 0) D3
detector(3, 0) D4
detector(5, 0) D5
detector(1, 1) D6
detector(3, 1) D7
detector(5, 1) D8
```

### Surface Code Error Model

This is the output from
`stim --gen surface_code --task rotated_memory_x --rounds 1000 --distance 2 --after_clifford_depolarization 0.001 | stim --analyze_errors --fold_loops --decompose_errors`.
It includes coordinate annotations for the spacetime layout of the detectors.

```
error(0.0002667378157289137966) D0
error(0.001332444444444449679) D0 D2
error(0.0002667378157289137966) D0 L0
error(0.0005333333333331479603) D1
error(0.001332444444444449679) D1 D4
error(0.0002667378157289137966) D1 L0
error(0.0001333866998761607556) D1 L0 ^ D2 L0
error(0.0002667378157289137966) D1 L0 ^ D3
error(0.0001333866998761607556) D1 L0 ^ D3 ^ D2 L0
error(0.0002667378157289137966) D1 ^ D3
error(0.0005333333333331479603) D2
error(0.001332444444444449679) D2 D5
error(0.0007997866287252842132) D2 L0
error(0.0002667378157289137966) D2 L0 ^ D0 L0
error(0.0004000533570511300221) D2 L0 ^ D3
error(0.0002667378157289137966) D2 ^ D0
error(0.0001333866998761607556) D2 ^ D1
error(0.0001333866998761607556) D2 ^ D3
error(0.0001333866998761607556) D2 ^ D3 ^ D1
error(0.001731254257715537058) D3
error(0.0002667378157289137966) D3 ^ D1
error(0.0001333866998761607556) D3 ^ D2
error(0.0001333866998761607556) D3 ^ D2 L0
error(0.0001333866998761607556) D3 ^ D4
error(0.0001333866998761607556) D3 ^ D4 ^ D1
error(0.0001333866998761607556) D3 ^ D5
error(0.0001333866998761607556) D3 ^ D5 ^ D2
error(0.0004666977902291165391) D4
error(0.001332444444444449679) D4 D7
error(0.0003334000326131335203) D4 L0
error(0.0001333866998761607556) D4 L0 ^ D1 L0
error(0.0001333866998761607556) D4 L0 ^ D1 L0 ^ D3
error(0.0002000667052120994559) D4 L0 ^ D3
error(6.669779853440971351e-05) D4 L0 ^ D5 L0
error(6.669779853440971351e-05) D4 L0 ^ D5 L0 ^ D3
error(0.0002000667052120994559) D4 L0 ^ D6
error(6.669779853440971351e-05) D4 L0 ^ D6 ^ D3
error(6.669779853440971351e-05) D4 L0 ^ D6 ^ D5 L0
error(6.669779853440971351e-05) D4 L0 ^ D6 ^ D5 L0 ^ D3
error(0.0001333866998761607556) D4 ^ D1
error(0.0002000667052120994559) D4 ^ D3
error(0.0001333866998761607556) D4 ^ D6
error(0.0001333866998761607556) D4 ^ D6 ^ D3
error(0.0002000667052120994559) D5
error(0.0003334000326131335203) D5 L0
error(0.0001333866998761607556) D5 L0 ^ D2 L0
error(0.0001333866998761607556) D5 L0 ^ D2 L0 ^ D3
error(0.0003334000326131335203) D5 L0 ^ D3
error(0.0001333866998761607556) D5 L0 ^ D6
error(0.0001333866998761607556) D5 L0 ^ D6 ^ D3
error(0.0001333866998761607556) D5 ^ D2
error(6.669779853440971351e-05) D5 ^ D3
error(6.669779853440971351e-05) D5 ^ D4
error(6.669779853440971351e-05) D5 ^ D4 ^ D3
error(6.669779853440971351e-05) D5 ^ D6
error(6.669779853440971351e-05) D5 ^ D6 ^ D3
error(6.669779853440971351e-05) D5 ^ D6 ^ D4
error(6.669779853440971351e-05) D5 ^ D6 ^ D4 ^ D3
error(0.0006665777540627741476) D6
error(0.0004000533570511300221) D6 ^ D3
error(0.0002000667052120994559) D6 ^ D4
error(6.669779853440971351e-05) D6 ^ D4 ^ D3
error(6.669779853440971351e-05) D6 ^ D5 L0
error(6.669779853440971351e-05) D6 ^ D5 L0 ^ D3
error(0.0001333866998761607556) D6 ^ D7
error(0.0001333866998761607556) D6 ^ D7 ^ D4
error(0.0001333866998761607556) D7
error(0.0001333866998761607556) D7 L0
error(0.0001333866998761607556) D7 L0 ^ D4 L0
error(0.0001333866998761607556) D7 L0 ^ D4 L0 ^ D6
error(0.0001333866998761607556) D7 L0 ^ D6
error(0.0001333866998761607556) D7 ^ D4
detector(2, 0, 0) D0
detector(2, 4, 0) D1
shift_detectors(0, 0, 1) 0
detector(2, 0, 0) D2
detector(2, 2, 0) D3
detector(2, 4, 0) D4
repeat 498 {
    error(0.0001333866998761607556) D5
    error(0.001332444444444449679) D5 D8
    error(0.0001333866998761607556) D5 L0
    error(0.0001333866998761607556) D5 L0 ^ D6
    error(0.0006665777540627741476) D6
    error(0.0001333866998761607556) D6 ^ D5
    error(0.0001333866998761607556) D6 ^ D8
    error(0.0001333866998761607556) D6 ^ D8 ^ D5
    error(0.0003334000326131335203) D7
    error(0.001332444444444449679) D7 D10
    error(0.0002000667052120994559) D7 L0
    error(6.669779853440971351e-05) D7 L0 ^ D6
    error(6.669779853440971351e-05) D7 L0 ^ D8 L0
    error(6.669779853440971351e-05) D7 L0 ^ D8 L0 ^ D6
    error(0.0002000667052120994559) D7 L0 ^ D9
    error(6.669779853440971351e-05) D7 L0 ^ D9 ^ D6
    error(6.669779853440971351e-05) D7 L0 ^ D9 ^ D8 L0
    error(6.669779853440971351e-05) D7 L0 ^ D9 ^ D8 L0 ^ D6
    error(0.0002000667052120994559) D7 ^ D6
    error(0.0001333866998761607556) D7 ^ D9
    error(0.0001333866998761607556) D7 ^ D9 ^ D6
    error(0.0003334000326131335203) D8
    error(0.001332444444444449679) D8 D11
    error(0.0004666977902291165391) D8 L0
    error(0.0001333866998761607556) D8 L0 ^ D5 L0
    error(0.0001333866998761607556) D8 L0 ^ D5 L0 ^ D6
    error(0.0003334000326131335203) D8 L0 ^ D6
    error(0.0002667378157289137966) D8 L0 ^ D9
    error(0.0001333866998761607556) D8 L0 ^ D9 ^ D6
    error(0.0001333866998761607556) D8 ^ D5
    error(6.669779853440971351e-05) D8 ^ D6
    error(6.669779853440971351e-05) D8 ^ D7
    error(6.669779853440971351e-05) D8 ^ D7 ^ D6
    error(6.669779853440971351e-05) D8 ^ D9
    error(6.669779853440971351e-05) D8 ^ D9 ^ D6
    error(6.669779853440971351e-05) D8 ^ D9 ^ D7
    error(6.669779853440971351e-05) D8 ^ D9 ^ D7 ^ D6
    error(0.001332266856321125473) D9
    error(0.0004000533570511300221) D9 ^ D6
    error(0.0002000667052120994559) D9 ^ D7
    error(6.669779853440971351e-05) D9 ^ D7 ^ D6
    error(0.0001333866998761607556) D9 ^ D8
    error(6.669779853440971351e-05) D9 ^ D8 L0
    error(6.669779853440971351e-05) D9 ^ D8 L0 ^ D6
    error(0.0001333866998761607556) D9 ^ D10
    error(0.0001333866998761607556) D9 ^ D10 ^ D7
    error(0.0001333866998761607556) D9 ^ D11
    error(0.0001333866998761607556) D9 ^ D11 ^ D8
    error(0.0004666977902291165391) D10
    error(0.001332444444444449679) D10 D13
    error(0.0003334000326131335203) D10 L0
    error(0.0001333866998761607556) D10 L0 ^ D7 L0
    error(0.0001333866998761607556) D10 L0 ^ D7 L0 ^ D9
    error(0.0002000667052120994559) D10 L0 ^ D9
    error(6.669779853440971351e-05) D10 L0 ^ D11 L0
    error(6.669779853440971351e-05) D10 L0 ^ D11 L0 ^ D9
    error(0.0002000667052120994559) D10 L0 ^ D12
    error(6.669779853440971351e-05) D10 L0 ^ D12 ^ D9
    error(6.669779853440971351e-05) D10 L0 ^ D12 ^ D11 L0
    error(6.669779853440971351e-05) D10 L0 ^ D12 ^ D11 L0 ^ D9
    error(0.0001333866998761607556) D10 ^ D7
    error(0.0002000667052120994559) D10 ^ D9
    error(0.0001333866998761607556) D10 ^ D12
    error(0.0001333866998761607556) D10 ^ D12 ^ D9
    error(0.0002000667052120994559) D11
    error(0.0003334000326131335203) D11 L0
    error(0.0001333866998761607556) D11 L0 ^ D8 L0
    error(0.0001333866998761607556) D11 L0 ^ D8 L0 ^ D9
    error(0.0003334000326131335203) D11 L0 ^ D9
    error(0.0001333866998761607556) D11 L0 ^ D12
    error(0.0001333866998761607556) D11 L0 ^ D12 ^ D9
    error(0.0001333866998761607556) D11 ^ D8
    error(6.669779853440971351e-05) D11 ^ D9
    error(6.669779853440971351e-05) D11 ^ D10
    error(6.669779853440971351e-05) D11 ^ D10 ^ D9
    error(6.669779853440971351e-05) D11 ^ D12
    error(6.669779853440971351e-05) D11 ^ D12 ^ D9
    error(6.669779853440971351e-05) D11 ^ D12 ^ D10
    error(6.669779853440971351e-05) D11 ^ D12 ^ D10 ^ D9
    error(0.0006665777540627741476) D12
    error(0.0004000533570511300221) D12 ^ D9
    error(0.0002000667052120994559) D12 ^ D10
    error(6.669779853440971351e-05) D12 ^ D10 ^ D9
    error(6.669779853440971351e-05) D12 ^ D11 L0
    error(6.669779853440971351e-05) D12 ^ D11 L0 ^ D9
    error(0.0001333866998761607556) D12 ^ D13
    error(0.0001333866998761607556) D12 ^ D13 ^ D10
    error(0.0001333866998761607556) D13
    error(0.0001333866998761607556) D13 L0
    error(0.0001333866998761607556) D13 L0 ^ D10 L0
    error(0.0001333866998761607556) D13 L0 ^ D10 L0 ^ D12
    error(0.0001333866998761607556) D13 L0 ^ D12
    error(0.0001333866998761607556) D13 ^ D10
    shift_detectors(0, 0, 1) 0
    detector(2, 0, 0) D5
    detector(2, 2, 0) D6
    detector(2, 4, 0) D7
    shift_detectors(0, 0, 1) 0
    detector(2, 0, 0) D8
    detector(2, 2, 0) D9
    detector(2, 4, 0) D10
    shift_detectors 6
}
error(0.0001333866998761607556) D5
error(0.001332444444444449679) D5 D8
error(0.0001333866998761607556) D5 L0
error(0.0001333866998761607556) D5 L0 ^ D6
error(0.0006665777540627741476) D6
error(0.0001333866998761607556) D6 ^ D5
error(0.0001333866998761607556) D6 ^ D8
error(0.0001333866998761607556) D6 ^ D8 ^ D5
error(0.0003334000326131335203) D7
error(0.001332444444444449679) D7 D10
error(0.0002000667052120994559) D7 L0
error(6.669779853440971351e-05) D7 L0 ^ D6
error(6.669779853440971351e-05) D7 L0 ^ D8 L0
error(6.669779853440971351e-05) D7 L0 ^ D8 L0 ^ D6
error(0.0002000667052120994559) D7 L0 ^ D9
error(6.669779853440971351e-05) D7 L0 ^ D9 ^ D6
error(6.669779853440971351e-05) D7 L0 ^ D9 ^ D8 L0
error(6.669779853440971351e-05) D7 L0 ^ D9 ^ D8 L0 ^ D6
error(0.0002000667052120994559) D7 ^ D6
error(0.0001333866998761607556) D7 ^ D9
error(0.0001333866998761607556) D7 ^ D9 ^ D6
error(0.0003334000326131335203) D8
error(0.001332444444444449679) D8 D11
error(0.0004666977902291165391) D8 L0
error(0.0001333866998761607556) D8 L0 ^ D5 L0
error(0.0001333866998761607556) D8 L0 ^ D5 L0 ^ D6
error(0.0003334000326131335203) D8 L0 ^ D6
error(0.0002667378157289137966) D8 L0 ^ D9
error(0.0001333866998761607556) D8 L0 ^ D9 ^ D6
error(0.0001333866998761607556) D8 ^ D5
error(6.669779853440971351e-05) D8 ^ D6
error(6.669779853440971351e-05) D8 ^ D7
error(6.669779853440971351e-05) D8 ^ D7 ^ D6
error(6.669779853440971351e-05) D8 ^ D9
error(6.669779853440971351e-05) D8 ^ D9 ^ D6
error(6.669779853440971351e-05) D8 ^ D9 ^ D7
error(6.669779853440971351e-05) D8 ^ D9 ^ D7 ^ D6
error(0.001731254257715537058) D9
error(0.0004000533570511300221) D9 ^ D6
error(0.0002000667052120994559) D9 ^ D7
error(6.669779853440971351e-05) D9 ^ D7 ^ D6
error(0.0001333866998761607556) D9 ^ D8
error(6.669779853440971351e-05) D9 ^ D8 L0
error(6.669779853440971351e-05) D9 ^ D8 L0 ^ D6
error(0.0001333866998761607556) D9 ^ D10
error(0.0001333866998761607556) D9 ^ D10 ^ D7
error(0.0001333866998761607556) D9 ^ D11
error(0.0001333866998761607556) D9 ^ D11 ^ D8
error(0.0007997866287252842132) D10
error(0.001332444444444449679) D10 D12
error(0.0005333333333331479603) D10 L0
error(0.0001333866998761607556) D10 L0 ^ D7 L0
error(0.0001333866998761607556) D10 L0 ^ D7 L0 ^ D9
error(0.0002667378157289137966) D10 L0 ^ D9
error(0.0001333866998761607556) D10 L0 ^ D11 L0
error(0.0001333866998761607556) D10 L0 ^ D11 L0 ^ D9
error(0.0001333866998761607556) D10 ^ D7
error(0.0004000533570511300221) D10 ^ D9
error(0.0002667378157289137966) D11
error(0.0005333333333331479603) D11 L0
error(0.0001333866998761607556) D11 L0 ^ D8 L0
error(0.0001333866998761607556) D11 L0 ^ D8 L0 ^ D9
error(0.0005333333333331479603) D11 L0 ^ D9
error(0.0001333866998761607556) D11 ^ D8
error(0.0001333866998761607556) D11 ^ D9
error(0.0001333866998761607556) D11 ^ D10
error(0.0001333866998761607556) D11 ^ D10 ^ D9
error(0.0002667378157289137966) D12
error(0.0002667378157289137966) D12 L0
error(0.0002667378157289137966) D12 L0 ^ D10 L0
error(0.0002667378157289137966) D12 ^ D10
shift_detectors(0, 0, 1) 0
detector(2, 0, 0) D5
detector(2, 2, 0) D6
detector(2, 4, 0) D7
shift_detectors(0, 0, 1) 0
detector(2, 0, 0) D8
detector(2, 2, 0) D9
detector(2, 4, 0) D10
detector(2, 0, 1) D11
detector(2, 4, 1) D12
```


================================================
FILE: doc/file_format_stim_circuit.md
================================================
# The Stim Circuit File Format (.stim)

A stim circuit file (.stim) is a human-readable specification of an annotated stabilizer circuit.
The circuit file includes gates to apply to qubits,
noise processes to apply during simulations,
and annotations for tasks such as detection event sampling and drawing the circuit.

## Index

- [Encoding](#Encoding)
- [Syntax](#Syntax)
- [Semantics](#Semantics)
    - [Instruction Types](#Instruction-Types)
        - [Supported Gates](gates.md)
    - [Broadcasting](#Broadcasting)
    - [State Space](#State-Space)
    - [Vacuous repeat blocks are not allowed](#Vacuous-repeat-blocks-are-not-allowed)
- [Examples](#Examples)
    - [Teleportation Circuit](#Teleportation-Circuit)
    - [Repetition Code Circuit](#Repetition-Code-Circuit)
    - [Fully Annotated Noisy Repetition Code Circuit](#Fully-Annotated-Noisy-Repetition-Code-Circuit)
    - [Fully Annotated Noisy Surface Code Circuit](#Fully-Annotated-Noisy-Surface-Code-Circuit)


## Encoding

Stim circuit files are always encoded using UTF-8.

(Also, the only place in the file where non-ASCII characters can validly appear is inside of comments and tags.)

## Syntax

A stim circuit file is made up of a series of lines.
Each line is either blank, an instruction, a block initiator, or a block terminator.
Also, each line may be indented with spacing characters and may end with a comment indicated by a hash (`#`).
Comments and indentation are purely decorative; they carry no semantic significance.

Here is a formal definition of the above paragraph.
Entries like `/this/` are regular expressions.
Entries like `<this>` are named expressions.
Entries like `'this'` are literal string expressions.
The `::=` operator means "defined as".
The `|` binary operator means "or".
The `?` suffix operator means "zero-or-one".
The `*` suffix operator means "zero-or-many".
Parens are used to group expressions.
Adjacent expressions are combined by concatenation.

```
<CIRCUIT> ::= <LINE>*
<LINE> ::= <INDENT> (<INSTRUCTION> | <BLOCK_START> | <BLOCK_END>)? <COMMENT>? '\n'
<INDENT> ::= /[ \t]*/
<COMMENT> ::= '#' /[^\n]*/
```

An *instruction* is composed of a name,
then (introduced in stim v1.15) an optional tag inside square brackets,
then an optional comma-separated list of arguments inside of parentheses,
then a list of space-separated targets.
For example, the line `X_ERROR[test](0.1) 5 6` is an instruction with a
name (`X_ERROR`), a tag (`test`), one argument (`0.1`), and two targets
(`5` and `6`).

```
<INSTRUCTION> ::= <NAME> <TAG>? <PARENS_ARGUMENTS>? <TARGETS>
<TAG> ::= '[' /[^\r\]\n]/* ']'
<PARENS_ARGUMENTS> ::= '(' <ARGUMENTS> ')' 
<ARGUMENTS> ::= /[ \t]*/ <ARG> /[ \t]*/ (',' <ARGUMENTS>)?
<TARGETS> ::= /[ \t]+/ <TARG> <TARGETS>?
```

An instruction *name* starts with a letter and then contains a series of letters, digits, and underscores.
Names are case-insensitive.

An instruction *tag* is an arbitrary string enclosed by square brackets.
Certain characters cannot appear directly in the tag, and must instead be included using escape sequences.
The closing square bracket character `]` cannot appear directly, and is instead encoded using the escape sequence `\C`.
The carriage return character cannot appear directly, and is instead encoded using the escape sequence `\r`.
The line feed character cannot appear directly, and is instead encoded using the escape sequence `\n`.
The backslash character `\` cannot appear directly, and is instead encoded using the escape sequence `\B`.
(This backslash escape sequence differs from the common escape sequence `\\` because that sequence causes exponential explosions when escaping multiple times.)

An *argument* is a double precision floating point number.

A *target* can either be a qubit target (a non-negative integer),
a measurement record target (a negative integer prefixed by `rec[` and suffixed by `]`),
a sweep bit target (a non-negative integer prefixed by `sweep[` and suffixed by `]`),
a Pauli target (an integer prefixed by `X`, `Y`, or `Z`),
or a combiner (`*`).
Additionally, qubit targets and Pauli targets may be prefixed by a `!` to indicate that
measurement results should be negated.

```
<NAME> ::= /[a-zA-Z][a-zA-Z0-9_]*/ 
<ARG> ::= <double> 
<TARG> ::= <QUBIT_TARGET> | <MEASUREMENT_RECORD_TARGET> | <SWEEP_BIT_TARGET> | <PAULI_TARGET> | <COMBINER_TARGET> 
<QUBIT_TARGET> ::= '!'? <uint>
<MEASUREMENT_RECORD_TARGET> ::= "rec[-" <uint> "]"
<SWEEP_BIT_TARGET> ::= "sweep[" <uint> "]"
<PAULI_TARGET> ::= '!'? /[XYZ]/ <uint>
<COMBINER_TARGET> ::= '*'
```

A *block initiator* is an instruction suffixed with `{`.
Every block initiator must be followed, eventually, by a matching *block terminator* which is just a `}`.
The `{` always goes in the same line as its instruction, and the `}` always goes on a line by itself.

```
<BLOCK_START> ::= <INSTRUCTION> /[ \t]*/ '{'
<BLOCK_END> ::= '}' 
```

Blocks can be nested.
Block contents are indented by convention, but this is not necessary.

## Semantics

A stim circuit file is executed by executing each of its instructions and blocks, one by one, from start to finish.

### Instruction Types

For a complete list of instructions supported by stim and their individual meanings,
see the [gates reference](gates.md).

Generally speaking, the instructions that can appear in a stim circuit file can be divided up into three groups:

1. Operations
2. Annotations
3. Control Flow

An *operation* is a quantum channel to apply to the quantum state of the system,
possibly resulting in bits being appended to the measurement record.
There are Clifford operations (e.g. the Hadamard gate `H` or the controlled-not gate `CNOT`),
stabilizers operations (e.g. the measurement gate `M` or the reset gate `R`),
and noise operations (e.g. the phase damping channel `Z_ERROR` or the two qubit depolarizing channel `DEPOLARIZE2`).

An *annotation* is a piece of additional information that is not strictly necessary, but which enables other useful capabilities.
The most functionally useful annotations are `DETECTOR` and `OBSERVABLE_INCLUDE`,
which define the measurements that are compared when sampling a circuit's detection events.
Other annotations include `QUBIT_COORDS` and `TICK`, which can be used to hint at the intended spacetime layout of a circuit.

(Depending on your needs, you may also find yourself considering noisy operations to be annotations.
They define a noise model for the circuit.)

*Control flow* blocks make changes to the usual one-after-another execution order of instructions.
Currently, control flow is limited to *repetition*.
A circuit can contain `REPEAT K { ... }` blocks,
which indicate that the block's instructions should be iterated over `K` times instead of just once.

### Tags

Instruction tags have no effect on the function of a circuit.
In general, tools should attempt to propagate tags through circuit transformations and otherwise ignore them.
The intent is that users and tools can use tags to specify custom behavior that stim is not aware of.
For example, consider the tagged instruction `TICK[100ns]`.
In most situations, the `100ns` tag does nothing.
But if you are using a tool that adds noise to circuits, and it's programmed to look at tags to get hints about what
noise to add, then the `100ns` tag could be a message to that tool (specifying a duration, which the tool could use when
computing the probability argument of an inserted `DEPOLARIZE1` instruction).

### Target Types

There are four types of targets that can be given to instructions:
qubit targets, measurement record targets, sweep bit targets, and Pauli targets.

A qubit target refers to a qubit by index.
There's a qubit `0`, a qubit `1`, a qubit `2`, and so forth.
A qubit target may be prefixed by `!`, like `!2`, to mark it as inverted.
Inverted qubit targets are only meaningful for operations that produce measurement results.
They indicate that the recorded measurement result, for the given qubit target, should be inverted.
For example `M 0 !1` measures qubit `0` and qubit `1`, but also inverts the result recorded for qubit `1`.

A measurement record target refers to a recorded measurement result, relative to the current end of the measurement record.
For example, `rec[-1]` is the most recent measurement result, `rec[-2]` is the second most recent, and so forth.
(The semantics of the negative indices into the measurement record match the semantics of negative indices into lists in Python.
The reason negative indices are used is to make it possible to write loops.)
It is an error to refer to a measurement result so far back that it would precede the start of the circuit.

A sweep bit target refers to a column in a data table where each row refers to a separate shots of the circuit, and each column refers to configuration bits that vary from shot to shot.
For example, when using randomized spin echo, the spin echo operations that actually occurred could be recording into a table.
For example, `CNOT sweep[5] 1` says an X operation was applied (or should be applied) to qubit 1 for shots where the sweep bit in the column with index 5 is set.
Sweep bits default to False when running in a context where no table is provided, and sweep bits past the end of the provided table also default to False.

A Pauli target is a qubit target prefixed by a Pauli operation `X`, `Y`, or `Z`.
They are used when specifying Pauli products.
For example, `CORRELATED_ERROR(0.1) X1 Y3 Z2` uses Pauli targets to specify the error that is applied.
Pauli targets may be grouped using combiners (`*`) and may be prefixed by `!` to mark them as inverted.
Inverted Pauli targets are only meaningful for operations that produce measurement results.
They indicate that the recorded measurement result, for the given group of Paulis, should be inverted.
For example `MPP !X1*Z2 Y3` measures the Pauli product `X1*Z2` and inverts the result, then also measures
the Pauli `Y3`.

### Broadcasting

When quantum operations are applied to too many targets, the operation is *broadcast* over the targets.

When a single qubit operation (e.g. `H` or `DEPOLARIZE1`) is given multiple targets,
it is applied to each target in order.
For example, `H 0 1 2` is equivalent to `H 0` then `H 1` then `H 2`.
Similarly, `X_ERROR(0.1) 3 2` is equivalent to `X_ERROR(0.1) 3` then `X_ERROR(0.1) 2`.

When a two qubit operation (e.g. `CNOT` or `DEPOLARIZE2`) is given multiple targets,
it is applied to aligned target pairs in order.
For example, `CNOT 0 1 1 2 2 0` is equivalent to `CNOT 0 1` then `CNOT 1 2` then `CNOT 2 0`.
It is an error to give a two qubit operation an odd number of targets.

### State Space

A simulator executing a stim circuit is expected to store three things:

1. **The Qubits**.
    By convention, all qubits start in the |0> state.
    The simulator then tracks the state of any qubits that have been operated on.
    
    Note that stim circuit files don't explicitly state the number of qubits needed.
    Instead, the number of qubits is implied by the qubit targets present in the file.
    For example, a simulator may look over the circuit and find the largest qubit target `n-1` that is
    operated on and then size itself for operating on `n` qubits.
2. **The Measurement Record**.
    When a measurement operation is performed, the measurement result is appended to a list of bits
    referred to as the measurement record.
    The measurement record is an immutable log of all measurement results so far.
    Controlled operations can use a measurement record target as a control, instead of a qubit target.
    For example, `CZ rec[-1] 5` says "if the most recent measurement result was TRUE then apply a Z
    gate to qubit `5`".
    The measurement record is also used when defining detectors and observables.
3. **The "Correlated Error Occurred" Flag**.
    The `ELSE_CORRELATED_ERROR` instruction applies an error mechanism conditioned on the preceding
    `CORRELATED_ERROR` instruction (and any intermediate `ELSE_CORRELATED_ERROR` instructions)
    having not occurred. This is tracked by a hidden boolean flag. 

(The interpreter of the circuit may also track coordinate offsets accumulated from `SHIFT_COORDS` annotations,
which affect the meaning of `QUBIT_COORDS` annotations and the coordinate arguments given to `DETECTOR`.
But these have no effect on simulations, and so are often not strictly necessary to track.)

### Vacuous repeat blocks are not allowed

It's an error for a circuit to contain a repeat block that is repeated 0 times.

The reason it's an error is because it's ambiguous whether observables and qubits mentioned in the block "exist".
For example, consider this malformed circuit:

```
REPEAT 0 {
    M 0
    OBSERVABLE_INCLUDE(0) rec[-1]
}
```

This circuit mentions a logical observable with index 0, suggesting the circuit has a logical observable.
So, a tool that samples logical observables should produce 1 bit of information when sampling this circuit.
But the logical observable is only mentioned in a block that is never run, effectively commenting it out, leaving behind
an empty circuit with 0 logical observables.
So, a tool that samples logical observables should produce 0 bits of information when sampling this circuit.
Is there an observable in the circuit or isn't there?
Should the tool produce 0 bits or 1 bit?
That's the ambiguity.

Note that a tool that unrolls loops in the circuit will implicitly delete the ambiguous logical observables.
Conversely, note that a tool that finds logical observables by iterating over the lines of the circuit file, looking
for `OBSERVABLE_INCLUDE` instructions, will implicitly keep the ambiguous logical observables.
Both of these methods seem "obviously correct" on their own, but they disagree about whether or not to keep the
ambiguous observables.
It's very easy to write code that accidentally disagrees with itself about the correct behavior, and introduce a bug.
Which is why vacuous repeat blocks are not allowed. 

## Examples

### Teleportation Circuit

[View equivalent circuit in Quirk](https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22X%22%5D%2C%5B1%2C%22H%22%5D%2C%5B1%2C%22Z%5E%C2%BD%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22H%22%5D%2C%5B%22Measure%22%2C%22Measure%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22Z%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C1%2C1%2C1%2C%22X%22%5D%5D%7D)

```
# Distribute a Bell Pair.
H 0
CNOT 0 99

# Sender creates an arbitrary qubit state to send.
H 1
S 1

# Sender performs a Bell Basis measurement.
CNOT 0 1
H 0
M 0 1  # Measure both of the sender's qubits.

# Receiver performs frame corrections based on measurement results.
CZ rec[-2] 99
CNOT rec[-1] 99
```

### Repetition Code Circuit

[View equivalent circuit in Quirk](https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22~ch91%22%2C1%2C%22~ch91%22%2C1%2C%22~ch91%22%5D%2C%5B1%2C%22~tbv6%22%2C1%2C%22~tbv6%22%2C1%2C%22~tbv6%22%5D%2C%5B1%2C%22ZDetectControlReset%22%2C1%2C%22ZDetectControlReset%22%2C1%2C%22ZDetectControlReset%22%5D%2C%5B%22~ch91%22%2C1%2C%22~ch91%22%2C1%2C%22~ch91%22%5D%2C%5B1%2C%22~tbv6%22%2C1%2C%22~tbv6%22%2C1%2C%22~tbv6%22%5D%2C%5B1%2C%22ZDetectControlReset%22%2C1%2C%22ZDetectControlReset%22%2C1%2C%22ZDetectControlReset%22%5D%2C%5B%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B%22~ch91%22%2C1%2C%22~ch91%22%2C1%2C%22~ch91%22%5D%2C%5B1%2C%22~tbv6%22%2C1%2C%22~tbv6%22%2C1%2C%22~tbv6%22%5D%2C%5B1%2C%22ZDetectControlReset%22%2C1%2C%22ZDetectControlReset%22%2C1%2C%22ZDetectControlReset%22%5D%2C%5B%22~ch91%22%2C1%2C%22~ch91%22%2C1%2C%22~ch91%22%5D%2C%5B1%2C%22~tbv6%22%2C1%2C%22~tbv6%22%2C1%2C%22~tbv6%22%5D%2C%5B%22ZDetectControlReset%22%2C%22ZDetectControlReset%22%2C%22ZDetectControlReset%22%2C%22ZDetectControlReset%22%2C%22ZDetectControlReset%22%2C%22ZDetectControlReset%22%2C%22ZDetectControlReset%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~ch91%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22%E2%80%A2%22%2C%22X%22%5D%5D%7D%7D%2C%7B%22id%22%3A%22~tbv6%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22X%22%2C%22%E2%80%A2%22%5D%5D%7D%7D%5D%7D)
(without detector annotations).

```
# Measure the parities of adjacent data qubits.
# Data qubits are 0, 2, 4, 6.
# Measurement qubits are 1, 3, 5.
CNOT 0 1 2 3 4 5
CNOT 2 1 4 3 6 5
MR 1 3 5

# Annotate that the measurements should be deterministic.
DETECTOR rec[-3]
DETECTOR rec[-2]
DETECTOR rec[-1]

# Perform 1000 more rounds of measurements.
REPEAT 1000 {
    # Measure the parities of adjacent data qubits.
    CNOT 0 1 2 3 4 5
    CNOT 2 1 4 3 6 5
    MR 1 3 5

    # Annotate that the measurements should agree with previous round.
    DETECTOR rec[-3] rec[-6]
    DETECTOR rec[-2] rec[-5]
    DETECTOR rec[-1] rec[-4]
}

# Measure data qubits.
M 0 2 4 6

# Annotate that the data measurements should agree with the parity measurements.
DETECTOR rec[-3] rec[-4] rec[-7]
DETECTOR rec[-2] rec[-3] rec[-6]
DETECTOR rec[-1] rec[-2] rec[-5]

# Declare one of the data qubit measurements to a logical measurement result.
OBSERVABLE_INCLUDE(0) rec[-1]
```

### Fully Annotated Noisy Repetition Code Circuit

This is the output from
`stim --gen repetition_code --task memory --rounds 1000 --distance 4 --after_clifford_depolarization 0.001`.
It includes noise operations and annotations for the spacetime layout of the circuit.

```
# Generated repetition_code circuit.
# task: memory
# rounds: 1000
# distance: 3
# before_round_data_depolarization: 0
# before_measure_flip_probability: 0
# after_reset_flip_probability: 0
# after_clifford_depolarization: 0.001
# layout:
# L0 Z1 d2 Z3 d4 Z5 d6
# Legend:
#     d# = data qubit
#     L# = data qubit with logical observable crossing
#     Z# = measurement qubit
R 0 1 2 3 4 5 6
TICK
CX 0 1 2 3 4 5
DEPOLARIZE2(0.001) 0 1 2 3 4 5
TICK
CX 2 1 4 3 6 5
DEPOLARIZE2(0.001) 2 1 4 3 6 5
TICK
MR 1 3 5
DETECTOR(1, 0) rec[-3]
DETECTOR(3, 0) rec[-2]
DETECTOR(5, 0) rec[-1]
REPEAT 999 {
    TICK
    CX 0 1 2 3 4 5
    DEPOLARIZE2(0.001) 0 1 2 3 4 5
    TICK
    CX 2 1 4 3 6 5
    DEPOLARIZE2(0.001) 2 1 4 3 6 5
    TICK
    MR 1 3 5
    SHIFT_COORDS(0, 1)
    DETECTOR(1, 0) rec[-3] rec[-6]
    DETECTOR(3, 0) rec[-2] rec[-5]
    DETECTOR(5, 0) rec[-1] rec[-4]
}
M 0 2 4 6
DETECTOR(1, 1) rec[-3] rec[-4] rec[-7]
DETECTOR(3, 1) rec[-2] rec[-3] rec[-6]
DETECTOR(5, 1) rec[-1] rec[-2] rec[-5]
OBSERVABLE_INCLUDE(0) rec[-1]
```

### Fully Annotated Noisy Surface Code Circuit

This is the output from
`stim --gen surface_code --task rotated_memory_x --rounds 1000 --distance 3 --after_clifford_depolarization 0.001`.
It includes noise operations and annotations for the spacetime layout of the circuit.

```
# Generated surface_code circuit.
# task: rotated_memory_x
# rounds: 1000
# distance: 3
# before_round_data_depolarization: 0
# before_measure_flip_probability: 0
# after_reset_flip_probability: 0
# after_clifford_depolarization: 0.001
# layout:
#                 X25
#     L15     d17     d19
# Z14     X16     Z18
#     L8      d10     d12
#         Z9      X11     Z13
#     L1      d3      d5 
#         X2 
# Legend:
#     d# = data qubit
#     L# = data qubit with logical observable crossing
#     X# = measurement qubit (X stabilizer)
#     Z# = measurement qubit (Z stabilizer)
QUBIT_COORDS(1, 1) 1
QUBIT_COORDS(2, 0) 2
QUBIT_COORDS(3, 1) 3
QUBIT_COORDS(5, 1) 5
QUBIT_COORDS(1, 3) 8
QUBIT_COORDS(2, 2) 9
QUBIT_COORDS(3, 3) 10
QUBIT_COORDS(4, 2) 11
QUBIT_COORDS(5, 3) 12
QUBIT_COORDS(6, 2) 13
QUBIT_COORDS(0, 4) 14
QUBIT_COORDS(1, 5) 15
QUBIT_COORDS(2, 4) 16
QUBIT_COORDS(3, 5) 17
QUBIT_COORDS(4, 4) 18
QUBIT_COORDS(5, 5) 19
QUBIT_COORDS(4, 6) 25
RX 1 3 5 8 10 12 15 17 19
R 2 9 11 13 14 16 18 25
TICK
H 2 11 16 25
DEPOLARIZE1(0.001) 2 11 16 25
TICK
CX 2 3 16 17 11 12 15 14 10 9 19 18
DEPOLARIZE2(0.001) 2 3 16 17 11 12 15 14 10 9 19 18
TICK
CX 2 1 16 15 11 10 8 14 3 9 12 18
DEPOLARIZE2(0.001) 2 1 16 15 11 10 8 14 3 9 12 18
TICK
CX 16 10 11 5 25 19 8 9 17 18 12 13
DEPOLARIZE2(0.001) 16 10 11 5 25 19 8 9 17 18 12 13
TICK
CX 16 8 11 3 25 17 1 9 10 18 5 13
DEPOLARIZE2(0.001) 16 8 11 3 25 17 1 9 10 18 5 13
TICK
H 2 11 16 25
DEPOLARIZE1(0.001) 2 11 16 25
TICK
MR 2 9 11 13 14 16 18 25
DETECTOR(2, 0, 0) rec[-8]
DETECTOR(2, 4, 0) rec[-3]
DETECTOR(4, 2, 0) rec[-6]
DETECTOR(4, 6, 0) rec[-1]
REPEAT 999 {
    TICK
    H 2 11 16 25
    DEPOLARIZE1(0.001) 2 11 16 25
    TICK
    CX 2 3 16 17 11 12 15 14 10 9 19 18
    DEPOLARIZE2(0.001) 2 3 16 17 11 12 15 14 10 9 19 18
    TICK
    CX 2 1 16 15 11 10 8 14 3 9 12 18
    DEPOLARIZE2(0.001) 2 1 16 15 11 10 8 14 3 9 12 18
    TICK
    CX 16 10 11 5 25 19 8 9 17 18 12 13
    DEPOLARIZE2(0.001) 16 10 11 5 25 19 8 9 17 18 12 13
    TICK
    CX 16 8 11 3 25 17 1 9 10 18 5 13
    DEPOLARIZE2(0.001) 16 8 11 3 25 17 1 9 10 18 5 13
    TICK
    H 2 11 16 25
    DEPOLARIZE1(0.001) 2 11 16 25
    TICK
    MR 2 9 11 13 14 16 18 25
    SHIFT_COORDS(0, 0, 1)
    DETECTOR(2, 0, 0) rec[-8] rec[-16]
    DETECTOR(2, 2, 0) rec[-7] rec[-15]
    DETECTOR(4, 2, 0) rec[-6] rec[-14]
    DETECTOR(6, 2, 0) rec[-5] rec[-13]
    DETECTOR(0, 4, 0) rec[-4] rec[-12]
    DETECTOR(2, 4, 0) rec[-3] rec[-11]
    DETECTOR(4, 4, 0) rec[-2] rec[-10]
    DETECTOR(4, 6, 0) rec[-1] rec[-9]
}
MX 1 3 5 8 10 12 15 17 19
DETECTOR(2, 0, 1) rec[-8] rec[-9] rec[-17]
DETECTOR(2, 4, 1) rec[-2] rec[-3] rec[-5] rec[-6] rec[-12]
DETECTOR(4, 2, 1) rec[-4] rec[-5] rec[-7] rec[-8] rec[-15]
DETECTOR(4, 6, 1) rec[-1] rec[-2] rec[-10]
OBSERVABLE_INCLUDE(0) rec[-3] rec[-6] rec[-9]
```


================================================
FILE: doc/gates.md
================================================
# Gates supported by Stim

- Pauli Gates
    - [I](#I)
    - [X](#X)
    - [Y](#Y)
    - [Z](#Z)
- Single Qubit Clifford Gates
    - [C_NXYZ](#C_NXYZ)
    - [C_NZYX](#C_NZYX)
    - [C_XNYZ](#C_XNYZ)
    - [C_XYNZ](#C_XYNZ)
    - [C_XYZ](#C_XYZ)
    - [C_ZNYX](#C_ZNYX)
    - [C_ZYNX](#C_ZYNX)
    - [C_ZYX](#C_ZYX)
    - [H](#H)
    - [H_NXY](#H_NXY)
    - [H_NXZ](#H_NXZ)
    - [H_NYZ](#H_NYZ)
    - [H_XY](#H_XY)
    - [H_XZ](#H_XZ)
    - [H_YZ](#H_YZ)
    - [S](#S)
    - [SQRT_X](#SQRT_X)
    - [SQRT_X_DAG](#SQRT_X_DAG)
    - [SQRT_Y](#SQRT_Y)
    - [SQRT_Y_DAG](#SQRT_Y_DAG)
    - [SQRT_Z](#SQRT_Z)
    - [SQRT_Z_DAG](#SQRT_Z_DAG)
    - [S_DAG](#S_DAG)
- Two Qubit Clifford Gates
    - [CNOT](#CNOT)
    - [CX](#CX)
    - [CXSWAP](#CXSWAP)
    - [CY](#CY)
    - [CZ](#CZ)
    - [CZSWAP](#CZSWAP)
    - [II](#II)
    - [ISWAP](#ISWAP)
    - [ISWAP_DAG](#ISWAP_DAG)
    - [SQRT_XX](#SQRT_XX)
    - [SQRT_XX_DAG](#SQRT_XX_DAG)
    - [SQRT_YY](#SQRT_YY)
    - [SQRT_YY_DAG](#SQRT_YY_DAG)
    - [SQRT_ZZ](#SQRT_ZZ)
    - [SQRT_ZZ_DAG](#SQRT_ZZ_DAG)
    - [SWAP](#SWAP)
    - [SWAPCX](#SWAPCX)
    - [SWAPCZ](#SWAPCZ)
    - [XCX](#XCX)
    - [XCY](#XCY)
    - [XCZ](#XCZ)
    - [YCX](#YCX)
    - [YCY](#YCY)
    - [YCZ](#YCZ)
    - [ZCX](#ZCX)
    - [ZCY](#ZCY)
    - [ZCZ](#ZCZ)
- Noise Channels
    - [CORRELATED_ERROR](#CORRELATED_ERROR)
    - [DEPOLARIZE1](#DEPOLARIZE1)
    - [DEPOLARIZE2](#DEPOLARIZE2)
    - [E](#E)
    - [ELSE_CORRELATED_ERROR](#ELSE_CORRELATED_ERROR)
    - [HERALDED_ERASE](#HERALDED_ERASE)
    - [HERALDED_PAULI_CHANNEL_1](#HERALDED_PAULI_CHANNEL_1)
    - [II_ERROR](#II_ERROR)
    - [I_ERROR](#I_ERROR)
    - [PAULI_CHANNEL_1](#PAULI_CHANNEL_1)
    - [PAULI_CHANNEL_2](#PAULI_CHANNEL_2)
    - [X_ERROR](#X_ERROR)
    - [Y_ERROR](#Y_ERROR)
    - [Z_ERROR](#Z_ERROR)
- Collapsing Gates
    - [M](#M)
    - [MR](#MR)
    - [MRX](#MRX)
    - [MRY](#MRY)
    - [MRZ](#MRZ)
    - [MX](#MX)
    - [MY](#MY)
    - [MZ](#MZ)
    - [R](#R)
    - [RX](#RX)
    - [RY](#RY)
    - [RZ](#RZ)
- Pair Measurement Gates
    - [MXX](#MXX)
    - [MYY](#MYY)
    - [MZZ](#MZZ)
- Generalized Pauli Product Gates
    - [MPP](#MPP)
    - [SPP](#SPP)
    - [SPP_DAG](#SPP_DAG)
- Control Flow
    - [REPEAT](#REPEAT)
- Annotations
    - [DETECTOR](#DETECTOR)
    - [MPAD](#MPAD)
    - [OBSERVABLE_INCLUDE](#OBSERVABLE_INCLUDE)
    - [QUBIT_COORDS](#QUBIT_COORDS)
    - [SHIFT_COORDS](#SHIFT_COORDS)
    - [TICK](#TICK)

## Pauli Gates

<a name="I"></a>
### The 'I' Gate

The identity gate.
Does nothing to the target qubits.

Parens Arguments:

    This instruction takes no parens arguments.

Targets:

    Qubits to do nothing to.

Example:

    I 5
    I 42
    I 5 42
    
Stabilizer Generators:

    X -> X
    Z -> Z
    
Bloch Rotation (axis angle):

    Axis: +X
    Angle: 0°
    
Bloch Rotation (Euler angles):

      theta = 0°
        phi = 0°
     lambda = 0°
    unitary = RotZ(phi) * RotY(theta) * RotZ(lambda)
    unitary = RotZ(0°) * RotY(0°) * RotZ(0°)
    unitary = I * I * I

Unitary Matrix:

    [+1  ,     ]
    [    , +1  ]
    
Decomposition (into H, S, CX, M, R):

    # The following circuit is equivalent (up to global phase) to `I 0`
    # (no operations)
    
    # (The decomposition is empty because this gate has no effect.)
    
MBQC Decomposition (into MX, MY, MZ, MXX, MZZ, and Pauli feedback):

    # The following circuit performs `I 0` (but affects the measurement record and an ancilla qubit)
                
    # (The decomposition is empty because this gate has no effect.)
    

<a name="X"></a>
### The 'X' Gate

The Pauli X gate.
The bit flip gate.

Parens Arguments:

    This instruction takes no parens arguments.

Targets:

    Qubits to operate on.

Example:

    X 5
    X 42
    X 5 42
    
Stabilizer Generators:

    X -> X
    Z -> -Z
    
Bloch Rotation (axis angle):

    Axis: +X
    Angle: 180°
    
Bloch Rotation (Euler angles):

      theta = 180°
        phi = 0°
     lambda = 180°
    unitary = RotZ(phi) * RotY(theta) * RotZ(lambda)
    unitary = RotZ(0°) * RotY(180°) * RotZ(180°)
    unitary = I * Y * Z

Unitary Matrix:

    [    , +1  ]
    [+1  ,     ]
    
Decomposition (into H, S, CX, M, R):

    # The following circuit is equivalent
Download .txt
gitextract_cojjamez/

├── .bazelrc
├── .bazelversion
├── .clang-format
├── .editorconfig
├── .github/
│   ├── SECURITY.md
│   └── workflows/
│       └── ci.yml
├── .gitignore
├── .markdownlintrc
├── BUILD
├── CITATION.cff
├── CMakeLists.txt
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── MANIFEST.in
├── MODULE.bazel
├── README.md
├── SUPPORT.md
├── WORKSPACE
├── dev/
│   ├── canvas_with_texture_for_3d_diagrams.html
│   ├── clean_build_files.sh
│   ├── compile_crumble_into_cpp_string_file.sh
│   ├── compile_crumble_into_single_html_page.sh
│   ├── doctest_proper.py
│   ├── gen_known_gates_for_js.sh
│   ├── gen_sinter_api_reference.py
│   ├── gen_stim_api_reference.py
│   ├── gen_stim_stub_file.py
│   ├── make_logo.html
│   ├── overwrite_dev_versions_with_date.py
│   ├── regen_crumble_cpp_resource.sh
│   ├── regen_docs.sh
│   ├── regen_file_lists.sh
│   ├── regen_texture_to_cpp_base64_string.sh
│   └── util_gen_stub_file.py
├── doc/
│   ├── circuit_data_references.md
│   ├── developer_documentation.md
│   ├── file_format_dem_detector_error_model.md
│   ├── file_format_stim_circuit.md
│   ├── gates.md
│   ├── getting_started.ipynb
│   ├── python_api_reference_vDev.md
│   ├── result_formats.md
│   ├── sinter_api.md
│   ├── sinter_command_line.md
│   ├── stim.pyi
│   └── usage_command_line.md
├── file_lists/
│   ├── perf_files
│   ├── pybind_files
│   ├── source_files_no_main
│   └── test_files
├── glue/
│   ├── cirq/
│   │   ├── README.md
│   │   ├── setup.py
│   │   └── stimcirq/
│   │       ├── __init__.py
│   │       ├── _cirq_to_stim.py
│   │       ├── _cirq_to_stim_test.py
│   │       ├── _cx_swap_gate.py
│   │       ├── _cx_swap_test.py
│   │       ├── _cz_swap_gate.py
│   │       ├── _cz_swap_test.py
│   │       ├── _det_annotation.py
│   │       ├── _det_annotation_test.py
│   │       ├── _i_error_gate.py
│   │       ├── _i_error_gate_test.py
│   │       ├── _ii_error_gate.py
│   │       ├── _ii_error_gate_test.py
│   │       ├── _ii_gate.py
│   │       ├── _ii_gate_test.py
│   │       ├── _measure_and_or_reset_gate.py
│   │       ├── _measure_and_or_reset_gate_test.py
│   │       ├── _obs_annotation.py
│   │       ├── _obs_annotation_test.py
│   │       ├── _shift_coords_annotation.py
│   │       ├── _shift_coords_annotation_test.py
│   │       ├── _stim_sampler.py
│   │       ├── _stim_sampler_test.py
│   │       ├── _stim_to_cirq.py
│   │       ├── _stim_to_cirq_test.py
│   │       ├── _sweep_pauli.py
│   │       ├── _sweep_pauli_test.py
│   │       ├── _two_qubit_asymmetric_depolarize.py
│   │       └── _two_qubit_asymmetric_depolarize_test.py
│   ├── crumble/
│   │   ├── README.md
│   │   ├── base/
│   │   │   ├── cooldown_throttle.js
│   │   │   ├── describe.js
│   │   │   ├── describe.test.js
│   │   │   ├── equate.js
│   │   │   ├── equate.test.js
│   │   │   ├── history_pusher.js
│   │   │   ├── obs.js
│   │   │   ├── obs.test.js
│   │   │   ├── revision.js
│   │   │   ├── revision.test.js
│   │   │   ├── seq.js
│   │   │   └── seq.test.js
│   │   ├── circuit/
│   │   │   ├── circuit.js
│   │   │   ├── circuit.test.js
│   │   │   ├── layer.js
│   │   │   ├── layer.test.js
│   │   │   ├── operation.js
│   │   │   ├── pauli_frame.js
│   │   │   ├── pauli_frame.test.js
│   │   │   ├── propagated_pauli_frames.js
│   │   │   └── propagated_pauli_frames.test.js
│   │   ├── crumble.html
│   │   ├── draw/
│   │   │   ├── config.js
│   │   │   ├── draw_util.js
│   │   │   ├── main_draw.js
│   │   │   ├── main_draw.test.js
│   │   │   ├── state_snapshot.js
│   │   │   └── timeline_viewer.js
│   │   ├── editor/
│   │   │   ├── editor_state.js
│   │   │   ├── editor_state.test.js
│   │   │   └── sync_url_to_state.js
│   │   ├── gates/
│   │   │   ├── gate.js
│   │   │   ├── gate_draw_util.js
│   │   │   ├── gateset.js
│   │   │   ├── gateset.test.js
│   │   │   ├── gateset_controlled_paulis.js
│   │   │   ├── gateset_demolition_measurements.js
│   │   │   ├── gateset_hadamard_likes.js
│   │   │   ├── gateset_markers.js
│   │   │   ├── gateset_mpp.js
│   │   │   ├── gateset_pair_measurements.js
│   │   │   ├── gateset_paulis.js
│   │   │   ├── gateset_quarter_turns.js
│   │   │   ├── gateset_resets.js
│   │   │   ├── gateset_solo_measurements.js
│   │   │   ├── gateset_sqrt_pauli_pairs.js
│   │   │   ├── gateset_swaps.js
│   │   │   └── gateset_third_turns.js
│   │   ├── keyboard/
│   │   │   ├── chord.js
│   │   │   ├── chord.test.js
│   │   │   └── toolbox.js
│   │   ├── main.js
│   │   ├── package.json
│   │   ├── run_tests_headless.js
│   │   └── test/
│   │       ├── generated_gate_name_list.test.js
│   │       ├── test.html
│   │       ├── test_import_all.js
│   │       ├── test_main.js
│   │       ├── test_util.js
│   │       └── test_util.test.js
│   ├── javascript/
│   │   ├── README.md
│   │   ├── build_wasm.sh
│   │   ├── circuit.js.cc
│   │   ├── circuit.js.h
│   │   ├── circuit.test.js
│   │   ├── common.js.cc
│   │   ├── common.js.h
│   │   ├── pauli_string.js.cc
│   │   ├── pauli_string.js.h
│   │   ├── pauli_string.test.js
│   │   ├── stim.js.cc
│   │   ├── stim.test_harness.js
│   │   ├── tableau.js.cc
│   │   ├── tableau.js.h
│   │   ├── tableau.test.js
│   │   ├── tableau_simulator.js.cc
│   │   ├── tableau_simulator.js.h
│   │   └── tableau_simulator.test.js
│   ├── lattice_surgery/
│   │   ├── README.md
│   │   ├── docs/
│   │   │   └── demo.ipynb
│   │   ├── lassynth/
│   │   │   ├── __init__.py
│   │   │   ├── lattice_surgery_synthesis.py
│   │   │   ├── rewrite_passes/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── attach_fixups.py
│   │   │   │   ├── color_z.py
│   │   │   │   └── remove_unconnected.py
│   │   │   ├── sat_synthesis/
│   │   │   │   ├── __init__.py
│   │   │   │   └── lattice_surgery_sat.py
│   │   │   ├── tools/
│   │   │   │   ├── __init__.py
│   │   │   │   └── verify_stabilizers.py
│   │   │   └── translators/
│   │   │       ├── __init__.py
│   │   │       ├── gltf_generator.py
│   │   │       ├── networkx_generator.py
│   │   │       ├── textfig_generator.py
│   │   │       └── zx_grid_graph.py
│   │   ├── setup.py
│   │   └── stimzx/
│   │       ├── __init__.py
│   │       ├── _external_stabilizer.py
│   │       ├── _external_stabilizer_test.py
│   │       ├── _text_diagram_parsing.py
│   │       ├── _text_diagram_parsing_test.py
│   │       ├── _zx_graph_solver.py
│   │       └── _zx_graph_solver_test.py
│   ├── python/
│   │   ├── README.md
│   │   └── src/
│   │       └── stim/
│   │           ├── __init__.py
│   │           ├── __init__.pyi
│   │           └── _main_argv.py
│   ├── sample/
│   │   ├── MANIFEST.in
│   │   ├── README.md
│   │   ├── requirements.txt
│   │   ├── setup.py
│   │   └── src/
│   │       └── sinter/
│   │           ├── __init__.py
│   │           ├── _collection/
│   │           │   ├── __init__.py
│   │           │   ├── _collection.py
│   │           │   ├── _collection_manager.py
│   │           │   ├── _collection_manager_test.py
│   │           │   ├── _collection_test.py
│   │           │   ├── _collection_worker_loop.py
│   │           │   ├── _collection_worker_state.py
│   │           │   ├── _collection_worker_test.py
│   │           │   ├── _mux_sampler.py
│   │           │   ├── _printer.py
│   │           │   ├── _sampler_ramp_throttled.py
│   │           │   └── _sampler_ramp_throttled_test.py
│   │           ├── _command/
│   │           │   ├── __init__.py
│   │           │   ├── _main.py
│   │           │   ├── _main_collect.py
│   │           │   ├── _main_collect_test.py
│   │           │   ├── _main_combine.py
│   │           │   ├── _main_combine_test.py
│   │           │   ├── _main_plot.py
│   │           │   ├── _main_plot_test.py
│   │           │   ├── _main_predict.py
│   │           │   └── _main_predict_test.py
│   │           ├── _data/
│   │           │   ├── __init__.py
│   │           │   ├── _anon_task_stats.py
│   │           │   ├── _anon_task_stats_test.py
│   │           │   ├── _collection_options.py
│   │           │   ├── _collection_options_test.py
│   │           │   ├── _csv_out.py
│   │           │   ├── _existing_data.py
│   │           │   ├── _existing_data_test.py
│   │           │   ├── _task.py
│   │           │   ├── _task_stats.py
│   │           │   ├── _task_stats_test.py
│   │           │   └── _task_test.py
│   │           ├── _decoding/
│   │           │   ├── __init__.py
│   │           │   ├── _decoding.py
│   │           │   ├── _decoding_all_built_in_decoders.py
│   │           │   ├── _decoding_decoder_class.py
│   │           │   ├── _decoding_fusion_blossom.py
│   │           │   ├── _decoding_mwpf.py
│   │           │   ├── _decoding_pymatching.py
│   │           │   ├── _decoding_test.py
│   │           │   ├── _decoding_vacuous.py
│   │           │   ├── _perfectionist_sampler.py
│   │           │   ├── _sampler.py
│   │           │   ├── _stim_then_decode_sampler.py
│   │           │   └── _stim_then_decode_sampler_test.py
│   │           ├── _plotting.py
│   │           ├── _plotting_test.py
│   │           ├── _predict.py
│   │           ├── _predict_test.py
│   │           ├── _probability_util.py
│   │           └── _probability_util_test.py
│   └── zx/
│       ├── README.md
│       ├── setup.py
│       └── stimzx/
│           ├── __init__.py
│           ├── _external_stabilizer.py
│           ├── _external_stabilizer_test.py
│           ├── _text_diagram_parsing.py
│           ├── _text_diagram_parsing_test.py
│           ├── _zx_graph_solver.py
│           └── _zx_graph_solver_test.py
├── package.json
├── puppeteer_run_tests.js
├── pyproject.toml
├── setup.py
├── src/
│   ├── main.cc
│   ├── stim/
│   │   ├── circuit/
│   │   │   ├── circuit.cc
│   │   │   ├── circuit.h
│   │   │   ├── circuit.perf.cc
│   │   │   ├── circuit.pybind.cc
│   │   │   ├── circuit.pybind.h
│   │   │   ├── circuit.test.cc
│   │   │   ├── circuit.test.h
│   │   │   ├── circuit2.pybind.cc
│   │   │   ├── circuit_instruction.cc
│   │   │   ├── circuit_instruction.h
│   │   │   ├── circuit_instruction.pybind.cc
│   │   │   ├── circuit_instruction.pybind.h
│   │   │   ├── circuit_instruction.test.cc
│   │   │   ├── circuit_instruction_pybind_test.py
│   │   │   ├── circuit_pybind_test.py
│   │   │   ├── circuit_repeat_block.pybind.cc
│   │   │   ├── circuit_repeat_block.pybind.h
│   │   │   ├── circuit_repeat_block_test.py
│   │   │   ├── gate_decomposition.cc
│   │   │   ├── gate_decomposition.h
│   │   │   ├── gate_decomposition.test.cc
│   │   │   ├── gate_target.cc
│   │   │   ├── gate_target.h
│   │   │   ├── gate_target.pybind.cc
│   │   │   ├── gate_target.pybind.h
│   │   │   ├── gate_target.test.cc
│   │   │   └── gate_target_pybind_test.py
│   │   ├── cmd/
│   │   │   ├── command_analyze_errors.cc
│   │   │   ├── command_analyze_errors.h
│   │   │   ├── command_analyze_errors.test.cc
│   │   │   ├── command_convert.cc
│   │   │   ├── command_convert.h
│   │   │   ├── command_convert.test.cc
│   │   │   ├── command_detect.cc
│   │   │   ├── command_detect.h
│   │   │   ├── command_detect.test.cc
│   │   │   ├── command_diagram.cc
│   │   │   ├── command_diagram.h
│   │   │   ├── command_diagram.pybind.cc
│   │   │   ├── command_diagram.pybind.h
│   │   │   ├── command_diagram.test.cc
│   │   │   ├── command_explain_errors.cc
│   │   │   ├── command_explain_errors.h
│   │   │   ├── command_explain_errors.test.cc
│   │   │   ├── command_gen.cc
│   │   │   ├── command_gen.h
│   │   │   ├── command_gen.test.cc
│   │   │   ├── command_help.cc
│   │   │   ├── command_help.h
│   │   │   ├── command_m2d.cc
│   │   │   ├── command_m2d.h
│   │   │   ├── command_m2d.test.cc
│   │   │   ├── command_repl.cc
│   │   │   ├── command_repl.h
│   │   │   ├── command_sample.cc
│   │   │   ├── command_sample.h
│   │   │   ├── command_sample.test.cc
│   │   │   ├── command_sample_dem.cc
│   │   │   ├── command_sample_dem.h
│   │   │   └── command_sample_dem.test.cc
│   │   ├── dem/
│   │   │   ├── dem_instruction.cc
│   │   │   ├── dem_instruction.h
│   │   │   ├── dem_instruction.pybind.cc
│   │   │   ├── dem_instruction.pybind.h
│   │   │   ├── dem_instruction.test.cc
│   │   │   ├── dem_instruction_pybind_test.py
│   │   │   ├── detector_error_model.cc
│   │   │   ├── detector_error_model.h
│   │   │   ├── detector_error_model.pybind.cc
│   │   │   ├── detector_error_model.pybind.h
│   │   │   ├── detector_error_model.test.cc
│   │   │   ├── detector_error_model_pybind_test.py
│   │   │   ├── detector_error_model_repeat_block.pybind.cc
│   │   │   ├── detector_error_model_repeat_block.pybind.h
│   │   │   ├── detector_error_model_repeat_block_pybind_test.py
│   │   │   ├── detector_error_model_target.pybind.cc
│   │   │   ├── detector_error_model_target.pybind.h
│   │   │   └── detector_error_model_target_pybind_test.py
│   │   ├── diagram/
│   │   │   ├── ascii_diagram.cc
│   │   │   ├── ascii_diagram.h
│   │   │   ├── ascii_diagram.test.cc
│   │   │   ├── base64.cc
│   │   │   ├── base64.h
│   │   │   ├── base64.test.cc
│   │   │   ├── basic_3d_diagram.cc
│   │   │   ├── basic_3d_diagram.h
│   │   │   ├── circuit_timeline_helper.cc
│   │   │   ├── circuit_timeline_helper.h
│   │   │   ├── coord.h
│   │   │   ├── coord.test.cc
│   │   │   ├── crumble.cc
│   │   │   ├── crumble.h
│   │   │   ├── crumble_data.cc
│   │   │   ├── crumble_data.h
│   │   │   ├── detector_slice/
│   │   │   │   ├── detector_slice_set.cc
│   │   │   │   ├── detector_slice_set.h
│   │   │   │   └── detector_slice_set.test.cc
│   │   │   ├── diagram_util.cc
│   │   │   ├── diagram_util.h
│   │   │   ├── gate_data_3d.cc
│   │   │   ├── gate_data_3d.h
│   │   │   ├── gate_data_3d_texture_data.cc
│   │   │   ├── gate_data_3d_texture_data.h
│   │   │   ├── gate_data_svg.cc
│   │   │   ├── gate_data_svg.h
│   │   │   ├── gltf.cc
│   │   │   ├── gltf.h
│   │   │   ├── graph/
│   │   │   │   ├── match_graph_3d_drawer.cc
│   │   │   │   ├── match_graph_3d_drawer.h
│   │   │   │   ├── match_graph_3d_drawer.test.cc
│   │   │   │   ├── match_graph_svg_drawer.cc
│   │   │   │   ├── match_graph_svg_drawer.h
│   │   │   │   └── match_graph_svg_drawer.test.cc
│   │   │   ├── json_obj.cc
│   │   │   ├── json_obj.h
│   │   │   ├── json_obj.test.cc
│   │   │   ├── lattice_map.cc
│   │   │   ├── lattice_map.h
│   │   │   └── timeline/
│   │   │       ├── timeline_3d_drawer.cc
│   │   │       ├── timeline_3d_drawer.h
│   │   │       ├── timeline_3d_drawer.test.cc
│   │   │       ├── timeline_ascii_drawer.cc
│   │   │       ├── timeline_ascii_drawer.h
│   │   │       ├── timeline_ascii_drawer.test.cc
│   │   │       ├── timeline_svg_drawer.cc
│   │   │       ├── timeline_svg_drawer.h
│   │   │       └── timeline_svg_drawer.test.cc
│   │   ├── gates/
│   │   │   ├── gate_data_annotations.cc
│   │   │   ├── gate_data_blocks.cc
│   │   │   ├── gate_data_collapsing.cc
│   │   │   ├── gate_data_controlled.cc
│   │   │   ├── gate_data_hada.cc
│   │   │   ├── gate_data_heralded.cc
│   │   │   ├── gate_data_noisy.cc
│   │   │   ├── gate_data_pair_measure.cc
│   │   │   ├── gate_data_pauli.cc
│   │   │   ├── gate_data_pauli_product.cc
│   │   │   ├── gate_data_period_3.cc
│   │   │   ├── gate_data_period_4.cc
│   │   │   ├── gate_data_pp.cc
│   │   │   ├── gate_data_swaps.cc
│   │   │   ├── gates.cc
│   │   │   ├── gates.h
│   │   │   ├── gates.perf.cc
│   │   │   ├── gates.pybind.cc
│   │   │   ├── gates.pybind.h
│   │   │   ├── gates.test.cc
│   │   │   └── gates_test.py
│   │   ├── gen/
│   │   │   ├── circuit_gen_params.cc
│   │   │   ├── circuit_gen_params.h
│   │   │   ├── circuit_gen_params.test.cc
│   │   │   ├── gen_color_code.cc
│   │   │   ├── gen_color_code.h
│   │   │   ├── gen_color_code.test.cc
│   │   │   ├── gen_rep_code.cc
│   │   │   ├── gen_rep_code.h
│   │   │   ├── gen_rep_code.test.cc
│   │   │   ├── gen_surface_code.cc
│   │   │   ├── gen_surface_code.h
│   │   │   └── gen_surface_code.test.cc
│   │   ├── io/
│   │   │   ├── README.md
│   │   │   ├── measure_record.cc
│   │   │   ├── measure_record.h
│   │   │   ├── measure_record.test.cc
│   │   │   ├── measure_record_batch.h
│   │   │   ├── measure_record_batch.inl
│   │   │   ├── measure_record_batch.test.cc
│   │   │   ├── measure_record_batch_writer.cc
│   │   │   ├── measure_record_batch_writer.h
│   │   │   ├── measure_record_batch_writer.test.cc
│   │   │   ├── measure_record_reader.h
│   │   │   ├── measure_record_reader.inl
│   │   │   ├── measure_record_reader.perf.cc
│   │   │   ├── measure_record_reader.test.cc
│   │   │   ├── measure_record_writer.cc
│   │   │   ├── measure_record_writer.h
│   │   │   ├── measure_record_writer.test.cc
│   │   │   ├── raii_file.cc
│   │   │   ├── raii_file.h
│   │   │   ├── read_write.pybind.cc
│   │   │   ├── read_write.pybind.h
│   │   │   ├── read_write_pytest.py
│   │   │   ├── sparse_shot.cc
│   │   │   ├── sparse_shot.h
│   │   │   ├── sparse_shot.test.cc
│   │   │   ├── stim_data_formats.cc
│   │   │   └── stim_data_formats.h
│   │   ├── main.perf.cc
│   │   ├── main_namespaced.cc
│   │   ├── main_namespaced.h
│   │   ├── main_namespaced.perf.cc
│   │   ├── main_namespaced.test.cc
│   │   ├── main_namespaced.test.h
│   │   ├── mem/
│   │   │   ├── README.md
│   │   │   ├── bit_ref.cc
│   │   │   ├── bit_ref.h
│   │   │   ├── bit_ref.test.cc
│   │   │   ├── bitword.h
│   │   │   ├── bitword_128_sse.h
│   │   │   ├── bitword_256_avx.h
│   │   │   ├── bitword_64.h
│   │   │   ├── fixed_cap_vector.h
│   │   │   ├── fixed_cap_vector.test.cc
│   │   │   ├── monotonic_buffer.h
│   │   │   ├── monotonic_buffer.test.cc
│   │   │   ├── simd_bit_table.h
│   │   │   ├── simd_bit_table.inl
│   │   │   ├── simd_bit_table.perf.cc
│   │   │   ├── simd_bit_table.test.cc
│   │   │   ├── simd_bits.h
│   │   │   ├── simd_bits.inl
│   │   │   ├── simd_bits.perf.cc
│   │   │   ├── simd_bits.test.cc
│   │   │   ├── simd_bits_range_ref.h
│   │   │   ├── simd_bits_range_ref.inl
│   │   │   ├── simd_bits_range_ref.test.cc
│   │   │   ├── simd_util.cc
│   │   │   ├── simd_util.h
│   │   │   ├── simd_util.test.cc
│   │   │   ├── simd_word.cc
│   │   │   ├── simd_word.h
│   │   │   ├── simd_word.perf.cc
│   │   │   ├── simd_word.test.cc
│   │   │   ├── simd_word.test.h
│   │   │   ├── span_ref.h
│   │   │   ├── sparse_xor_vec.cc
│   │   │   ├── sparse_xor_vec.h
│   │   │   ├── sparse_xor_vec.perf.cc
│   │   │   └── sparse_xor_vec.test.cc
│   │   ├── perf.perf.h
│   │   ├── py/
│   │   │   ├── README.md
│   │   │   ├── base.pybind.cc
│   │   │   ├── base.pybind.h
│   │   │   ├── compiled_detector_sampler.pybind.cc
│   │   │   ├── compiled_detector_sampler.pybind.h
│   │   │   ├── compiled_detector_sampler_pybind_test.py
│   │   │   ├── compiled_measurement_sampler.pybind.cc
│   │   │   ├── compiled_measurement_sampler.pybind.h
│   │   │   ├── compiled_measurement_sampler_pybind_test.py
│   │   │   ├── march.pybind.cc
│   │   │   ├── march.pybind.h
│   │   │   ├── numpy.pybind.cc
│   │   │   ├── numpy.pybind.h
│   │   │   ├── stim.pybind.cc
│   │   │   └── stim_pybind_test.py
│   │   ├── search/
│   │   │   ├── graphlike/
│   │   │   │   ├── algo.cc
│   │   │   │   ├── algo.h
│   │   │   │   ├── algo.perf.cc
│   │   │   │   ├── algo.test.cc
│   │   │   │   ├── edge.cc
│   │   │   │   ├── edge.h
│   │   │   │   ├── edge.test.cc
│   │   │   │   ├── graph.cc
│   │   │   │   ├── graph.h
│   │   │   │   ├── graph.test.cc
│   │   │   │   ├── node.cc
│   │   │   │   ├── node.h
│   │   │   │   ├── node.test.cc
│   │   │   │   ├── search_state.cc
│   │   │   │   ├── search_state.h
│   │   │   │   └── search_state.test.cc
│   │   │   ├── hyper/
│   │   │   │   ├── algo.cc
│   │   │   │   ├── algo.h
│   │   │   │   ├── algo.test.cc
│   │   │   │   ├── edge.cc
│   │   │   │   ├── edge.h
│   │   │   │   ├── edge.test.cc
│   │   │   │   ├── graph.cc
│   │   │   │   ├── graph.h
│   │   │   │   ├── graph.test.cc
│   │   │   │   ├── node.cc
│   │   │   │   ├── node.h
│   │   │   │   ├── node.test.cc
│   │   │   │   ├── search_state.cc
│   │   │   │   ├── search_state.h
│   │   │   │   └── search_state.test.cc
│   │   │   ├── sat/
│   │   │   │   ├── wcnf.cc
│   │   │   │   ├── wcnf.h
│   │   │   │   └── wcnf.test.cc
│   │   │   └── search.h
│   │   ├── simulators/
│   │   │   ├── README.md
│   │   │   ├── dem_sampler.h
│   │   │   ├── dem_sampler.inl
│   │   │   ├── dem_sampler.perf.cc
│   │   │   ├── dem_sampler.pybind.cc
│   │   │   ├── dem_sampler.pybind.h
│   │   │   ├── dem_sampler.test.cc
│   │   │   ├── dem_sampler_pybind_test.py
│   │   │   ├── error_analyzer.cc
│   │   │   ├── error_analyzer.h
│   │   │   ├── error_analyzer.perf.cc
│   │   │   ├── error_analyzer.test.cc
│   │   │   ├── error_matcher.cc
│   │   │   ├── error_matcher.h
│   │   │   ├── error_matcher.test.cc
│   │   │   ├── force_streaming.cc
│   │   │   ├── force_streaming.h
│   │   │   ├── frame_simulator.h
│   │   │   ├── frame_simulator.inl
│   │   │   ├── frame_simulator.perf.cc
│   │   │   ├── frame_simulator.pybind.cc
│   │   │   ├── frame_simulator.pybind.h
│   │   │   ├── frame_simulator.test.cc
│   │   │   ├── frame_simulator_pybind_test.py
│   │   │   ├── frame_simulator_util.h
│   │   │   ├── frame_simulator_util.inl
│   │   │   ├── frame_simulator_util.test.cc
│   │   │   ├── graph_simulator.cc
│   │   │   ├── graph_simulator.h
│   │   │   ├── graph_simulator.test.cc
│   │   │   ├── matched_error.cc
│   │   │   ├── matched_error.h
│   │   │   ├── matched_error.pybind.cc
│   │   │   ├── matched_error.pybind.h
│   │   │   ├── matched_error.test.cc
│   │   │   ├── matched_error_pybind_test.py
│   │   │   ├── measurements_to_detection_events.h
│   │   │   ├── measurements_to_detection_events.inl
│   │   │   ├── measurements_to_detection_events.pybind.cc
│   │   │   ├── measurements_to_detection_events.pybind.h
│   │   │   ├── measurements_to_detection_events.test.cc
│   │   │   ├── measurements_to_detection_events_test.py
│   │   │   ├── sparse_rev_frame_tracker.cc
│   │   │   ├── sparse_rev_frame_tracker.h
│   │   │   ├── sparse_rev_frame_tracker.test.cc
│   │   │   ├── tableau_simulator.h
│   │   │   ├── tableau_simulator.inl
│   │   │   ├── tableau_simulator.perf.cc
│   │   │   ├── tableau_simulator.pybind.cc
│   │   │   ├── tableau_simulator.pybind.h
│   │   │   ├── tableau_simulator.test.cc
│   │   │   ├── tableau_simulator_pybind_test.py
│   │   │   ├── vector_simulator.cc
│   │   │   ├── vector_simulator.h
│   │   │   └── vector_simulator.test.cc
│   │   ├── stabilizers/
│   │   │   ├── README.md
│   │   │   ├── clifford_string.h
│   │   │   ├── clifford_string.perf.cc
│   │   │   ├── clifford_string.pybind.cc
│   │   │   ├── clifford_string.pybind.h
│   │   │   ├── clifford_string.test.cc
│   │   │   ├── clifford_string_pybind_test.py
│   │   │   ├── flex_pauli_string.cc
│   │   │   ├── flex_pauli_string.h
│   │   │   ├── flex_pauli_string.test.cc
│   │   │   ├── flow.h
│   │   │   ├── flow.inl
│   │   │   ├── flow.pybind.cc
│   │   │   ├── flow.pybind.h
│   │   │   ├── flow.test.cc
│   │   │   ├── flow_pybind_test.py
│   │   │   ├── pauli_string.h
│   │   │   ├── pauli_string.inl
│   │   │   ├── pauli_string.perf.cc
│   │   │   ├── pauli_string.pybind.cc
│   │   │   ├── pauli_string.pybind.h
│   │   │   ├── pauli_string.test.cc
│   │   │   ├── pauli_string_iter.h
│   │   │   ├── pauli_string_iter.inl
│   │   │   ├── pauli_string_iter.perf.cc
│   │   │   ├── pauli_string_iter.pybind.cc
│   │   │   ├── pauli_string_iter.pybind.h
│   │   │   ├── pauli_string_iter.test.cc
│   │   │   ├── pauli_string_pybind_test.py
│   │   │   ├── pauli_string_ref.h
│   │   │   ├── pauli_string_ref.inl
│   │   │   ├── pauli_string_ref.test.cc
│   │   │   ├── tableau.h
│   │   │   ├── tableau.inl
│   │   │   ├── tableau.perf.cc
│   │   │   ├── tableau.pybind.cc
│   │   │   ├── tableau.pybind.h
│   │   │   ├── tableau.test.cc
│   │   │   ├── tableau_iter.h
│   │   │   ├── tableau_iter.inl
│   │   │   ├── tableau_iter.perf.cc
│   │   │   ├── tableau_iter.pybind.cc
│   │   │   ├── tableau_iter.pybind.h
│   │   │   ├── tableau_iter.test.cc
│   │   │   ├── tableau_pybind_test.py
│   │   │   ├── tableau_specialized_prepend.inl
│   │   │   ├── tableau_transposed_raii.h
│   │   │   └── tableau_transposed_raii.inl
│   │   ├── util_bot/
│   │   │   ├── arg_parse.cc
│   │   │   ├── arg_parse.h
│   │   │   ├── arg_parse.test.cc
│   │   │   ├── error_decomp.cc
│   │   │   ├── error_decomp.h
│   │   │   ├── error_decomp.perf.cc
│   │   │   ├── error_decomp.test.cc
│   │   │   ├── probability_util.cc
│   │   │   ├── probability_util.h
│   │   │   ├── probability_util.perf.cc
│   │   │   ├── probability_util.test.cc
│   │   │   ├── str_util.h
│   │   │   ├── str_util.test.cc
│   │   │   ├── test_util.test.cc
│   │   │   ├── test_util.test.h
│   │   │   ├── twiddle.h
│   │   │   └── twiddle.test.cc
│   │   └── util_top/
│   │       ├── circuit_flow_generators.h
│   │       ├── circuit_flow_generators.inl
│   │       ├── circuit_flow_generators.test.cc
│   │       ├── circuit_flow_generators_test.py
│   │       ├── circuit_inverse_qec.cc
│   │       ├── circuit_inverse_qec.h
│   │       ├── circuit_inverse_qec.inl
│   │       ├── circuit_inverse_qec.test.cc
│   │       ├── circuit_inverse_qec_test.py
│   │       ├── circuit_inverse_unitary.cc
│   │       ├── circuit_inverse_unitary.h
│   │       ├── circuit_inverse_unitary.test.cc
│   │       ├── circuit_to_dem.h
│   │       ├── circuit_to_dem.test.cc
│   │       ├── circuit_to_detecting_regions.cc
│   │       ├── circuit_to_detecting_regions.h
│   │       ├── circuit_to_detecting_regions.test.cc
│   │       ├── circuit_to_detecting_regions_test.py
│   │       ├── circuit_vs_amplitudes.cc
│   │       ├── circuit_vs_amplitudes.h
│   │       ├── circuit_vs_amplitudes.test.cc
│   │       ├── circuit_vs_tableau.h
│   │       ├── circuit_vs_tableau.inl
│   │       ├── circuit_vs_tableau.test.cc
│   │       ├── count_determined_measurements.h
│   │       ├── count_determined_measurements.inl
│   │       ├── count_determined_measurements.test.cc
│   │       ├── export_crumble_url.cc
│   │       ├── export_crumble_url.h
│   │       ├── export_crumble_url.test.cc
│   │       ├── export_crumble_url_pybind_test.py
│   │       ├── export_qasm.cc
│   │       ├── export_qasm.h
│   │       ├── export_qasm.test.cc
│   │       ├── export_qasm_pybind_test.py
│   │       ├── export_quirk_url.cc
│   │       ├── export_quirk_url.h
│   │       ├── export_quirk_url.test.cc
│   │       ├── export_quirk_url_pybind_test.py
│   │       ├── has_flow.cc
│   │       ├── has_flow.h
│   │       ├── has_flow.inl
│   │       ├── has_flow.test.cc
│   │       ├── mbqc_decomposition.cc
│   │       ├── mbqc_decomposition.h
│   │       ├── mbqc_decomposition.test.cc
│   │       ├── missing_detectors.cc
│   │       ├── missing_detectors.h
│   │       ├── missing_detectors.test.cc
│   │       ├── reference_sample_tree.cc
│   │       ├── reference_sample_tree.h
│   │       ├── reference_sample_tree.inl
│   │       ├── reference_sample_tree.perf.cc
│   │       ├── reference_sample_tree.test.cc
│   │       ├── simplified_circuit.cc
│   │       ├── simplified_circuit.h
│   │       ├── simplified_circuit.test.cc
│   │       ├── stabilizers_to_tableau.h
│   │       ├── stabilizers_to_tableau.inl
│   │       ├── stabilizers_to_tableau.perf.cc
│   │       ├── stabilizers_to_tableau.test.cc
│   │       ├── stabilizers_vs_amplitudes.h
│   │       ├── stabilizers_vs_amplitudes.inl
│   │       ├── stabilizers_vs_amplitudes.test.cc
│   │       ├── transform_without_feedback.cc
│   │       ├── transform_without_feedback.h
│   │       └── transform_without_feedback.test.cc
│   ├── stim.cc
│   ├── stim.h
│   ├── stim.test.cc
│   └── stim_included_twice.test.cc
└── testdata/
    ├── circuit_all_ops_3d.gltf
    ├── classical_feedback.gltf
    ├── collapsing.gltf
    ├── detector_pseudo_targets.gltf
    ├── empty_match_graph.gltf
    ├── lattice_surgery_cnot.gltf
    ├── match_graph_no_coords.gltf
    ├── match_graph_repetition_code.gltf
    ├── match_graph_surface_code.gltf
    ├── measurement_looping.gltf
    ├── noise_gates_1.gltf
    ├── noise_gates_2.gltf
    ├── noise_gates_3.gltf
    ├── repeat.gltf
    ├── repetition_code.gltf
    ├── single_qubits_gates.gltf
    ├── surface_code.gltf
    ├── test_circuit_all_ops.gltf
    ├── tick.gltf
    └── two_qubits_gates.gltf
Download .txt
Showing preview only (319K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3946 symbols across 530 files)

FILE: dev/doctest_proper.py
  function no_really_i_have_a_doc_why_is_this_needed_argh (line 31) | def no_really_i_have_a_doc_why_is_this_needed_argh(v: object, fullname: ...
  function gen (line 39) | def gen(*, obj: object, fullname: str, out: Dict[str, object]) -> None:
  function main (line 65) | def main():

FILE: dev/gen_sinter_api_reference.py
  function main (line 12) | def main():

FILE: dev/gen_stim_api_reference.py
  function main (line 12) | def main():

FILE: dev/gen_stim_stub_file.py
  function main (line 13) | def main():

FILE: dev/overwrite_dev_versions_with_date.py
  function main (line 19) | def main():

FILE: dev/util_gen_stub_file.py
  function normalize_doc_string (line 83) | def normalize_doc_string(d: str) -> str:
  function indented (line 90) | def indented(*, paragraph: str, indentation: str) -> str:
  class DescribedObject (line 97) | class DescribedObject:
    method __init__ (line 98) | def __init__(self):
  function splay_signature (line 104) | def splay_signature(sig: str) -> List[str]:
  function _handle_pybind_method (line 141) | def _handle_pybind_method(
  function print_doc (line 217) | def print_doc(*, full_name: str, parent: object, obj: object, level: int...
  function generate_documentation (line 306) | def generate_documentation(*, obj: object, level: int, full_name: str) -...

FILE: doc/stim.pyi
  class Circuit (line 10) | class Circuit:
    method __add__ (line 44) | def __add__(
    method __eq__ (line 66) | def __eq__(
    method __getitem__ (line 73) | def __getitem__(
    method __getitem__ (line 79) | def __getitem__(
    method __getitem__ (line 84) | def __getitem__(
    method __iadd__ (line 126) | def __iadd__(
    method __imul__ (line 149) | def __imul__(
    method __init__ (line 176) | def __init__(
    method __len__ (line 195) | def __len__(
    method __mul__ (line 222) | def __mul__(
    method __ne__ (line 253) | def __ne__(
    method __repr__ (line 259) | def __repr__(
    method __rmul__ (line 264) | def __rmul__(
    method __str__ (line 295) | def __str__(
    method append (line 301) | def append(
    method append (line 311) | def append(
    method append (line 316) | def append(
    method append_from_stim_program_text (line 381) | def append_from_stim_program_text(
    method append_operation (line 407) | def append_operation(
    method approx_equals (line 417) | def approx_equals(
    method clear (line 474) | def clear(
    method compile_detector_sampler (line 489) | def compile_detector_sampler(
    method compile_m2d_converter (line 534) | def compile_m2d_converter(
    method compile_sampler (line 578) | def compile_sampler(
    method copy (line 650) | def copy(
    method count_determined_measurements (line 665) | def count_determined_measurements(
    method decomposed (line 762) | def decomposed(
    method detecting_regions (line 827) | def detecting_regions(
    method detector_error_model (line 955) | def detector_error_model(
    method diagram (line 1050) | def diagram(
    method explain_detector_error_model_errors (line 1179) | def explain_detector_error_model_errors(
    method flattened (line 1235) | def flattened(
    method flattened_operations (line 1273) | def flattened_operations(
    method flow_generators (line 1298) | def flow_generators(
    method from_file (line 1350) | def from_file(
    method generated (line 1390) | def generated(
    method get_detector_coordinates (line 1488) | def get_detector_coordinates(
    method get_final_qubit_coordinates (line 1522) | def get_final_qubit_coordinates(
    method has_all_flows (line 1543) | def has_all_flows(
    method has_flow (line 1598) | def has_flow(
    method insert (line 1718) | def insert(
    method inverse (line 1767) | def inverse(
    method likeliest_error_sat_problem (line 1818) | def likeliest_error_sat_problem(
    method missing_detectors (line 1898) | def missing_detectors(
    method num_detectors (line 1958) | def num_detectors(
    method num_measurements (line 1978) | def num_measurements(
    method num_observables (line 1995) | def num_observables(
    method num_qubits (line 2014) | def num_qubits(
    method num_sweep_bits (line 2036) | def num_sweep_bits(
    method num_ticks (line 2056) | def num_ticks(
    method pop (line 2095) | def pop(
    method reference_detector_and_observable_signs (line 2128) | def reference_detector_and_observable_signs(
    method reference_sample (line 2176) | def reference_sample(
    method search_for_undetectable_logical_errors (line 2208) | def search_for_undetectable_logical_errors(
    method shortest_error_sat_problem (line 2301) | def shortest_error_sat_problem(
    method shortest_graphlike_error (line 2368) | def shortest_graphlike_error(
    method solve_flow_measurements (line 2438) | def solve_flow_measurements(
    method time_reversed_for_flows (line 2529) | def time_reversed_for_flows(
    method to_crumble_url (line 2732) | def to_crumble_url(
    method to_file (line 2777) | def to_file(
    method to_qasm (line 2811) | def to_qasm(
    method to_quirk_url (line 2871) | def to_quirk_url(
    method to_tableau (line 2897) | def to_tableau(
    method with_inlined_feedback (line 2949) | def with_inlined_feedback(
    method without_noise (line 3003) | def without_noise(
    method without_tags (line 3030) | def without_tags(
  class CircuitErrorLocation (line 3050) | class CircuitErrorLocation:
    method __init__ (line 3073) | def __init__(
    method flipped_measurement (line 3130) | def flipped_measurement(
    method flipped_pauli_product (line 3151) | def flipped_pauli_product(
    method instruction_targets (line 3170) | def instruction_targets(
    method noise_tag (line 3197) | def noise_tag(
    method stack_frames (line 3214) | def stack_frames(
    method tick_offset (line 3239) | def tick_offset(
  class CircuitErrorLocationStackFrame (line 3260) | class CircuitErrorLocationStackFrame:
    method __init__ (line 3292) | def __init__(
    method instruction_offset (line 3310) | def instruction_offset(
    method instruction_repetitions_arg (line 3332) | def instruction_repetitions_arg(
    method iteration_index (line 3357) | def iteration_index(
  class CircuitInstruction (line 3381) | class CircuitInstruction:
    method __eq__ (line 3398) | def __eq__(
    method __init__ (line 3404) | def __init__(
    method __ne__ (line 3442) | def __ne__(
    method __repr__ (line 3448) | def __repr__(
    method __str__ (line 3453) | def __str__(
    method gate_args_copy (line 3458) | def gate_args_copy(
    method name (line 3479) | def name(
    method num_measurements (line 3485) | def num_measurements(
    method tag (line 3506) | def tag(
    method target_groups (line 3521) | def target_groups(
    method targets_copy (line 3560) | def targets_copy(
  class CircuitRepeatBlock (line 3576) | class CircuitRepeatBlock:
    method __eq__ (line 3597) | def __eq__(
    method __init__ (line 3603) | def __init__(
    method __ne__ (line 3628) | def __ne__(
    method __repr__ (line 3634) | def __repr__(
    method body_copy (line 3639) | def body_copy(
    method name (line 3664) | def name(
    method num_measurements (line 3686) | def num_measurements(
    method repeat_count (line 3700) | def repeat_count(
    method tag (line 3719) | def tag(
  class CircuitTargetsInsideInstruction (line 3744) | class CircuitTargetsInsideInstruction:
    method __init__ (line 3747) | def __init__(
    method args (line 3771) | def args(
    method gate (line 3790) | def gate(
    method tag (line 3809) | def tag(
    method target_range_end (line 3828) | def target_range_end(
    method target_range_start (line 3850) | def target_range_start(
    method targets_in_range (line 3872) | def targets_in_range(
  class CliffordString (line 3892) | class CliffordString:
    method __add__ (line 3903) | def __add__(
    method __eq__ (line 3920) | def __eq__(
    method __getitem__ (line 3927) | def __getitem__(
    method __getitem__ (line 3933) | def __getitem__(
    method __getitem__ (line 3938) | def __getitem__(
    method __iadd__ (line 3968) | def __iadd__(
    method __imul__ (line 3988) | def __imul__(
    method __init__ (line 4022) | def __init__(
    method __ipow__ (line 4070) | def __ipow__(
    method __len__ (line 4100) | def __len__(
    method __mul__ (line 4110) | def __mul__(
    method __ne__ (line 4131) | def __ne__(
    method __pow__ (line 4137) | def __pow__(
    method __repr__ (line 4173) | def __repr__(
    method __rmul__ (line 4178) | def __rmul__(
    method __setitem__ (line 4202) | def __setitem__(
    method __str__ (line 4259) | def __str__(
    method all_cliffords_string (line 4265) | def all_cliffords_string(
    method copy (line 4286) | def copy(
    method random (line 4306) | def random(
    method x_outputs (line 4323) | def x_outputs(
    method y_outputs (line 4365) | def y_outputs(
    method z_outputs (line 4404) | def z_outputs(
  class CompiledDemSampler (line 4446) | class CompiledDemSampler:
    method sample (line 4475) | def sample(
    method sample_write (line 4625) | def sample_write(
  class CompiledDetectorSampler (line 4703) | class CompiledDetectorSampler:
    method __init__ (line 4706) | def __init__(
    method __repr__ (line 4757) | def __repr__(
    method sample (line 4762) | def sample(
    method sample_bit_packed (line 4857) | def sample_bit_packed(
    method sample_write (line 4885) | def sample_write(
  class CompiledMeasurementSampler (line 4941) | class CompiledMeasurementSampler:
    method __init__ (line 4944) | def __init__(
    method __repr__ (line 5022) | def __repr__(
    method sample (line 5027) | def sample(
    method sample_bit_packed (line 5064) | def sample_bit_packed(
    method sample_write (line 5092) | def sample_write(
  class CompiledMeasurementsToDetectionEventsConverter (line 5129) | class CompiledMeasurementsToDetectionEventsConverter:
    method __init__ (line 5132) | def __init__(
    method __repr__ (line 5175) | def __repr__(
    method convert (line 5181) | def convert(
    method convert (line 5191) | def convert(
    method convert (line 5201) | def convert(
    method convert_file (line 5285) | def convert_file(
  class DemInstruction (line 5351) | class DemInstruction:
    method __eq__ (line 5367) | def __eq__(
    method __init__ (line 5373) | def __init__(
    method __ne__ (line 5407) | def __ne__(
    method __repr__ (line 5413) | def __repr__(
    method __str__ (line 5418) | def __str__(
    method args_copy (line 5423) | def args_copy(
    method tag (line 5446) | def tag(
    method target_groups (line 5462) | def target_groups(
    method targets_copy (line 5491) | def targets_copy(
    method type (line 5513) | def type(
  class DemRepeatBlock (line 5518) | class DemRepeatBlock:
    method __eq__ (line 5535) | def __eq__(
    method __init__ (line 5541) | def __init__(
    method __ne__ (line 5561) | def __ne__(
    method __repr__ (line 5567) | def __repr__(
    method body_copy (line 5572) | def body_copy(
    method repeat_count (line 5590) | def repeat_count(
    method type (line 5596) | def type(
  class DemTarget (line 5618) | class DemTarget:
    method __eq__ (line 5621) | def __eq__(
    method __init__ (line 5627) | def __init__(
    method __ne__ (line 5647) | def __ne__(
    method __repr__ (line 5653) | def __repr__(
    method __str__ (line 5658) | def __str__(
    method is_logical_observable_id (line 5663) | def is_logical_observable_id(
    method is_relative_detector_id (line 5680) | def is_relative_detector_id(
    method is_separator (line 5697) | def is_separator(
    method logical_observable_id (line 5715) | def logical_observable_id(
    method relative_detector_id (line 5738) | def relative_detector_id(
    method separator (line 5761) | def separator(
    method val (line 5779) | def val(
  class DemTargetWithCoords (line 5791) | class DemTargetWithCoords:
    method __init__ (line 5815) | def __init__(
    method coords (line 5835) | def coords(
    method dem_target (line 5855) | def dem_target(
  class DetectorErrorModel (line 5872) | class DetectorErrorModel:
    method __add__ (line 5933) | def __add__(
    method __eq__ (line 5953) | def __eq__(
    method __getitem__ (line 5960) | def __getitem__(
    method __getitem__ (line 5966) | def __getitem__(
    method __getitem__ (line 5971) | def __getitem__(
    method __iadd__ (line 6009) | def __iadd__(
    method __imul__ (line 6030) | def __imul__(
    method __init__ (line 6055) | def __init__(
    method __len__ (line 6072) | def __len__(
    method __mul__ (line 6097) | def __mul__(
    method __ne__ (line 6128) | def __ne__(
    method __repr__ (line 6134) | def __repr__(
    method __rmul__ (line 6139) | def __rmul__(
    method __str__ (line 6170) | def __str__(
    method append (line 6175) | def append(
    method approx_equals (line 6244) | def approx_equals(
    method clear (line 6296) | def clear(
    method compile_sampler (line 6310) | def compile_sampler(
    method copy (line 6372) | def copy(
    method diagram (line 6389) | def diagram(
    method flattened (line 6443) | def flattened(
    method from_file (line 6474) | def from_file(
    method get_detector_coordinates (line 6513) | def get_detector_coordinates(
    method num_detectors (line 6543) | def num_detectors(
    method num_errors (line 6577) | def num_errors(
    method num_observables (line 6599) | def num_observables(
    method rounded (line 6623) | def rounded(
    method shortest_graphlike_error (line 6659) | def shortest_graphlike_error(
    method to_file (line 6748) | def to_file(
    method without_tags (line 6782) | def without_tags(
  class ExplainedError (line 6800) | class ExplainedError:
    method __init__ (line 6825) | def __init__(
    method circuit_error_locations (line 6856) | def circuit_error_locations(
    method dem_error_terms (line 6889) | def dem_error_terms(
  class FlipSimulator (line 6894) | class FlipSimulator:
    method __init__ (line 6907) | def __init__(
    method append_measurement_flips (line 6997) | def append_measurement_flips(
    method batch_size (line 7071) | def batch_size(
    method broadcast_pauli_errors (line 7085) | def broadcast_pauli_errors(
    method clear (line 7137) | def clear(
    method copy (line 7166) | def copy(
    method do (line 7236) | def do(
    method generate_bernoulli_samples (line 7273) | def generate_bernoulli_samples(
    method get_detector_flips (line 7336) | def get_detector_flips(
    method get_measurement_flips (line 7404) | def get_measurement_flips(
    method get_observable_flips (line 7473) | def get_observable_flips(
    method num_detectors (line 7542) | def num_detectors(
    method num_measurements (line 7560) | def num_measurements(
    method num_observables (line 7575) | def num_observables(
    method num_qubits (line 7593) | def num_qubits(
    method peek_pauli_flips (line 7611) | def peek_pauli_flips(
    method peek_pauli_flips (line 7616) | def peek_pauli_flips(
    method peek_pauli_flips (line 7622) | def peek_pauli_flips(
    method set_pauli_flip (line 7672) | def set_pauli_flip(
    method to_numpy (line 7701) | def to_numpy(
  class FlippedMeasurement (line 7853) | class FlippedMeasurement:
    method __init__ (line 7871) | def __init__(
    method observable (line 7890) | def observable(
    method record_index (line 7907) | def record_index(
  class Flow (line 7923) | class Flow:
    method __eq__ (line 7963) | def __eq__(
    method __init__ (line 7969) | def __init__(
    method __mul__ (line 8030) | def __mul__(
    method __ne__ (line 8057) | def __ne__(
    method __repr__ (line 8063) | def __repr__(
    method __str__ (line 8068) | def __str__(
    method included_observables_copy (line 8073) | def included_observables_copy(
    method input_copy (line 8097) | def input_copy(
    method measurements_copy (line 8111) | def measurements_copy(
    method output_copy (line 8125) | def output_copy(
  class GateData (line 8139) | class GateData:
    method __eq__ (line 8158) | def __eq__(
    method __init__ (line 8164) | def __init__(
    method __ne__ (line 8175) | def __ne__(
    method __repr__ (line 8181) | def __repr__(
    method __str__ (line 8186) | def __str__(
    method aliases (line 8192) | def aliases(
    method flows (line 8208) | def flows(
    method generalized_inverse (line 8245) | def generalized_inverse(
    method hadamard_conjugated (line 8289) | def hadamard_conjugated(
    method inverse (line 8344) | def inverse(
    method is_noisy_gate (line 8384) | def is_noisy_gate(
    method is_reset (line 8417) | def is_reset(
    method is_single_qubit_gate (line 8454) | def is_single_qubit_gate(
    method is_symmetric_gate (line 8492) | def is_symmetric_gate(
    method is_two_qubit_gate (line 8541) | def is_two_qubit_gate(
    method is_unitary (line 8579) | def is_unitary(
    method name (line 8608) | def name(
    method num_parens_arguments_range (line 8621) | def num_parens_arguments_range(
    method produces_measurements (line 8649) | def produces_measurements(
    method tableau (line 8682) | def tableau(
    method takes_measurement_record_targets (line 8713) | def takes_measurement_record_targets(
    method takes_pauli_targets (line 8749) | def takes_pauli_targets(
    method unitary_matrix (line 8783) | def unitary_matrix(
  class GateTarget (line 8804) | class GateTarget:
    method __eq__ (line 8817) | def __eq__(
    method __init__ (line 8823) | def __init__(
    method __ne__ (line 8846) | def __ne__(
    method __repr__ (line 8852) | def __repr__(
    method is_combiner (line 8858) | def is_combiner(
    method is_inverted_result_target (line 8883) | def is_inverted_result_target(
    method is_measurement_record_target (line 8908) | def is_measurement_record_target(
    method is_qubit_target (line 8931) | def is_qubit_target(
    method is_sweep_bit_target (line 8954) | def is_sweep_bit_target(
    method is_x_target (line 8977) | def is_x_target(
    method is_y_target (line 9000) | def is_y_target(
    method is_z_target (line 9023) | def is_z_target(
    method pauli_type (line 9046) | def pauli_type(
    method qubit_value (line 9071) | def qubit_value(
    method value (line 9094) | def value(
  class GateTargetWithCoords (line 9119) | class GateTargetWithCoords:
    method __init__ (line 9139) | def __init__(
    method coords (line 9155) | def coords(
    method gate_target (line 9169) | def gate_target(
  class PauliString (line 9180) | class PauliString:
    method __add__ (line 9193) | def __add__(
    method __eq__ (line 9216) | def __eq__(
    method __getitem__ (line 9223) | def __getitem__(
    method __getitem__ (line 9229) | def __getitem__(
    method __getitem__ (line 9234) | def __getitem__(
    method __iadd__ (line 9265) | def __iadd__(
    method __imul__ (line 9291) | def __imul__(
    method __init__ (line 9335) | def __init__(
    method __itruediv__ (line 9404) | def __itruediv__(
    method __len__ (line 9427) | def __len__(
    method __mul__ (line 9439) | def __mul__(
    method __ne__ (line 9491) | def __ne__(
    method __neg__ (line 9497) | def __neg__(
    method __pos__ (line 9511) | def __pos__(
    method __repr__ (line 9525) | def __repr__(
    method __rmul__ (line 9530) | def __rmul__(
    method __setitem__ (line 9581) | def __setitem__(
    method __str__ (line 9613) | def __str__(
    method __truediv__ (line 9618) | def __truediv__(
    method after (line 9640) | def after(
    method after (line 9646) | def after(
    method after (line 9652) | def after(
    method before (line 9688) | def before(
    method before (line 9694) | def before(
    method before (line 9700) | def before(
    method commutes (line 9735) | def commutes(
    method copy (line 9768) | def copy(
    method extended_product (line 9784) | def extended_product(
    method from_numpy (line 9791) | def from_numpy(
    method from_unitary_matrix (line 9841) | def from_unitary_matrix(
    method iter_all (line 9894) | def iter_all(
    method pauli_indices (line 9948) | def pauli_indices(
    method random (line 9986) | def random(
    method sign (line 10017) | def sign(
    method sign (line 10034) | def sign(self, value: complex):
    method to_numpy (line 10036) | def to_numpy(
    method to_tableau (line 10088) | def to_tableau(
    method to_unitary_matrix (line 10131) | def to_unitary_matrix(
    method weight (line 10158) | def weight(
  class PauliStringIterator (line 10174) | class PauliStringIterator:
    method __iter__ (line 10192) | def __iter__(
    method __next__ (line 10201) | def __next__(
  class Tableau (line 10206) | class Tableau:
    method __add__ (line 10239) | def __add__(
    method __call__ (line 10263) | def __call__(
    method __eq__ (line 10295) | def __eq__(
    method __iadd__ (line 10301) | def __iadd__(
    method __init__ (line 10329) | def __init__(
    method __len__ (line 10348) | def __len__(
    method __mul__ (line 10359) | def __mul__(
    method __ne__ (line 10381) | def __ne__(
    method __pow__ (line 10387) | def __pow__(
    method __repr__ (line 10417) | def __repr__(
    method __str__ (line 10422) | def __str__(
    method append (line 10427) | def append(
    method copy (line 10450) | def copy(
    method from_circuit (line 10465) | def from_circuit(
    method from_conjugated_generators (line 10519) | def from_conjugated_generators(
    method from_named_gate (line 10557) | def from_named_gate(
    method from_numpy (line 10584) | def from_numpy(
    method from_stabilizers (line 10683) | def from_stabilizers(
    method from_state_vector (line 10766) | def from_state_vector(
    method from_unitary_matrix (line 10827) | def from_unitary_matrix(
    method inverse (line 10882) | def inverse(
    method inverse_x_output (line 10948) | def inverse_x_output(
    method inverse_x_output_pauli (line 10982) | def inverse_x_output_pauli(
    method inverse_y_output (line 11018) | def inverse_y_output(
    method inverse_y_output_pauli (line 11052) | def inverse_y_output_pauli(
    method inverse_z_output (line 11088) | def inverse_z_output(
    method inverse_z_output_pauli (line 11124) | def inverse_z_output_pauli(
    method iter_all (line 11161) | def iter_all(
    method prepend (line 11192) | def prepend(
    method random (line 11213) | def random(
    method then (line 11233) | def then(
    method to_circuit (line 11257) | def to_circuit(
    method to_numpy (line 11382) | def to_numpy(
    method to_pauli_string (line 11544) | def to_pauli_string(
    method to_stabilizers (line 11574) | def to_stabilizers(
    method to_state_vector (line 11623) | def to_state_vector(
    method to_unitary_matrix (line 11675) | def to_unitary_matrix(
    method x_output (line 11720) | def x_output(
    method x_output_pauli (line 11741) | def x_output_pauli(
    method x_sign (line 11777) | def x_sign(
    method y_output (line 11795) | def y_output(
    method y_output_pauli (line 11816) | def y_output_pauli(
    method y_sign (line 11852) | def y_sign(
    method z_output (line 11872) | def z_output(
    method z_output_pauli (line 11893) | def z_output_pauli(
    method z_sign (line 11929) | def z_sign(
  class TableauIterator (line 11947) | class TableauIterator:
    method __iter__ (line 11959) | def __iter__(
    method __next__ (line 11968) | def __next__(
  class TableauSimulator (line 11973) | class TableauSimulator:
    method __init__ (line 12003) | def __init__(
    method c_xyz (line 12050) | def c_xyz(
    method c_zyx (line 12071) | def c_zyx(
    method canonical_stabilizers (line 12092) | def canonical_stabilizers(
    method cnot (line 12141) | def cnot(
    method copy (line 12164) | def copy(
    method current_inverse_tableau (line 12238) | def current_inverse_tableau(
    method current_measurement_record (line 12272) | def current_measurement_record(
    method cx (line 12297) | def cx(
    method cy (line 12320) | def cy(
    method cz (line 12343) | def cz(
    method depolarize1 (line 12366) | def depolarize1(
    method depolarize2 (line 12383) | def depolarize2(
    method do (line 12402) | def do(
    method do_circuit (line 12428) | def do_circuit(
    method do_pauli_string (line 12447) | def do_pauli_string(
    method do_tableau (line 12463) | def do_tableau(
    method h (line 12505) | def h(
    method h_xy (line 12526) | def h_xy(
    method h_xz (line 12547) | def h_xz(
    method h_yz (line 12568) | def h_yz(
    method iswap (line 12589) | def iswap(
    method iswap_dag (line 12612) | def iswap_dag(
    method measure (line 12635) | def measure(
    method measure_kickback (line 12662) | def measure_kickback(
    method measure_many (line 12717) | def measure_many(
    method measure_observable (line 12736) | def measure_observable(
    method num_qubits (line 12774) | def num_qubits(
    method peek_bloch (line 12792) | def peek_bloch(
    method peek_observable_expectation (line 12838) | def peek_observable_expectation(
    method peek_x (line 12884) | def peek_x(
    method peek_y (line 12917) | def peek_y(
    method peek_z (line 12950) | def peek_z(
    method postselect_observable (line 12983) | def postselect_observable(
    method postselect_x (line 13016) | def postselect_x(
    method postselect_y (line 13055) | def postselect_y(
    method postselect_z (line 13094) | def postselect_z(
    method reset (line 13134) | def reset(
    method reset_x (line 13151) | def reset_x(
    method reset_y (line 13167) | def reset_y(
    method reset_z (line 13183) | def reset_z(
    method s (line 13200) | def s(
    method s_dag (line 13221) | def s_dag(
    method set_inverse_tableau (line 13242) | def set_inverse_tableau(
    method set_num_qubits (line 13269) | def set_num_qubits(
    method set_state_from_stabilizers (line 13306) | def set_state_from_stabilizers(
    method set_state_from_state_vector (line 13396) | def set_state_from_state_vector(
    method sqrt_x (line 13459) | def sqrt_x(
    method sqrt_x_dag (line 13480) | def sqrt_x_dag(
    method sqrt_y (line 13501) | def sqrt_y(
    method sqrt_y_dag (line 13522) | def sqrt_y_dag(
    method state_vector (line 13543) | def state_vector(
    method swap (line 13594) | def swap(
    method x (line 13617) | def x(
    method x_error (line 13638) | def x_error(
    method xcx (line 13655) | def xcx(
    method xcy (line 13678) | def xcy(
    method xcz (line 13701) | def xcz(
    method y (line 13724) | def y(
    method y_error (line 13745) | def y_error(
    method ycx (line 13762) | def ycx(
    method ycy (line 13785) | def ycy(
    method ycz (line 13808) | def ycz(
    method z (line 13831) | def z(
    method z_error (line 13852) | def z_error(
    method zcx (line 13869) | def zcx(
    method zcy (line 13892) | def zcy(
    method zcz (line 13915) | def zcz(
  function gate_data (line 13939) | def gate_data(
  function gate_data (line 13944) | def gate_data(
  function gate_data (line 13947) | def gate_data(
  function main (line 13964) | def main(
  function read_shot_data_file (line 14038) | def read_shot_data_file(
  function read_shot_data_file (line 14049) | def read_shot_data_file(
  function read_shot_data_file (line 14060) | def read_shot_data_file(
  function target_combined_paulis (line 14140) | def target_combined_paulis(
  function target_combiner (line 14167) | def target_combiner(
  function target_inv (line 14186) | def target_inv(
  function target_logical_observable_id (line 14208) | def target_logical_observable_id(
  function target_pauli (line 14230) | def target_pauli(
  function target_rec (line 14269) | def target_rec(
  function target_relative_detector_id (line 14296) | def target_relative_detector_id(
  function target_separator (line 14318) | def target_separator(
  function target_sweep_bit (line 14335) | def target_sweep_bit(
  function target_x (line 14352) | def target_x(
  function target_y (line 14378) | def target_y(
  function target_z (line 14404) | def target_z(
  function write_shot_data_file (line 14430) | def write_shot_data_file(

FILE: glue/cirq/stimcirq/_cirq_to_stim.py
  function _forward_single_str_tag (line 14) | def _forward_single_str_tag(op: cirq.CircuitOperation) -> str:
  function cirq_circuit_to_stim_circuit (line 21) | def cirq_circuit_to_stim_circuit(
  function cirq_circuit_to_stim_data (line 118) | def cirq_circuit_to_stim_data(
  function gate_to_stim_append_func (line 148) | def gate_to_stim_append_func() -> Dict[cirq.Gate, Callable[[stim.Circuit...
  function gate_type_to_stim_append_func (line 258) | def gate_type_to_stim_append_func() -> Dict[Type[cirq.Gate], StimTypeHan...
  function _stim_append_measurement_gate (line 281) | def _stim_append_measurement_gate(
  function _stim_append_pauli_measurement_gate (line 290) | def _stim_append_pauli_measurement_gate(
  function _stim_append_spp_gate (line 319) | def _stim_append_spp_gate(
  function _stim_append_dense_pauli_string_gate (line 345) | def _stim_append_dense_pauli_string_gate(
  function _stim_append_asymmetric_depolarizing_channel (line 354) | def _stim_append_asymmetric_depolarizing_channel(
  function _stim_append_depolarizing_channel (line 386) | def _stim_append_depolarizing_channel(c: stim.Circuit, g: cirq.Depolariz...
  function _stim_append_controlled_gate (line 395) | def _stim_append_controlled_gate(c: stim.Circuit, g: cirq.ControlledGate...
  function _stim_append_random_gate_channel (line 416) | def _stim_append_random_gate_channel(c: stim.Circuit, g: cirq.RandomGate...
  class CirqToStimHelper (line 431) | class CirqToStimHelper:
    method __init__ (line 432) | def __init__(self, tag_func: Callable[[cirq.Operation], str]):
    method process_circuit_operation_into_repeat_block (line 440) | def process_circuit_operation_into_repeat_block(self, op: cirq.Circuit...
    method process_operations (line 455) | def process_operations(self, operations: Iterable[cirq.Operation]) -> ...
    method process_moment (line 518) | def process_moment(self, moment: cirq.Moment):
    method process_moments (line 526) | def process_moments(self, moments: Iterable[cirq.Moment]):

FILE: glue/cirq/stimcirq/_cirq_to_stim_test.py
  function solve_tableau (line 12) | def solve_tableau(gate: cirq.Gate) -> Dict[cirq.PauliString, cirq.PauliS...
  function test_solve_tableau (line 53) | def test_solve_tableau():
  function assert_unitary_gate_converts_correctly (line 70) | def assert_unitary_gate_converts_correctly(gate: cirq.Gate):
  function test_unitary_gate_conversions (line 97) | def test_unitary_gate_conversions(gate: cirq.Gate):
  function test_more_unitary_gate_conversions (line 103) | def test_more_unitary_gate_conversions():
  function test_frame_simulator_sampling_noisy_gates_agrees_with_cirq_data (line 158) | def test_frame_simulator_sampling_noisy_gates_agrees_with_cirq_data(gate...
  function test_tableau_simulator_sampling_noisy_gates_agrees_with_cirq_data (line 195) | def test_tableau_simulator_sampling_noisy_gates_agrees_with_cirq_data(ga...
  function test_cirq_circuit_to_stim_circuit_custom_stim_method (line 241) | def test_cirq_circuit_to_stim_circuit_custom_stim_method():
  function test_custom_qubit_indexing (line 313) | def test_custom_qubit_indexing():
  function test_on_loop (line 326) | def test_on_loop():
  function test_multi_moment_circuit_operation (line 346) | def test_multi_moment_circuit_operation():
  function test_on_tagged_loop (line 370) | def test_on_tagged_loop():
  function test_random_gate_channel (line 388) | def test_random_gate_channel():
  function test_custom_tagging (line 400) | def test_custom_tagging():
  function test_round_trip_example_circuit (line 418) | def test_round_trip_example_circuit():

FILE: glue/cirq/stimcirq/_cx_swap_gate.py
  class CXSwapGate (line 8) | class CXSwapGate(cirq.Gate):
    method __init__ (line 11) | def __init__(
    method _num_qubits_ (line 18) | def _num_qubits_(self) -> int:
    method _circuit_diagram_info_ (line 21) | def _circuit_diagram_info_(self, args: cirq.CircuitDiagramInfoArgs) ->...
    method _value_equality_values_ (line 24) | def _value_equality_values_(self):
    method _decompose_ (line 29) | def _decompose_(self, qubits):
    method _stim_conversion_ (line 38) | def _stim_conversion_(self, edit_circuit: stim.Circuit, targets: List[...
    method __pow__ (line 41) | def __pow__(self, power: int) -> 'CXSwapGate':
    method __str__ (line 48) | def __str__(self) -> str:
    method __repr__ (line 51) | def __repr__(self):
    method _json_namespace_ (line 55) | def _json_namespace_() -> str:
    method _json_dict_ (line 58) | def _json_dict_(self) -> Dict[str, Any]:

FILE: glue/cirq/stimcirq/_cx_swap_test.py
  function test_stim_conversion (line 6) | def test_stim_conversion():
  function test_diagram (line 25) | def test_diagram():
  function test_inverse (line 41) | def test_inverse():
  function test_repr (line 50) | def test_repr():
  function test_equality (line 57) | def test_equality():
  function test_json_serialization (line 63) | def test_json_serialization():
  function test_json_backwards_compat_exact (line 74) | def test_json_backwards_compat_exact():

FILE: glue/cirq/stimcirq/_cz_swap_gate.py
  class CZSwapGate (line 8) | class CZSwapGate(cirq.Gate):
    method _num_qubits_ (line 11) | def _num_qubits_(self) -> int:
    method _circuit_diagram_info_ (line 14) | def _circuit_diagram_info_(self, args: cirq.CircuitDiagramInfoArgs) ->...
    method _value_equality_values_ (line 17) | def _value_equality_values_(self):
    method _decompose_ (line 20) | def _decompose_(self, qubits):
    method _stim_conversion_ (line 25) | def _stim_conversion_(self, edit_circuit: stim.Circuit, targets: List[...
    method __pow__ (line 28) | def __pow__(self, power: int) -> 'CZSwapGate':
    method __str__ (line 35) | def __str__(self) -> str:
    method __repr__ (line 38) | def __repr__(self):
    method _json_namespace_ (line 42) | def _json_namespace_() -> str:
    method _json_dict_ (line 45) | def _json_dict_(self) -> Dict[str, Any]:

FILE: glue/cirq/stimcirq/_cz_swap_test.py
  function test_stim_conversion (line 6) | def test_stim_conversion():
  function test_diagram (line 25) | def test_diagram():
  function test_inverse (line 41) | def test_inverse():
  function test_repr (line 47) | def test_repr():
  function test_equality (line 52) | def test_equality():
  function test_json_serialization (line 57) | def test_json_serialization():
  function test_json_backwards_compat_exact (line 68) | def test_json_backwards_compat_exact():

FILE: glue/cirq/stimcirq/_det_annotation.py
  class DetAnnotation (line 8) | class DetAnnotation(cirq.Operation):
    method __init__ (line 14) | def __init__(
    method qubits (line 36) | def qubits(self) -> Tuple[cirq.Qid, ...]:
    method with_qubits (line 39) | def with_qubits(self, *new_qubits) -> 'DetAnnotation':
    method _value_equality_values_ (line 42) | def _value_equality_values_(self) -> Any:
    method _circuit_diagram_info_ (line 45) | def _circuit_diagram_info_(self, args: Any) -> str:
    method _json_namespace_ (line 52) | def _json_namespace_() -> str:
    method _json_dict_ (line 55) | def _json_dict_(self) -> Dict[str, Any]:
    method __repr__ (line 64) | def __repr__(self) -> str:
    method _decompose_ (line 72) | def _decompose_(self):
    method _is_comment_ (line 75) | def _is_comment_(self) -> bool:
    method _stim_conversion_ (line 78) | def _stim_conversion_(

FILE: glue/cirq/stimcirq/_det_annotation_test.py
  function test_stim_conversion (line 8) | def test_stim_conversion():
  function test_simulation (line 105) | def test_simulation():
  function test_diagram (line 116) | def test_diagram():
  function test_repr (line 134) | def test_repr():
  function test_equality (line 139) | def test_equality():
  function test_json_serialization (line 155) | def test_json_serialization():
  function test_json_backwards_compat_exact (line 167) | def test_json_backwards_compat_exact():

FILE: glue/cirq/stimcirq/_i_error_gate.py
  class IErrorGate (line 9) | class IErrorGate(cirq.Gate):
    method __init__ (line 12) | def __init__(self, gate_args: Iterable[float]):
    method _num_qubits_ (line 15) | def _num_qubits_(self) -> int:
    method _circuit_diagram_info_ (line 18) | def _circuit_diagram_info_(self, args: cirq.CircuitDiagramInfoArgs) ->...
    method _value_equality_values_ (line 21) | def _value_equality_values_(self):
    method _decompose_ (line 24) | def _decompose_(self, qubits):
    method _stim_conversion_ (line 27) | def _stim_conversion_(self, edit_circuit: stim.Circuit, targets: List[...
    method __str__ (line 30) | def __str__(self) -> str:
    method __repr__ (line 33) | def __repr__(self):
    method _json_namespace_ (line 37) | def _json_namespace_() -> str:
    method _json_dict_ (line 40) | def _json_dict_(self) -> Dict[str, Any]:

FILE: glue/cirq/stimcirq/_i_error_gate_test.py
  function test_repr (line 5) | def test_repr():
  function test_json_serialization (line 12) | def test_json_serialization():
  function test_json_backwards_compat_exact (line 20) | def test_json_backwards_compat_exact():

FILE: glue/cirq/stimcirq/_ii_error_gate.py
  class IIErrorGate (line 9) | class IIErrorGate(cirq.Gate):
    method __init__ (line 12) | def __init__(self, gate_args: Iterable[float]):
    method _num_qubits_ (line 15) | def _num_qubits_(self) -> int:
    method _circuit_diagram_info_ (line 18) | def _circuit_diagram_info_(self, args: cirq.CircuitDiagramInfoArgs) ->...
    method _value_equality_values_ (line 21) | def _value_equality_values_(self):
    method _decompose_ (line 24) | def _decompose_(self, qubits):
    method _stim_conversion_ (line 27) | def _stim_conversion_(self, edit_circuit: stim.Circuit, targets: List[...
    method __str__ (line 30) | def __str__(self) -> str:
    method __repr__ (line 33) | def __repr__(self):
    method _json_namespace_ (line 37) | def _json_namespace_() -> str:
    method _json_dict_ (line 40) | def _json_dict_(self) -> Dict[str, Any]:

FILE: glue/cirq/stimcirq/_ii_error_gate_test.py
  function test_repr (line 5) | def test_repr():
  function test_json_serialization (line 12) | def test_json_serialization():
  function test_json_backwards_compat_exact (line 20) | def test_json_backwards_compat_exact():

FILE: glue/cirq/stimcirq/_ii_gate.py
  class IIGate (line 7) | class IIGate(cirq.Gate):
    method _num_qubits_ (line 10) | def _num_qubits_(self) -> int:
    method _circuit_diagram_info_ (line 13) | def _circuit_diagram_info_(self, args: cirq.CircuitDiagramInfoArgs) ->...
    method _value_equality_values_ (line 16) | def _value_equality_values_(self):
    method _decompose_ (line 19) | def _decompose_(self, qubits):
    method _stim_conversion_ (line 22) | def _stim_conversion_(self, edit_circuit: stim.Circuit, targets: List[...
    method __pow__ (line 25) | def __pow__(self, power: int) -> 'IIGate':
    method __str__ (line 28) | def __str__(self) -> str:
    method __repr__ (line 31) | def __repr__(self):
    method _json_namespace_ (line 35) | def _json_namespace_() -> str:
    method _json_dict_ (line 38) | def _json_dict_(self) -> Dict[str, Any]:

FILE: glue/cirq/stimcirq/_ii_gate_test.py
  function test_repr (line 5) | def test_repr():
  function test_json_serialization (line 10) | def test_json_serialization():
  function test_json_backwards_compat_exact (line 18) | def test_json_backwards_compat_exact():

FILE: glue/cirq/stimcirq/_measure_and_or_reset_gate.py
  class MeasureAndOrResetGate (line 8) | class MeasureAndOrResetGate(cirq.Gate):
    method __init__ (line 11) | def __init__(
    method _num_qubits_ (line 27) | def _num_qubits_(self) -> int:
    method _circuit_diagram_info_ (line 30) | def _circuit_diagram_info_(self, args: cirq.CircuitDiagramInfoArgs) ->...
    method resolve (line 33) | def resolve(self, target: cirq.Qid) -> cirq.Operation:
    method _value_equality_values_ (line 53) | def _value_equality_values_(self):
    method _decompose_ (line 63) | def _decompose_(self, qubits):
    method _stim_op_name (line 84) | def _stim_op_name(self) -> str:
    method _stim_conversion_ (line 94) | def _stim_conversion_(self, *, edit_circuit: stim.Circuit, targets: Li...
    method __str__ (line 106) | def __str__(self) -> str:
    method __repr__ (line 116) | def __repr__(self):
    method _json_namespace_ (line 128) | def _json_namespace_() -> str:
    method _json_dict_ (line 131) | def _json_dict_(self) -> Dict[str, Any]:

FILE: glue/cirq/stimcirq/_measure_and_or_reset_gate_test.py
  function test_repr (line 5) | def test_repr():
  function test_json_serialization (line 17) | def test_json_serialization():
  function test_json_backwards_compat_exact (line 32) | def test_json_backwards_compat_exact():

FILE: glue/cirq/stimcirq/_obs_annotation.py
  class CumulativeObservableAnnotation (line 8) | class CumulativeObservableAnnotation(cirq.Operation):
    method __init__ (line 14) | def __init__(
    method qubits (line 36) | def qubits(self) -> Tuple[cirq.Qid, ...]:
    method with_qubits (line 39) | def with_qubits(self, *new_qubits) -> 'CumulativeObservableAnnotation':
    method _value_equality_values_ (line 42) | def _value_equality_values_(self) -> Any:
    method _circuit_diagram_info_ (line 45) | def _circuit_diagram_info_(self, args: Any) -> str:
    method __repr__ (line 52) | def __repr__(self) -> str:
    method _json_namespace_ (line 62) | def _json_namespace_() -> str:
    method _json_dict_ (line 65) | def _json_dict_(self) -> Dict[str, Any]:
    method _decompose_ (line 75) | def _decompose_(self):
    method _is_comment_ (line 78) | def _is_comment_(self) -> bool:
    method _stim_conversion_ (line 81) | def _stim_conversion_(

FILE: glue/cirq/stimcirq/_obs_annotation_test.py
  function test_stim_conversion (line 8) | def test_stim_conversion():
  function test_simulation (line 123) | def test_simulation():
  function test_diagram (line 136) | def test_diagram():
  function test_repr (line 154) | def test_repr():
  function test_equality (line 159) | def test_equality():
  function test_json_serialization (line 181) | def test_json_serialization():
  function test_json_serialization_with_pauli_keys (line 194) | def test_json_serialization_with_pauli_keys():
  function test_json_backwards_compat_exact (line 208) | def test_json_backwards_compat_exact():

FILE: glue/cirq/stimcirq/_shift_coords_annotation.py
  class ShiftCoordsAnnotation (line 8) | class ShiftCoordsAnnotation(cirq.Operation):
    method __init__ (line 14) | def __init__(self, shift: Iterable[float]):
    method qubits (line 23) | def qubits(self) -> Tuple[cirq.Qid, ...]:
    method with_qubits (line 26) | def with_qubits(self, *new_qubits) -> 'ShiftCoordsAnnotation':
    method _value_equality_values_ (line 29) | def _value_equality_values_(self) -> Any:
    method _circuit_diagram_info_ (line 32) | def _circuit_diagram_info_(self, args: Any) -> str:
    method _json_namespace_ (line 37) | def _json_namespace_() -> str:
    method _json_dict_ (line 40) | def _json_dict_(self) -> Dict[str, Any]:
    method __repr__ (line 43) | def __repr__(self) -> str:
    method _decompose_ (line 46) | def _decompose_(self):
    method _is_comment_ (line 49) | def _is_comment_(self) -> bool:
    method _stim_conversion_ (line 52) | def _stim_conversion_(self, *, edit_circuit: stim.Circuit, tag: str, *...

FILE: glue/cirq/stimcirq/_shift_coords_annotation_test.py
  function test_conversion (line 7) | def test_conversion():
  function test_simulation (line 31) | def test_simulation():
  function test_diagram (line 42) | def test_diagram():
  function test_repr (line 60) | def test_repr():
  function test_equality (line 65) | def test_equality():
  function test_json_serialization (line 73) | def test_json_serialization():
  function test_json_backwards_compat_exact (line 80) | def test_json_backwards_compat_exact():

FILE: glue/cirq/stimcirq/_stim_sampler.py
  class StimSampler (line 15) | class StimSampler(cirq.Sampler):
    method run_sweep (line 26) | def run_sweep(

FILE: glue/cirq/stimcirq/_stim_sampler_test.py
  function test_end_to_end (line 7) | def test_end_to_end():
  function test_end_to_end_repeated_keys (line 24) | def test_end_to_end_repeated_keys():
  function test_endian (line 51) | def test_endian():
  function test_custom_gates (line 59) | def test_custom_gates():
  function test_custom_measurement (line 107) | def test_custom_measurement():
  function test_correlated_error (line 134) | def test_correlated_error():

FILE: glue/cirq/stimcirq/_stim_to_cirq.py
  function _stim_targets_to_dense_pauli_string (line 31) | def _stim_targets_to_dense_pauli_string(
  function _proper_transform_circuit_qubits (line 49) | def _proper_transform_circuit_qubits(circuit: cirq.AbstractCircuit, rema...
  class CircuitTranslationTracker (line 67) | class CircuitTranslationTracker:
    method __init__ (line 68) | def __init__(self, flatten: bool, single_measure_key: Optional[str] = ...
    method get_next_measure_id (line 78) | def get_next_measure_id(self) -> int:
    method get_next_measure_key (line 82) | def get_next_measure_key(self) -> str:
    method append_operation (line 87) | def append_operation(self, op: cirq.Operation) -> None:
    method process_gate_instruction (line 90) | def process_gate_instruction(
    method process_tick (line 104) | def process_tick(self, instruction: stim.CircuitInstruction) -> None:
    method process_pauli_channel_1 (line 108) | def process_pauli_channel_1(self, instruction: stim.CircuitInstruction...
    method process_pauli_channel_2 (line 116) | def process_pauli_channel_2(self, instruction: stim.CircuitInstruction...
    method process_repeat_block (line 144) | def process_repeat_block(self, block: stim.CircuitRepeatBlock):
    method process_measurement_instruction (line 180) | def process_measurement_instruction(
    method process_circuit (line 208) | def process_circuit(self, repetitions: int, circuit: stim.Circuit) -> ...
    method output (line 222) | def output(self) -> cirq.Circuit:
    method process_mpp (line 238) | def process_mpp(self, instruction: stim.CircuitInstruction) -> None:
    method process_spp_dag (line 261) | def process_spp_dag(self, instruction: stim.CircuitInstruction) -> None:
    method process_spp (line 264) | def process_spp(self, instruction: stim.CircuitInstruction, dag: bool ...
    method process_m_pair (line 285) | def process_m_pair(self, instruction: stim.CircuitInstruction, basis: ...
    method process_mxx (line 303) | def process_mxx(self, instruction: stim.CircuitInstruction) -> None:
    method process_myy (line 306) | def process_myy(self, instruction: stim.CircuitInstruction) -> None:
    method process_mzz (line 309) | def process_mzz(self, instruction: stim.CircuitInstruction) -> None:
    method process_mpad (line 312) | def process_mpad(self, instruction: stim.CircuitInstruction) -> None:
    method process_correlated_error (line 322) | def process_correlated_error(self, instruction: stim.CircuitInstructio...
    method coords_after_offset (line 335) | def coords_after_offset(
    method resolve_measurement_record_keys (line 348) | def resolve_measurement_record_keys(
    method process_detector (line 363) | def process_detector(self, instruction: stim.CircuitInstruction) -> None:
    method process_observable_include (line 374) | def process_observable_include(self, instruction: stim.CircuitInstruct...
    method process_qubit_coords (line 388) | def process_qubit_coords(self, instruction: stim.CircuitInstruction) -...
    method process_shift_coords (line 396) | def process_shift_coords(self, instruction: stim.CircuitInstruction) -...
    class OneToOneGateHandler (line 407) | class OneToOneGateHandler:
      method __init__ (line 408) | def __init__(self, gate: cirq.Gate):
      method __call__ (line 411) | def __call__(
    class SweepableGateHandler (line 416) | class SweepableGateHandler:
      method __init__ (line 417) | def __init__(self, pauli_gate: cirq.Pauli, gate: cirq.Gate):
      method __call__ (line 421) | def __call__(
    class OneToOneMeasurementHandler (line 452) | class OneToOneMeasurementHandler:
      method __init__ (line 453) | def __init__(self, *, reset: bool, measure: bool, basis: str):
      method __call__ (line 458) | def __call__(
    class OneToOneNoisyGateHandler (line 465) | class OneToOneNoisyGateHandler:
      method __init__ (line 466) | def __init__(self, prob_to_gate: Callable[[float], cirq.Gate]):
      method __call__ (line 469) | def __call__(
    class MultiArgumentGateHandler (line 476) | class MultiArgumentGateHandler:
      method __init__ (line 477) | def __init__(self, args_to_gate: Callable[[List[float]], cirq.Gate]):
      method __call__ (line 480) | def __call__(
    method get_handler_table (line 489) | def get_handler_table() -> Dict[
  function stim_circuit_to_cirq_circuit (line 642) | def stim_circuit_to_cirq_circuit(

FILE: glue/cirq/stimcirq/_stim_to_cirq_test.py
  function test_stim_circuit_to_cirq_circuit (line 12) | def test_stim_circuit_to_cirq_circuit():
  function assert_circuits_are_equivalent_and_convert (line 46) | def assert_circuits_are_equivalent_and_convert(
  function test_gates_converted_using_OneToOneGateHandler (line 61) | def test_gates_converted_using_OneToOneGateHandler(name: str):
  function test_gates_converted_using_SweepableGateHandler (line 84) | def test_gates_converted_using_SweepableGateHandler(name: str):
  function test_gates_converted_using_OneToOneNoisyGateHandler (line 126) | def test_gates_converted_using_OneToOneNoisyGateHandler(name: str, proba...
  function test_gates_converted_using_OneToOneMeasurementHandler (line 153) | def test_gates_converted_using_OneToOneMeasurementHandler(
  function test_round_trip_preserves_moment_structure (line 181) | def test_round_trip_preserves_moment_structure():
  function test_circuit_diagram (line 197) | def test_circuit_diagram():
  function test_all_known_gates_explicitly_handled (line 224) | def test_all_known_gates_explicitly_handled():
  function test_line_grid_qubit_round_trip (line 231) | def test_line_grid_qubit_round_trip():
  function test_noisy_measurements (line 279) | def test_noisy_measurements():
  function test_convert_mpp (line 346) | def test_convert_mpp():
  function test_convert_detector (line 391) | def test_convert_detector():
  function test_convert_observable (line 426) | def test_convert_observable():
  function test_sweep_target (line 461) | def test_sweep_target():
  function test_convert_repeat_simple (line 501) | def test_convert_repeat_simple():
  function test_convert_repeat_measurements (line 527) | def test_convert_repeat_measurements():
  function test_single_repeat_loops_always_flattened (line 574) | def test_single_repeat_loops_always_flattened():
  function test_circuit_operations_always_in_isolated_moment (line 591) | def test_circuit_operations_always_in_isolated_moment():
  function test_stim_circuit_to_cirq_circuit_mpad (line 614) | def test_stim_circuit_to_cirq_circuit_mpad():
  function test_stim_circuit_to_cirq_circuit_mxx_myy_mzz (line 625) | def test_stim_circuit_to_cirq_circuit_mxx_myy_mzz():
  function test_stim_circuit_to_cirq_circuit_spp (line 648) | def test_stim_circuit_to_cirq_circuit_spp():
  function test_tags_convert (line 686) | def test_tags_convert():
  function test_every_operation_converts_tags (line 695) | def test_every_operation_converts_tags(gate: str):
  function test_loop_tagging (line 734) | def test_loop_tagging():
  function test_id_error_round_trip (line 755) | def test_id_error_round_trip():
  function test_round_trip_with_pauli_obs (line 767) | def test_round_trip_with_pauli_obs():
  function test_single_measure_key_order (line 784) | def test_single_measure_key_order():

FILE: glue/cirq/stimcirq/_sweep_pauli.py
  class SweepPauli (line 9) | class SweepPauli(cirq.Gate):
    method __init__ (line 16) | def __init__(
    method _decomposed_into_pauli (line 36) | def _decomposed_into_pauli(self) -> cirq.Gate:
    method _resolve_parameters_ (line 39) | def _resolve_parameters_(self, resolver: cirq.ParamResolver, recursive...
    method _is_parameterized_ (line 45) | def _is_parameterized_(self) -> bool:
    method _parameter_names_ (line 48) | def _parameter_names_(self) -> AbstractSet[str]:
    method _decompose_ (line 51) | def _decompose_(self, qubits) -> cirq.OP_TREE:
    method _num_qubits_ (line 54) | def _num_qubits_(self) -> int:
    method _value_equality_values_ (line 57) | def _value_equality_values_(self) -> Any:
    method _circuit_diagram_info_ (line 60) | def _circuit_diagram_info_(self, args: Any) -> str:
    method _json_namespace_ (line 64) | def _json_namespace_() -> str:
    method _json_dict_ (line 67) | def _json_dict_(self) -> Dict[str, Any]:
    method __repr__ (line 74) | def __repr__(self) -> str:
    method _stim_conversion_ (line 82) | def _stim_conversion_(self, edit_circuit: stim.Circuit, targets: List[...

FILE: glue/cirq/stimcirq/_sweep_pauli_test.py
  function test_repr (line 7) | def test_repr():
  function test_stim_conversion (line 18) | def test_stim_conversion():
  function test_resolving_without_sweep_resolver (line 44) | def test_resolving_without_sweep_resolver():
  function test_parameter_names (line 62) | def test_parameter_names():
  function test_cirq_compatibility (line 74) | def test_cirq_compatibility():
  function test_json_serialization (line 117) | def test_json_serialization():
  function test_json_backwards_compat_exact (line 131) | def test_json_backwards_compat_exact():

FILE: glue/cirq/stimcirq/_two_qubit_asymmetric_depolarize.py
  class TwoQubitAsymmetricDepolarizingChannel (line 8) | class TwoQubitAsymmetricDepolarizingChannel(cirq.Gate):
    method __init__ (line 18) | def __init__(self, probabilities: Sequence[float]):
    method _num_qubits_ (line 25) | def _num_qubits_(self):
    method _value_equality_values_ (line 28) | def _value_equality_values_(self):
    method _has_mixture_ (line 31) | def _has_mixture_(self):
    method _dense_mixture_ (line 34) | def _dense_mixture_(self):
    method _mixture_ (line 44) | def _mixture_(self):
    method _circuit_diagram_info_ (line 47) | def _circuit_diagram_info_(self, args: cirq.CircuitDiagramInfoArgs):
    method _stim_conversion_ (line 53) | def _stim_conversion_(self, edit_circuit: stim.Circuit, targets: List[...
    method __repr__ (line 56) | def __repr__(self):
    method _json_namespace_ (line 60) | def _json_namespace_() -> str:
    method _json_dict_ (line 63) | def _json_dict_(self) -> Dict[str, Any]:

FILE: glue/cirq/stimcirq/_two_qubit_asymmetric_depolarize_test.py
  function test_mixture (line 6) | def test_mixture():
  function test_diagram (line 18) | def test_diagram():
  function test_repr (line 33) | def test_repr():
  function test_json_serialization (line 40) | def test_json_serialization():
  function test_json_backwards_compat_exact (line 50) | def test_json_backwards_compat_exact():
  function test_native_cirq_gate_converts (line 57) | def test_native_cirq_gate_converts():

FILE: glue/crumble/base/cooldown_throttle.js
  class CooldownThrottle (line 22) | class CooldownThrottle {
    method constructor (line 30) | constructor(action, cooldownMs, slowActionCooldownPumpUpFactor=0, wait...
    method _triggerIdle (line 52) | _triggerIdle() {
    method trigger (line 81) | trigger() {
    method _forceIdleTriggerAfter (line 104) | _forceIdleTriggerAfter(duration) {

FILE: glue/crumble/base/describe.js
  constant COLLECTION_CUTOFF (line 17) | const COLLECTION_CUTOFF = 1000;
  constant BAD_TO_STRING_RESULT (line 18) | const BAD_TO_STRING_RESULT = new (function(){})().toString();
  constant RECURSE_LIMIT_DESCRIPTION (line 19) | const RECURSE_LIMIT_DESCRIPTION = "!recursion-limit!";
  constant DEFAULT_RECURSION_LIMIT (line 20) | const DEFAULT_RECURSION_LIMIT = 10;
  function try_describe_atomic (line 22) | function try_describe_atomic(value) {
  function try_describe_collection (line 37) | function try_describe_collection(value, recursionLimit) {
  function describe_fallback (line 52) | function describe_fallback(value, recursionLimit) {
  function describe (line 70) | function describe(value, recursionLimit = DEFAULT_RECURSION_LIMIT) {
  function describe_Map (line 81) | function describe_Map(map, limit) {
  function describe_Set (line 102) | function describe_Set(set, limit) {
  function describe_Iterable (line 119) | function describe_Iterable(seq, limit) {
  function describe_Object (line 137) | function describe_Object(value, limit) {

FILE: glue/crumble/base/describe.test.js
  class DescribableClass (line 20) | class DescribableClass {
    method constructor (line 21) | constructor() { this.x = 1; }
  class DescribedClass (line 23) | class DescribedClass {
    method constructor (line 24) | constructor() { this.x = 1; }
    method toString (line 25) | toString() { return "described"; }
  class SomeIterable (line 27) | class SomeIterable {
    method constructor (line 28) | constructor() {}
  method [Symbol.iterator] (line 31) | [Symbol.iterator]() {

FILE: glue/crumble/base/equate.js
  function equate (line 30) | function equate(subject, other) {
  constant GENERIC_ARRAY_TYPES (line 59) | const GENERIC_ARRAY_TYPES = [
  function isExactlyNaN (line 75) | function isExactlyNaN(v) {
  function tryEquate_custom (line 84) | function tryEquate_custom(subject, other) {
  function isAtomic (line 98) | function isAtomic(value) {
  function isIndexable (line 110) | function isIndexable(value) {
  function eqType (line 119) | function eqType(subject, other) {
  function equate_Indexables (line 128) | function equate_Indexables(subject, other) {
  function equate_Iterables (line 145) | function equate_Iterables(subject, other) {
  function equate_Maps (line 161) | function equate_Maps(subject, other) {
  function equate_Sets (line 185) | function equate_Sets(subject, other) {
  function objectKeys (line 201) | function objectKeys(obj) {
  function equate_Objects (line 216) | function equate_Objects(subject, other) {

FILE: glue/crumble/base/equate.test.js
  class EmptyClass (line 21) | class EmptyClass {
    method constructor (line 22) | constructor() { }
  class EmptyClass2 (line 24) | class EmptyClass2 {
    method constructor (line 25) | constructor() { }
  class PropClass (line 27) | class PropClass {
    method constructor (line 28) | constructor(v) {
  class SomeIterable (line 33) | class SomeIterable {
    method constructor (line 34) | constructor() {}
  method [Symbol.iterator] (line 37) | [Symbol.iterator]() { return [1, 2, 3][Symbol.iterator](); }
  class One (line 39) | class One {
    method constructor (line 40) | constructor() {}
    method isEqualTo (line 41) | isEqualTo(other) {
  class First (line 45) | class First {
    method constructor (line 46) | constructor(x, y) {
    method isEqualTo (line 50) | isEqualTo(other) {
  class Iter (line 54) | class Iter {
    method constructor (line 55) | constructor(items) {
  class Iter2 (line 59) | class Iter2 {
    method constructor (line 60) | constructor(items) {

FILE: glue/crumble/base/history_pusher.js
  function shouldControlURL (line 20) | function shouldControlURL() {
  class HistoryPusher (line 31) | class HistoryPusher {
    method constructor (line 32) | constructor() {
    method currentStateIsMemorableButUnknown (line 51) | currentStateIsMemorableButUnknown() {
    method currentStateIsMemorableAndEqualTo (line 59) | currentStateIsMemorableAndEqualTo(stateObj) {
    method currentStateIsNotMemorable (line 67) | currentStateIsNotMemorable() {
    method stateChange (line 75) | stateChange(stateObj, stateUrlHash) {

FILE: glue/crumble/base/obs.js
  class Observable (line 25) | class Observable {
    method constructor (line 30) | constructor(subscribe) {
    method subscribe (line 44) | subscribe(observer) {
    method of (line 53) | static of(...items) {
    method snapshot (line 67) | snapshot() {
    method map (line 79) | map(transformFunc) {
    method filter (line 88) | filter(predicate) {
    method zipLatest (line 98) | zipLatest(other, mergeFunc) {
    method requestAnimationTicker (line 126) | static requestAnimationTicker() {
    method flattenLatest (line 146) | flattenLatest() {
    method peek (line 171) | peek(action) {
    method flatten (line 180) | flatten() {
    method throttleLatest (line 199) | throttleLatest(cooldownMillis) {
    method elementEvent (line 224) | static elementEvent(element, eventKey) {
    method skip (line 237) | skip(count) {
    method whenDifferent (line 255) | whenDifferent(equater = undefined) {
  class ObservableSource (line 271) | class ObservableSource {
    method constructor (line 272) | constructor() {
    method observable (line 300) | observable() {
    method send (line 308) | send(eventValue) {
  class ObservableValue (line 315) | class ObservableValue {
    method constructor (line 320) | constructor(initialValue=undefined) {
    method observable (line 332) | observable() {
    method set (line 340) | set(newValue) {
    method get (line 349) | get() {

FILE: glue/crumble/base/revision.js
  class Revision (line 24) | class Revision {
    method constructor (line 30) | constructor(history, index, isWorkingOnCommit) {
    method changes (line 53) | changes() {
    method latestActiveCommit (line 60) | latestActiveCommit() {
    method peekActiveCommit (line 68) | peekActiveCommit() {
    method startingAt (line 76) | static startingAt(state) {
    method isAtBeginningOfHistory (line 83) | isAtBeginningOfHistory() {
    method isAtEndOfHistory (line 90) | isAtEndOfHistory() {
    method clear (line 99) | clear(state) {
    method startedWorkingOnCommit (line 112) | startedWorkingOnCommit(newCheckpoint) {
    method cancelCommitBeingWorkedOn (line 122) | cancelCommitBeingWorkedOn() {
    method commit (line 135) | commit(newCheckpoint) {
    method undo (line 153) | undo() {
    method redo (line 171) | redo() {
    method toString (line 186) | toString() {
    method isEqualTo (line 200) | isEqualTo(other) {

FILE: glue/crumble/base/seq.js
  function groupBy (line 8) | function groupBy(items, func) {

FILE: glue/crumble/circuit/circuit.js
  function processTargetsTextIntoTargets (line 11) | function processTargetsTextIntoTargets(targetText) {
  function splitUncombinedTargets (line 39) | function splitUncombinedTargets(targets) {
  function simplifiedMPP (line 73) | function simplifiedMPP(tag, args, combinedTargets, convertIntoOtherGates) {
  function simplifiedSPP (line 112) | function simplifiedSPP(tag, args, dag, combinedTargets) {
  class Circuit (line 139) | class Circuit {
    method constructor (line 144) | constructor(qubitCoordData, layers = []) {
    method fromStimCircuit (line 162) | static fromStimCircuit(stimCircuit) {
    method allQubits (line 483) | allQubits() {
    method rotated45 (line 498) | rotated45() {
    method coordTransformForRectification (line 502) | coordTransformForRectification() {
    method afterRectification (line 547) | afterRectification() {
    method shifted (line 556) | shifted(dx, dy) {
    method copy (line 563) | copy() {
    method afterCoordTransform (line 571) | afterCoordTransform(coordTransform) {
    method collectDetectorsAndObservables (line 588) | collectDetectorsAndObservables(orderForToStimCircuit) {
    method toStimCircuit (line 669) | toStimCircuit() {
    method countMeasurements (line 836) | countMeasurements() {
    method withCoordsIncluded (line 847) | withCoordsIncluded(coords) {
    method coordToQubitMap (line 866) | coordToQubitMap() {
    method toString (line 879) | toString() {
    method isEqualTo (line 887) | isEqualTo(other) {

FILE: glue/crumble/circuit/layer.js
  class Layer (line 5) | class Layer {
    method constructor (line 6) | constructor() {
    method toString (line 14) | toString() {
    method opsGroupedByNameWithArgs (line 33) | opsGroupedByNameWithArgs() {
    method copy (line 68) | copy() {
    method countMeasurements (line 78) | countMeasurements() {
    method hasDissipativeOperations (line 91) | hasDissipativeOperations() {
    method hasSingleQubitCliffords (line 114) | hasSingleQubitCliffords() {
    method hasResetOperations (line 140) | hasResetOperations() {
    method hasMeasurementOperations (line 160) | hasMeasurementOperations() {
    method empty (line 183) | empty() {
    method id_filtered (line 191) | id_filtered(predicate) {
    method id_filteredByQubit (line 210) | id_filteredByQubit(predicate) {
    method id_pauliFrameAfter (line 219) | id_pauliFrameAfter(before, marker_index) {
    method isEmpty (line 304) | isEmpty() {
    method id_pop_at (line 312) | id_pop_at(qubit) {
    method id_dropMarkersAt (line 328) | id_dropMarkersAt(q, index=undefined) {
    method put (line 344) | put(op, allow_overwrite=true) {
    method iter_gates_and_markers (line 370) | *iter_gates_and_markers() {
  function minXY (line 385) | function minXY(xys) {

FILE: glue/crumble/circuit/operation.js
  function expandBase (line 7) | function expandBase(base) {
  class Operation (line 22) | class Operation {
    method constructor (line 29) | constructor(gate, tag, args, targets) {
    method toString (line 48) | toString() {
    method countMeasurements (line 55) | countMeasurements() {
    method pauliFrameAfter (line 72) | pauliFrameAfter(before) {
    method id_draw (line 151) | id_draw(qubitCoordsFunc, ctx) {

FILE: glue/crumble/circuit/pauli_frame.js
  class PauliFrame (line 3) | class PauliFrame {
    method constructor (line 8) | constructor(num_frames, num_qubits) {
    method copy (line 22) | copy() {
    method to_dicts (line 36) | to_dicts(qubit_keys) {
    method from_strings (line 77) | static from_strings(strings) {
    method to_strings (line 125) | to_strings() {
    method from_dicts (line 145) | static from_dicts(dicts, qubit_keys) {
    method do_exchange_xz (line 168) | do_exchange_xz(targets) {
    method do_exchange_xy (line 180) | do_exchange_xy(targets) {
    method do_exchange_yz (line 189) | do_exchange_yz(targets) {
    method do_discard (line 198) | do_discard(targets) {
    method do_measure (line 211) | do_measure(observable, targets) {
    method do_mpp (line 238) | do_mpp(bases, targets) {
    method do_spp (line 266) | do_spp(bases, targets) {
    method do_demolition_measure (line 312) | do_demolition_measure(observable, targets) {
    method do_cycle_xyz (line 339) | do_cycle_xyz(targets) {
    method do_cycle_zyx (line 349) | do_cycle_zyx(targets) {
    method do_swap (line 359) | do_swap(targets) {
    method do_iswap (line 377) | do_iswap(targets) {
    method do_sqrt_xx (line 397) | do_sqrt_xx(targets) {
    method do_sqrt_yy (line 410) | do_sqrt_yy(targets) {
    method do_sqrt_zz (line 437) | do_sqrt_zz(targets) {
    method do_xcx (line 450) | do_xcx(targets) {
    method do_xcy (line 462) | do_xcy(targets) {
    method do_ycy (line 476) | do_ycy(targets) {
    method do_cx (line 492) | do_cx(targets) {
    method do_cx_swap (line 504) | do_cx_swap(targets) {
    method do_swap_cx (line 522) | do_swap_cx(targets) {
    method do_cz_swap (line 540) | do_cz_swap(targets) {
    method do_cy (line 558) | do_cy(targets) {
    method do_cz (line 572) | do_cz(targets) {
    method do_gate (line 585) | do_gate(gate, targets) {
    method undo_gate (line 593) | undo_gate(gate, targets) {
    method isEqualTo (line 601) | isEqualTo(other) {
    method toString (line 616) | toString() {

FILE: glue/crumble/circuit/propagated_pauli_frames.js
  class PropagatedPauliFrameLayer (line 5) | class PropagatedPauliFrameLayer {
    method constructor (line 11) | constructor(bases, errors, crossings) {
    method touchesQidSet (line 21) | touchesQidSet(qids) {
    method mergedWith (line 39) | mergedWith(other) {
    method toString (line 50) | toString() {
  class PropagatedPauliFrames (line 78) | class PropagatedPauliFrames {
    method constructor (line 82) | constructor(layers) {
    method isEqualTo (line 90) | isEqualTo(other) {
    method toString (line 97) | toString() {
    method atLayer (line 112) | atLayer(layer) {
    method fromCircuit (line 125) | static fromCircuit(circuit, marker_index) {
    method fromMeasurements (line 188) | static fromMeasurements(circuit, measurements) {
    method batchFromMeasurements (line 197) | static batchFromMeasurements(circuit, batchMeasurements) {
    method batch32FromMeasurements (line 214) | static batch32FromMeasurements(circuit, batchMeasurements) {

FILE: glue/crumble/draw/config.js
  constant OFFSET_X (line 3) | const OFFSET_X = -pitch + Math.floor(pitch / 4) + 0.5;
  constant OFFSET_Y (line 4) | const OFFSET_Y = -pitch + Math.floor(pitch / 4) + 0.5;

FILE: glue/crumble/draw/draw_util.js
  function beginPathPolygon (line 7) | function beginPathPolygon(ctx, coords) {

FILE: glue/crumble/draw/main_draw.js
  function xyToPos (line 13) | function xyToPos(x, y) {
  function drawCrossMarkers (line 36) | function drawCrossMarkers(ctx, snap, qubitCoordsFunc, propagatedMarkers,...
  function drawMarkers (line 64) | function drawMarkers(ctx, snap, qubitCoordsFunc, propagatedMarkerLayers) {
  function drawSingleMarker (line 80) | function drawSingleMarker(ctx, snap, qubitCoordsFunc, propagatedMarkers,...
  function setDefensiveDrawEnabled (line 170) | function setDefensiveDrawEnabled(val) {
  function defensiveDraw (line 178) | function defensiveDraw(ctx, body) {
  function draw (line 199) | function draw(ctx, snap) {

FILE: glue/crumble/draw/state_snapshot.js
  class StateSnapshot (line 9) | class StateSnapshot {
    method constructor (line 21) | constructor(circuit, curLayer, focusedSet, timelineSet, curMouseX, cur...
    method id_usedQubits (line 40) | id_usedQubits() {
    method timelineQubits (line 47) | timelineQubits() {

FILE: glue/crumble/draw/timeline_viewer.js
  constant TIMELINE_PITCH (line 5) | let TIMELINE_PITCH = 32;
  function drawTimelineMarkers (line 18) | function drawTimelineMarkers(ctx, ds, qubitTimeCoordFunc, propagatedMark...
  function drawTimeline (line 100) | function drawTimeline(ctx, snap, propagatedMarkerLayers, timesliceQubitC...

FILE: glue/crumble/editor/editor_state.js
  function rotated45Transform (line 20) | function rotated45Transform(steps) {
  class EditorState (line 34) | class EditorState {
    method constructor (line 38) | constructor(canvas) {
    method flipTwoQubitGateOrderAtFocus (line 52) | flipTwoQubitGateOrderAtFocus(preview) {
    method reverseLayerOrderFromFocusToEmptyLayer (line 92) | reverseLayerOrderFromFocusToEmptyLayer(preview) {
    method copyOfCurCircuit (line 112) | copyOfCurCircuit() {
    method clearFocus (line 120) | clearFocus() {
    method deleteAtFocus (line 128) | deleteAtFocus(preview) {
    method deleteCurLayer (line 143) | deleteCurLayer(preview) {
    method insertLayer (line 152) | insertLayer(preview) {
    method undo (line 158) | undo() {
    method redo (line 162) | redo() {
    method commit_or_preview (line 170) | commit_or_preview(newCircuit, preview) {
    method commit (line 181) | commit(newCircuit) {
    method preview (line 191) | preview(newCircuit) {
    method toSnapshot (line 200) | toSnapshot(previewCircuit) {
    method force_redraw (line 217) | force_redraw() {
    method clearCircuit (line 222) | clearCircuit() {
    method clearMarkers (line 226) | clearMarkers() {
    method currentPositionsBoxesByMouseDrag (line 238) | currentPositionsBoxesByMouseDrag(parityLock) {
    method applyCoordinateTransform (line 281) | applyCoordinateTransform(coordTransform, preview, moveFocus) {
    method rotate45 (line 303) | rotate45(steps, preview) {
    method changeCurLayerTo (line 315) | changeCurLayerTo(newLayer) {
    method changeFocus (line 325) | changeFocus(newFocus, unionMode, xorMode) {
    method _inferBases (line 345) | _inferBases(affectedQubits) {
    method markFocusInferBasis (line 379) | markFocusInferBasis(preview, markIndex) {
    method unmarkFocusInferBasis (line 425) | unmarkFocusInferBasis(preview) {
    method _writeSingleQubitGateToFocus (line 452) | _writeSingleQubitGateToFocus(preview, gate, gate_args) {
    method _writeTwoQubitGateToFocus (line 471) | _writeTwoQubitGateToFocus(preview, gate, gate_args) {
    method _writeVariableQubitGateToFocus (line 514) | _writeVariableQubitGateToFocus(preview, gate, gate_args) {
    method writeGateToFocus (line 552) | writeGateToFocus(preview, gate, gate_args=undefined) {
    method writeMarkerToObservable (line 569) | writeMarkerToObservable(preview, marker_index) {
    method writeMarkerToDetector (line 573) | writeMarkerToDetector(preview, marker_index) {
    method _writeMarkerToDetOrObs (line 577) | _writeMarkerToDetOrObs(preview, marker_index, isDet) {
    method addDissipativeOverlapToMarkers (line 621) | addDissipativeOverlapToMarkers(preview, marker_index) {
    method moveDetOrObsAtFocusIntoMarker (line 712) | moveDetOrObsAtFocusIntoMarker(preview, marker_index) {

FILE: glue/crumble/editor/sync_url_to_state.js
  function urlWithCircuitHash (line 24) | function urlWithCircuitHash(text) {
  function initUrlCircuitSync (line 42) | function initUrlCircuitSync(revision) {

FILE: glue/crumble/gates/gate.js
  class Gate (line 13) | class Gate {
    method constructor (line 25) | constructor(name,
    method withDefaultArgument (line 48) | withDefaultArgument(newDefaultArgument) {

FILE: glue/crumble/gates/gate_draw_util.js
  function draw_x_control (line 8) | function draw_x_control(ctx, x, y) {
  function draw_y_control (line 35) | function draw_y_control(ctx, x, y) {
  function draw_z_control (line 55) | function draw_z_control(ctx, x, y) {
  function draw_xswap_control (line 70) | function draw_xswap_control(ctx, x, y) {
  function draw_zswap_control (line 99) | function draw_zswap_control(ctx, x, y) {
  function draw_iswap_control (line 128) | function draw_iswap_control(ctx, x, y) {
  function draw_swap_control (line 157) | function draw_swap_control(ctx, x, y) {
  function stroke_degenerate_connector (line 177) | function stroke_degenerate_connector(ctx, x, y) {
  function stroke_connector_to (line 192) | function stroke_connector_to(ctx, x1, y1, x2, y2) {
  function draw_connector (line 228) | function draw_connector(ctx, x1, y1, x2, y2) {

FILE: glue/crumble/gates/gateset.js
  function make_gate_map (line 33) | function make_gate_map() {
  function make_gate_alias_map (line 47) | function make_gate_alias_map() {
  constant GATE_MAP (line 91) | const GATE_MAP = /** @type {Map<!string, !Gate>} */ make_gate_map();
  constant GATE_ALIAS_MAP (line 92) | const GATE_ALIAS_MAP = /** @type {!Map<!string, !{name: undefined|!strin...

FILE: glue/crumble/gates/gateset_markers.js
  function marker_placement (line 11) | function marker_placement(mi, key, hitCount) {
  function make_marker_drawer (line 66) | function make_marker_drawer(color) {

FILE: glue/crumble/gates/gateset_mpp.js
  function make_mpp_gate (line 9) | function make_mpp_gate(bases) {
  function make_spp_gate (line 56) | function make_spp_gate(bases, dag) {

FILE: glue/crumble/keyboard/chord.js
  class ChordEvent (line 4) | class ChordEvent {
    method constructor (line 13) | constructor(inProgress, chord, altKey, ctrlKey, metaKey, shiftKey) {
    method isEqualTo (line 26) | isEqualTo(other) {
    method toString (line 39) | toString() {
  constant MODIFIER_KEYS (line 51) | const MODIFIER_KEYS = new Set(["alt", "shift", "control", "meta"]);
  constant ACTION_KEYS (line 52) | const ACTION_KEYS = new Set(['1', '2', '3', '4', '5', '6', '7', '8', '9'...
  class Chorder (line 54) | class Chorder {
    method constructor (line 55) | constructor() {
    method toEvent (line 65) | toEvent(inProgress) {
    method _queueEvent (line 80) | _queueEvent(inProgress) {
    method handleFocusChanged (line 84) | handleFocusChanged() {
    method handleKeyEvent (line 93) | handleKeyEvent(ev) {

FILE: glue/crumble/keyboard/toolbox.js
  constant DIAM (line 5) | let DIAM = 28;
  constant PITCH (line 6) | let PITCH = DIAM + 4;
  constant PAD (line 7) | let PAD = 10.5;
  constant COLUMNS (line 9) | let COLUMNS = ['H', 'S', 'R', 'M', 'MR', 'C', 'W', 'SC', 'MC', 'P', '1-9'];
  constant DEF_ROW (line 10) | let DEF_ROW = [1,    2,   2,   2,  2,     1,   2,   2,    2,    -1, -1, ...
  function getFocusedRow (line 16) | function getFocusedRow(ev) {
  function getFocusedCol (line 38) | function getFocusedCol(ev) {
  function make_pos_to_gate_dict (line 57) | function make_pos_to_gate_dict() {
  constant POS_TO_GATE_DICT (line 97) | let POS_TO_GATE_DICT = make_pos_to_gate_dict();
  function getToolboxFocusedData (line 103) | function getToolboxFocusedData(ev) {
  function drawToolbox (line 130) | function drawToolbox(ev) {

FILE: glue/crumble/main.js
  constant OFFSET_X (line 13) | const OFFSET_X = -pitch + Math.floor(pitch / 4) + 0.5;
  constant OFFSET_Y (line 14) | const OFFSET_Y = -pitch + Math.floor(pitch / 4) + 0.5;
  function exportCurrentState (line 135) | function exportCurrentState() {
  function makeChordHandlers (line 193) | function makeChordHandlers() {
  function copyToClipboard (line 346) | async function copyToClipboard() {
  function pasteFromClipboard (line 371) | async function pasteFromClipboard(preview) {
  constant CHORD_HANDLERS (line 428) | const CHORD_HANDLERS = makeChordHandlers();
  function handleKeyboardEvent (line 432) | function handleKeyboardEvent(ev) {

FILE: glue/crumble/test/generated_gate_name_list.test.js
  constant KNOWN_GATE_NAMES_FROM_STIM (line 1) | const KNOWN_GATE_NAMES_FROM_STIM = `

FILE: glue/crumble/test/test_util.js
  function test (line 12) | function test(name, body) {
  function indent (line 22) | function indent(text, indentation, indent_first=true) {
  function isSequence (line 36) | function isSequence(obj) {
  function diff (line 45) | function diff(actual, expected) {
  class AsyncAssertSubject (line 107) | class AsyncAssertSubject {
    method constructor (line 111) | constructor(asyncSubject) {
    method withInfo (line 119) | withInfo(info) {
    method runsWithoutThrowingAnException (line 126) | runsWithoutThrowingAnException() {
    method resolvesToAValueThat (line 133) | resolvesToAValueThat() {
    method rejectsWithAnExceptionThat (line 140) | rejectsWithAnExceptionThat() {
    method throwsAnExceptionThat (line 147) | throwsAnExceptionThat() {
    method matches (line 155) | matches(pattern) {
    method isEqualTo (line 163) | isEqualTo(expected) {
    method isNotEqualTo (line 171) | isNotEqualTo(unexpected) {
    method then (line 175) | then(resolve, reject) {
  class AssertSubject (line 186) | class AssertSubject {
    method constructor (line 192) | constructor(value, index, info) {
    method withInfo (line 202) | withInfo(info) {
    method _trace (line 210) | _trace() {
    method _whichAssertion (line 223) | _whichAssertion() {
    method runsWithoutThrowingAnException (line 230) | runsWithoutThrowingAnException() {
    method asyncResolvesToAValueThat (line 249) | asyncResolvesToAValueThat() {
    method asyncRejectsWithAnExceptionThat (line 264) | asyncRejectsWithAnExceptionThat() {
    method throwsAnExceptionThat (line 278) | throwsAnExceptionThat() {
    method matches (line 294) | matches(pattern) {
    method isEqualTo (line 313) | isEqualTo(expected) {
    method isNotEqualTo (line 340) | isNotEqualTo(unexpected) {
  function assertThat (line 362) | function assertThat(value) {
  function skipRestOfTestIfHeadless (line 367) | function skipRestOfTestIfHeadless() {
  class TestProgress (line 378) | class TestProgress {
    method constructor (line 388) | constructor(name, passed, error, num_tests, num_tests_failed, num_test...
  function run_tests (line 403) | async function run_tests(callback, name_filter) {

FILE: glue/crumble/test/test_util.test.js
  function expectFailure (line 3) | function expectFailure(func, match) {
  function asyncExpectFailure (line 19) | async function asyncExpectFailure(func, match) {

FILE: glue/javascript/circuit.js.cc
  function ExposedCircuit (line 29) | ExposedCircuit ExposedCircuit::repeated(size_t repetitions) const {
  function ExposedCircuit (line 33) | ExposedCircuit ExposedCircuit::copy() const {
  function emscripten_bind_circuit (line 45) | void emscripten_bind_circuit() {

FILE: glue/javascript/circuit.js.h
  type ExposedCircuit (line 10) | struct ExposedCircuit {

FILE: glue/javascript/common.js.cc
  function js_val_to_uint32_t (line 5) | uint32_t js_val_to_uint32_t(const emscripten::val &val) {

FILE: glue/javascript/pauli_string.js.cc
  function ExposedPauliString (line 23) | ExposedPauliString ExposedPauliString::random(size_t n) {
  function ExposedPauliString (line 28) | ExposedPauliString ExposedPauliString::times(const ExposedPauliString &o...
  function ExposedPauliString (line 40) | ExposedPauliString ExposedPauliString::neg() const {
  function emscripten_bind_pauli_string (line 75) | void emscripten_bind_pauli_string() {

FILE: glue/javascript/pauli_string.js.h
  type ExposedPauliString (line 10) | struct ExposedPauliString {

FILE: glue/javascript/stim.js.cc
  function EMSCRIPTEN_BINDINGS (line 9) | EMSCRIPTEN_BINDINGS(stim) {

FILE: glue/javascript/stim.test_harness.js
  function test (line 4) | function test(name, handler) {
  function tryPromiseRun (line 8) | function tryPromiseRun(method) {
  function run_all_tests (line 16) | async function run_all_tests() {

FILE: glue/javascript/tableau.js.cc
  function ExposedTableau (line 16) | ExposedTableau ExposedTableau::random(int n) {
  function ExposedTableau (line 21) | ExposedTableau ExposedTableau::from_named_gate(const std::string &name) {
  function ExposedPauliString (line 33) | ExposedPauliString ExposedTableau::x_output(size_t index) const {
  function ExposedPauliString (line 39) | ExposedPauliString ExposedTableau::y_output(size_t index) const {
  function ExposedPauliString (line 54) | ExposedPauliString ExposedTableau::z_output(size_t index) const {
  function ExposedTableau (line 61) | ExposedTableau ExposedTableau::from_conjugated_generators_xs_zs(
  function emscripten_bind_tableau (line 101) | void emscripten_bind_tableau() {

FILE: glue/javascript/tableau.js.h
  type ExposedTableau (line 10) | struct ExposedTableau {

FILE: glue/javascript/tableau_simulator.js.cc
  type JsCircuitInstruction (line 10) | struct JsCircuitInstruction {
    method JsCircuitInstruction (line 13) | JsCircuitInstruction(GateType gate_type, std::vector<GateTarget> targe...
    method JsCircuitInstruction (line 15) | JsCircuitInstruction(GateType gate_type, std::vector<uint32_t> init_ta...
  function JsCircuitInstruction (line 25) | static JsCircuitInstruction args_to_targets(TableauSimulator<MAX_BITWORD...
    method JsCircuitInstruction (line 13) | JsCircuitInstruction(GateType gate_type, std::vector<GateTarget> targe...
    method JsCircuitInstruction (line 15) | JsCircuitInstruction(GateType gate_type, std::vector<uint32_t> init_ta...
  function JsCircuitInstruction (line 38) | static JsCircuitInstruction safe_targets(TableauSimulator<MAX_BITWORD_WI...
    method JsCircuitInstruction (line 13) | JsCircuitInstruction(GateType gate_type, std::vector<GateTarget> targe...
    method JsCircuitInstruction (line 15) | JsCircuitInstruction(GateType gate_type, std::vector<uint32_t> init_ta...
  function JsCircuitInstruction (line 44) | static JsCircuitInstruction safe_targets(TableauSimulator<MAX_BITWORD_WI...
    method JsCircuitInstruction (line 13) | JsCircuitInstruction(GateType gate_type, std::vector<GateTarget> targe...
    method JsCircuitInstruction (line 15) | JsCircuitInstruction(GateType gate_type, std::vector<uint32_t> init_ta...
  function JsCircuitInstruction (line 53) | static JsCircuitInstruction args_to_target_pairs(TableauSimulator<MAX_BI...
    method JsCircuitInstruction (line 13) | JsCircuitInstruction(GateType gate_type, std::vector<GateTarget> targe...
    method JsCircuitInstruction (line 15) | JsCircuitInstruction(GateType gate_type, std::vector<uint32_t> init_ta...
  function ExposedTableau (line 128) | ExposedTableau ExposedTableauSimulator::current_inverse_tableau() const {
  function ExposedTableauSimulator (line 135) | ExposedTableauSimulator ExposedTableauSimulator::copy() const {
  function emscripten_bind_tableau_simulator (line 139) | void emscripten_bind_tableau_simulator() {

FILE: glue/javascript/tableau_simulator.js.h
  type ExposedTableauSimulator (line 13) | struct ExposedTableauSimulator {

FILE: glue/lattice_surgery/lassynth/lattice_surgery_synthesis.py
  function check_lasre (line 22) | def check_lasre(lasre: Mapping[str, Any]) -> None:
  class LatticeSurgerySolution (line 157) | class LatticeSurgerySolution:
    method __init__ (line 165) | def __init__(
    method get_depth (line 177) | def get_depth(self) -> int:
    method after_removing_disconnected_pieces (line 185) | def after_removing_disconnected_pieces(self):
    method after_color_k_pipes (line 189) | def after_color_k_pipes(self):
    method after_default_optimizations (line 193) | def after_default_optimizations(self):
    method after_t_factory_default_optimizations (line 199) | def after_t_factory_default_optimizations(self):
    method save_lasre (line 206) | def save_lasre(self, file_name: str) -> None:
    method to_3d_model_gltf (line 215) | def to_3d_model_gltf(self,
    method to_zigxag_url (line 251) | def to_zigxag_url(
    method to_text_diagram (line 269) | def to_text_diagram(self) -> str:
    method to_networkx_graph (line 277) | def to_networkx_graph(self) -> networkx.Graph:
    method verify_stabilizers_stimzx (line 285) | def verify_stabilizers_stimzx(self,
  class LatticeSurgerySynthesizer (line 314) | class LatticeSurgerySynthesizer:
    method __init__ (line 317) | def __init__(
    method solve (line 333) | def solve(
    method optimize_depth (line 393) | def optimize_depth(
    method try_one_permutation (line 473) | def try_one_permutation(
    method solve_all_port_permutations (line 535) | def solve_all_port_permutations(

FILE: glue/lattice_surgery/lassynth/rewrite_passes/attach_fixups.py
  function attach_fixups (line 7) | def attach_fixups(lasre: Mapping[str, Any]) -> Mapping[str, Any]:

FILE: glue/lattice_surgery/lassynth/rewrite_passes/color_z.py
  function if_uncolorK (line 6) | def if_uncolorK(n_i: int, n_j: int, n_k: int,
  function in_bound (line 20) | def in_bound(n_i: int, n_j: int, n_k: int, i: int, j: int, k: int) -> bool:
  function propogate_IJcolor (line 26) | def propogate_IJcolor(n_i: int, n_j: int, n_k: int,
  function propogate_Kcolor (line 67) | def propogate_Kcolor(n_i: int, n_j: int, n_k: int,
  function assign_Kcolor (line 112) | def assign_Kcolor(n_i: int, n_j: int, n_k: int,
  function color_ports (line 142) | def color_ports(ports: Sequence[Mapping[str, Union[str, int]]],
  function color_kp_km (line 153) | def color_kp_km(
  function color_z (line 189) | def color_z(lasre: Mapping[str, Any]) -> Mapping[str, Any]:

FILE: glue/lattice_surgery/lassynth/rewrite_passes/remove_unconnected.py
  function check_cubes (line 8) | def check_cubes(
  function check_pipes (line 76) | def check_pipes(
  function array3DAnd (line 108) | def array3DAnd(
  function remove_unconnected (line 125) | def remove_unconnected(lasre: Mapping[str, Any]) -> Mapping[str, Any]:

FILE: glue/lattice_surgery/lassynth/sat_synthesis/lattice_surgery_sat.py
  function var_given (line 12) | def var_given(
  function port_incident_pipes (line 55) | def port_incident_pipes(
  function cnf_even_parity_upto4 (line 151) | def cnf_even_parity_upto4(eles: Sequence[Any]) -> Any:
  class LatticeSurgerySAT (line 200) | class LatticeSurgerySAT:
    method __init__ (line 212) | def __init__(
    method process_input (line 238) | def process_input(self, input_dict: Mapping[str, Any]) -> None:
    method get_port_cubes (line 414) | def get_port_cubes(self) -> None:
    method derive_corr_boundary (line 429) | def derive_corr_boundary(
    method build_smt_model (line 507) | def build_smt_model(
    method define_vars (line 552) | def define_vars(self) -> None:
    method plugin_arrs (line 601) | def plugin_arrs(self, data: Mapping[str, Any]) -> None:
    method plugin_vals (line 687) | def plugin_vals(self, data_set: Sequence[Mapping[str, Any]]):
    method constraint_forbid_cube (line 775) | def constraint_forbid_cube(self) -> None:
    method constraint_port (line 790) | def constraint_port(self) -> None:
    method constraint_connect_outside (line 815) | def constraint_connect_outside(self) -> None:
    method constraint_timelike_y (line 834) | def constraint_timelike_y(self) -> None:
    method constraint_ij_color (line 863) | def constraint_ij_color(self) -> None:
    method constraint_3d_corner (line 987) | def constraint_3d_corner(self) -> None:
    method constraint_no_deg1 (line 1017) | def constraint_no_deg1(self) -> None:
    method constraint_corr_ports (line 1067) | def constraint_corr_ports(self) -> None:
    method constraint_corr_y (line 1081) | def constraint_corr_y(self) -> None:
    method constraint_corr_perp (line 1123) | def constraint_corr_perp(self) -> None:
    method constraint_corr_para (line 1357) | def constraint_corr_para(self) -> None:
    method check_z3 (line 1483) | def check_z3(self, print_progress: bool = True) -> bool:
    method check_kissat (line 1510) | def check_kissat(
    method write_cnf (line 1622) | def write_cnf(self,
    method read_kissat_result (line 1650) | def read_kissat_result(self, dimacs_file: str,
    method get_result (line 1754) | def get_result(self) -> Mapping[str, Any]:

FILE: glue/lattice_surgery/lassynth/tools/verify_stabilizers.py
  function verify_stabilizers (line 6) | def verify_stabilizers(

FILE: glue/lattice_surgery/lassynth/translators/gltf_generator.py
  function float_to_little_endian_hex (line 11) | def float_to_little_endian_hex(f):
  function hex_to_bin (line 23) | def hex_to_bin(s):
  function base_gen (line 31) | def base_gen(
  function axes_gen (line 1385) | def axes_gen(SEP: float, max_i: int, max_j: int,
  function tube_gen (line 1496) | def tube_gen(SEP: float, loc: Tuple[int, int, int], dir: str, color: int,
  function cube_gen (line 1725) | def cube_gen(
  function special_gen (line 2286) | def special_gen(
  function gltf_generator (line 2425) | def gltf_generator(lasre: Mapping[str, Any],

FILE: glue/lattice_surgery/lassynth/translators/networkx_generator.py
  function networkx_generator (line 9) | def networkx_generator(lasre: Mapping[str, Any]) -> networkx.Graph:

FILE: glue/lattice_surgery/lassynth/translators/textfig_generator.py
  class TextLayer (line 6) | class TextLayer:
    method __init__ (line 12) | def __init__(self, zx_graph: ZXGridGraph, k: int, if_middle: bool) -> ...
    method set_char (line 28) | def set_char(self, j: int, i: int, character):
    method compute_normal (line 31) | def compute_normal(self, zx_graph: ZXGridGraph, k: int):
    method compute_middle (line 109) | def compute_middle(self, zx_graph: ZXGridGraph, k: int):
    method get_text (line 198) | def get_text(self):
  function textfig_generator (line 209) | def textfig_generator(lasre: dict):

FILE: glue/lattice_surgery/lassynth/translators/zx_grid_graph.py
  class ZXGridNode (line 8) | class ZXGridNode:
    method __init__ (line 10) | def __init__(self, coord3: Tuple[int, int, int],
    method compute_type (line 36) | def compute_type(self) -> None:
    method zigxag_xy (line 90) | def zigxag_xy(self, n_j: int) -> Tuple[int, int]:
    method zigxag_str (line 93) | def zigxag_str(self, n_j: int) -> str:
  class ZXGridEdge (line 107) | class ZXGridEdge:
    method __init__ (line 109) | def __init__(self, if_h: bool, node0: ZXGridNode,
    method zigxag_str (line 132) | def zigxag_str(self, n_j: int) -> str:
  class ZXGridGraph (line 139) | class ZXGridGraph:
    method __init__ (line 141) | def __init__(self, lasre: Mapping[str, Any]) -> None:
    method gather_cube_connectivity (line 158) | def gather_cube_connectivity(self, i: int, j: int,
    method append_y_tails (line 193) | def append_y_tails(self) -> None:
    method derive_edges (line 205) | def derive_edges(self):
    method to_zigxag_url (line 235) | def to_zigxag_url(self, io_spec: Optional[Sequence[str]] = None) -> str:

FILE: glue/lattice_surgery/stimzx/_external_stabilizer.py
  class ExternalStabilizer (line 6) | class ExternalStabilizer:
    method __init__ (line 9) | def __init__(self, *, input: stim.PauliString, output: stim.PauliString):
    method from_dual (line 14) | def from_dual(dual: stim.PauliString, num_inputs: int) -> 'ExternalSta...
    method canonicals_from_duals (line 28) | def canonicals_from_duals(duals: List[stim.PauliString], num_inputs: i...
    method __mul__ (line 55) | def __mul__(self, other: 'ExternalStabilizer') -> 'ExternalStabilizer':
    method __str__ (line 58) | def __str__(self) -> str:
    method __eq__ (line 61) | def __eq__(self, other: Any) -> bool:
    method __ne__ (line 66) | def __ne__(self, other: Any) -> bool:
    method __repr__ (line 69) | def __repr__(self):
  function _eliminate_stabilizers (line 73) | def _eliminate_stabilizers(stabilizers: List[stim.PauliString], eliminat...

FILE: glue/lattice_surgery/stimzx/_external_stabilizer_test.py
  function test_repr (line 5) | def test_repr():

FILE: glue/lattice_surgery/stimzx/_text_diagram_parsing.py
  function text_diagram_to_networkx_graph (line 9) | def text_diagram_to_networkx_graph(text_diagram: str, *, value_func: Cal...
  function _text_to_char_map (line 62) | def _text_to_char_map(text: str) -> Dict[complex, str]:
  function _find_all_edges (line 96) | def _find_all_edges(char_map: Dict[complex, str], terminal_map: Dict[com...
  function _find_end_of_edge (line 114) | def _find_end_of_edge(xy: complex, dxy: complex, char_map: Dict[complex,...
  function _find_nodes (line 143) | def _find_nodes(char_map: Dict[complex, str], value_func: Callable[[str]...

FILE: glue/lattice_surgery/stimzx/_text_diagram_parsing_test.py
  function test_text_to_char_map (line 6) | def test_text_to_char_map():
  function test_find_nodes (line 24) | def test_find_nodes():
  function test_find_end_of_edge (line 85) | def test_find_end_of_edge():
  function test_find_all_edges (line 101) | def test_find_all_edges():
  function test_from_text_diagram (line 115) | def test_from_text_diagram():

FILE: glue/lattice_surgery/stimzx/_zx_graph_solver.py
  class ZxType (line 9) | class ZxType:
    method __init__ (line 12) | def __init__(self, kind: str, quarter_turns: int = 0):
    method __eq__ (line 16) | def __eq__(self, other):
    method __ne__ (line 21) | def __ne__(self, other):
    method __hash__ (line 24) | def __hash__(self):
    method __repr__ (line 27) | def __repr__(self):
  function text_diagram_to_zx_graph (line 46) | def text_diagram_to_zx_graph(text_diagram: str) -> nx.MultiGraph:
  function _reduced_zx_graph (line 94) | def _reduced_zx_graph(graph: Union[nx.Graph, nx.MultiGraph]) -> nx.Graph:
  function zx_graph_to_external_stabilizers (line 109) | def zx_graph_to_external_stabilizers(graph: Union[nx.Graph, nx.MultiGrap...
  function _pseudo_postselect (line 188) | def _pseudo_postselect(sim: stim.TableauSimulator, target: int):

FILE: glue/lattice_surgery/stimzx/_zx_graph_solver_test.py
  function test_disconnected (line 8) | def test_disconnected():
  function test_cnot (line 33) | def test_cnot():
  function test_cz (line 47) | def test_cz():
  function test_s (line 57) | def test_s():
  function test_s_dag (line 63) | def test_s_dag():
  function test_sqrt_x (line 69) | def test_sqrt_x():
  function test_sqrt_x_sqrt_x (line 75) | def test_sqrt_x_sqrt_x():
  function test_sqrt_z_sqrt_z (line 81) | def test_sqrt_z_sqrt_z():
  function test_sqrt_x_dag (line 87) | def test_sqrt_x_dag():
  function test_x (line 93) | def test_x():
  function test_z (line 99) | def test_z():
  function test_id (line 105) | def test_id():
  function test_s_state_distill (line 111) | def test_s_state_distill():
  function external_stabilizers_of_circuit (line 125) | def external_stabilizers_of_circuit(circuit: stim.Circuit) -> List[Exter...

FILE: glue/python/src/stim/__init__.py
  function _pytest_pycharm_pybind_repr_bug_workaround (line 30) | def _pytest_pycharm_pybind_repr_bug_workaround(cls):

FILE: glue/python/src/stim/__init__.pyi
  class Circuit (line 10) | class Circuit:
    method __add__ (line 44) | def __add__(
    method __eq__ (line 66) | def __eq__(
    method __getitem__ (line 73) | def __getitem__(
    method __getitem__ (line 79) | def __getitem__(
    method __getitem__ (line 84) | def __getitem__(
    method __iadd__ (line 126) | def __iadd__(
    method __imul__ (line 149) | def __imul__(
    method __init__ (line 176) | def __init__(
    method __len__ (line 195) | def __len__(
    method __mul__ (line 222) | def __mul__(
    method __ne__ (line 253) | def __ne__(
    method __repr__ (line 259) | def __repr__(
    method __rmul__ (line 264) | def __rmul__(
    method __str__ (line 295) | def __str__(
    method append (line 301) | def append(
    method append (line 311) | def append(
    method append (line 316) | def append(
    method append_from_stim_program_text (line 381) | def append_from_stim_program_text(
    method append_operation (line 407) | def append_operation(
    method approx_equals (line 417) | def approx_equals(
    method clear (line 474) | def clear(
    method compile_detector_sampler (line 489) | def compile_detector_sampler(
    method compile_m2d_converter (line 534) | def compile_m2d_converter(
    method compile_sampler (line 578) | def compile_sampler(
    method copy (line 650) | def copy(
    method count_determined_measurements (line 665) | def count_determined_measurements(
    method decomposed (line 762) | def decomposed(
    method detecting_regions (line 827) | def detecting_regions(
    method detector_error_model (line 955) | def detector_error_model(
    method diagram (line 1050) | def diagram(
    method explain_detector_error_model_errors (line 1179) | def explain_detector_error_model_errors(
    method flattened (line 1235) | def flattened(
    method flattened_operations (line 1273) | def flattened_operations(
    method flow_generators (line 1298) | def flow_generators(
    method from_file (line 1350) | def from_file(
    method generated (line 1390) | def generated(
    method get_detector_coordinates (line 1488) | def get_detector_coordinates(
    method get_final_qubit_coordinates (line 1522) | def get_final_qubit_coordinates(
    method has_all_flows (line 1543) | def has_all_flows(
    method has_flow (line 1598) | def has_flow(
    method insert (line 1718) | def insert(
    method inverse (line 1767) | def inverse(
    method likeliest_error_sat_problem (line 1818) | def likeliest_error_sat_problem(
    method missing_detectors (line 1898) | def missing_detectors(
    method num_detectors (line 1958) | def num_detectors(
    method num_measurements (line 1978) | def num_measurements(
    method num_observables (line 1995) | def num_observables(
    method num_qubits (line 2014) | def num_qubits(
    method num_sweep_bits (line 2036) | def num_sweep_bits(
    method num_ticks (line 2056) | def num_ticks(
    method pop (line 2095) | def pop(
    method reference_detector_and_observable_signs (line 2128) | def reference_detector_and_observable_signs(
    method reference_sample (line 2176) | def reference_sample(
    method search_for_undetectable_logical_errors (line 2208) | def search_for_undetectable_logical_errors(
    method shortest_error_sat_problem (line 2301) | def shortest_error_sat_problem(
    method shortest_graphlike_error (line 2368) | def shortest_graphlike_error(
    method solve_flow_measurements (line 2438) | def solve_flow_measurements(
    method time_reversed_for_flows (line 2529) | def time_reversed_for_flows(
    method to_crumble_url (line 2732) | def to_crumble_url(
    method to_file (line 2777) | def to_file(
    method to_qasm (line 2811) | def to_qasm(
    method to_quirk_url (line 2871) | def to_quirk_url(
    method to_tableau (line 2897) | def to_tableau(
    method with_inlined_feedback (line 2949) | def with_inlined_feedback(
    method without_noise (line 3003) | def without_noise(
    method without_tags (line 3030) | def without_tags(
  class CircuitErrorLocation (line 3050) | class CircuitErrorLocation:
    method __init__ (line 3073) | def __init__(
    method flipped_measurement (line 3130) | def flipped_measurement(
    method flipped_pauli_product (line 3151) | def flipped_pauli_product(
    method instruction_targets (line 3170) | def instruction_targets(
    method noise_tag (line 3197) | def noise_tag(
    method stack_frames (line 3214) | def stack_frames(
    method tick_offset (line 3239) | def tick_offset(
  class CircuitErrorLocationStackFrame (line 3260) | class CircuitErrorLocationStackFrame:
    method __init__ (line 3292) | def __init__(
    method instruction_offset (line 3310) | def instruction_offset(
    method instruction_repetitions_arg (line 3332) | def instruction_repetitions_arg(
    method iteration_index (line 3357) | def iteration_index(
  class CircuitInstruction (line 3381) | class CircuitInstruction:
    method __eq__ (line 3398) | def __eq__(
    method __init__ (line 3404) | def __init__(
    method __ne__ (line 3442) | def __ne__(
    method __repr__ (line 3448) | def __repr__(
    method __str__ (line 3453) | def __str__(
    method gate_args_copy (line 3458) | def gate_args_copy(
    method name (line 3479) | def name(
    method num_measurements (line 3485) | def num_measurements(
    method tag (line 3506) | def tag(
    method target_groups (line 3521) | def target_groups(
    method targets_copy (line 3560) | def targets_copy(
  class CircuitRepeatBlock (line 3576) | class CircuitRepeatBlock:
    method __eq__ (line 3597) | def __eq__(
    method __init__ (line 3603) | def __init__(
    method __ne__ (line 3628) | def __ne__(
    method __repr__ (line 3634) | def __repr__(
    method body_copy (line 3639) | def body_copy(
    method name (line 3664) | def name(
    method num_measurements (line 3686) | def num_measurements(
    method repeat_count (line 3700) | def repeat_count(
    method tag (line 3719) | def tag(
  class CircuitTargetsInsideInstruction (line 3744) | class CircuitTargetsInsideInstruction:
    method __init__ (line 3747) | def __init__(
    method args (line 3771) | def args(
    method gate (line 3790) | def gate(
    method tag (line 3809) | def tag(
    method target_range_end (line 3828) | def target_range_end(
    method target_range_start (line 3850) | def target_range_start(
    method targets_in_range (line 3872) | def targets_in_range(
  class CliffordString (line 3892) | class CliffordString:
    method __add__ (line 3903) | def __add__(
    method __eq__ (line 3920) | def __eq__(
    method __getitem__ (line 3927) | def __getitem__(
    method __getitem__ (line 3933) | def __getitem__(
    method __getitem__ (line 3938) | def __getitem__(
    method __iadd__ (line 3968) | def __iadd__(
    method __imul__ (line 3988) | def __imul__(
    method __init__ (line 4022) | def __init__(
    method __ipow__ (line 4070) | def __ipow__(
    method __len__ (line 4100) | def __len__(
    method __mul__ (line 4110) | def __mul__(
    method __ne__ (line 4131) | def __ne__(
    method __pow__ (line 4137) | def __pow__(
    method __repr__ (line 4173) | def __repr__(
    method __rmul__ (line 4178) | def __rmul__(
    method __setitem__ (line 4202) | def __setitem__(
    method __str__ (line 4259) | def __str__(
    method all_cliffords_string (line 4265) | def all_cliffords_string(
    method copy (line 4286) | def copy(
    method random (line 4306) | def random(
    method x_outputs (line 4323) | def x_outputs(
    method y_outputs (line 4365) | def y_outputs(
    method z_outputs (line 4404) | def z_outputs(
  class CompiledDemSampler (line 4446) | class CompiledDemSampler:
    method sample (line 4475) | def sample(
    method sample_write (line 4625) | def sample_write(
  class CompiledDetectorSampler (line 4703) | class CompiledDetectorSampler:
    method __init__ (line 4706) | def __init__(
    method __repr__ (line 4757) | def __repr__(
    method sample (line 4762) | def sample(
    method sample_bit_packed (line 4857) | def sample_bit_packed(
    method sample_write (line 4885) | def sample_write(
  class CompiledMeasurementSampler (line 4941) | class CompiledMeasurementSampler:
    method __init__ (line 4944) | def __init__(
    method __repr__ (line 5022) | def __repr__(
    method sample (line 5027) | def sample(
    method sample_bit_packed (line 5064) | def sample_bit_packed(
    method sample_write (line 5092) | def sample_write(
  class CompiledMeasurementsToDetectionEventsConverter (line 5129) | class CompiledMeasurementsToDetectionEventsConverter:
    method __init__ (line 5132) | def __init__(
    method __repr__ (line 5175) | def __repr__(
    method convert (line 5181) | def convert(
    method convert (line 5191) | def convert(
    method convert (line 5201) | def convert(
    method convert_file (line 5285) | def convert_file(
  class DemInstruction (line 5351) | class DemInstruction:
    method __eq__ (line 5367) | def __eq__(
    method __init__ (line 5373) | def __init__(
    method __ne__ (line 5407) | def __ne__(
    method __repr__ (line 5413) | def __repr__(
    method __str__ (line 5418) | def __str__(
    method args_copy (line 5423) | def args_copy(
    method tag (line 5446) | def tag(
    method target_groups (line 5462) | def target_groups(
    method targets_copy (line 5491) | def targets_copy(
    method type (line 5513) | def type(
  class DemRepeatBlock (line 5518) | class DemRepeatBlock:
    method __eq__ (line 5535) | def __eq__(
    method __init__ (line 5541) | def __init__(
    method __ne__ (line 5561) | def __ne__(
    method __repr__ (line 5567) | def __repr__(
    method body_copy (line 5572) | def body_copy(
    method repeat_count (line 5590) | def repeat_count(
    method type (line 5596) | def type(
  class DemTarget (line 5618) | class DemTarget:
    method __eq__ (line 5621) | def __eq__(
    method __init__ (line 5627) | def __init__(
    method __ne__ (line 5647) | def __ne__(
    method __repr__ (line 5653) | def __repr__(
    method __str__ (line 5658) | def __str__(
    method is_logical_observable_id (line 5663) | def is_logical_observable_id(
    method is_relative_detector_id (line 5680) | def is_relative_detector_id(
    method is_separator (line 5697) | def is_separator(
    method logical_observable_id (line 5715) | def logical_observable_id(
    method relative_detector_id (line 5738) | def relative_detector_id(
    method separator (line 5761) | def separator(
    method val (line 5779) | def val(
  class DemTargetWithCoords (line 5791) | class DemTargetWithCoords:
    method __init__ (line 5815) | def __init__(
    method coords (line 5835) | def coords(
    method dem_target (line 5855) | def dem_target(
  class DetectorErrorModel (line 5872) | class DetectorErrorModel:
    method __add__ (line 5933) | def __add__(
    method __eq__ (line 5953) | def __eq__(
    method __getitem__ (line 5960) | def __getitem__(
    method __getitem__ (line 5966) | def __getitem__(
    method __getitem__ (line 5971) | def __getitem__(
    method __iadd__ (line 6009) | def __iadd__(
    method __imul__ (line 6030) | def __imul__(
    method __init__ (line 6055) | def __init__(
    method __len__ (line 6072) | def __len__(
    method __mul__ (line 6097) | def __mul__(
    method __ne__ (line 6128) | def __ne__(
    method __repr__ (line 6134) | def __repr__(
    method __rmul__ (line 6139) | def __rmul__(
    method __str__ (line 6170) | def __str__(
    method append (line 6175) | def append(
    method approx_equals (line 6244) | def approx_equals(
    method clear (line 6296) | def clear(
    method compile_sampler (line 6310) | def compile_sampler(
    method copy (line 6372) | def copy(
    method diagram (line 6389) | def diagram(
    method flattened (line 6443) | def flattened(
    method from_file (line 6474) | def from_file(
    method get_detector_coordinates (line 6513) | def get_detector_coordinates(
    method num_detectors (line 6543) | def num_detectors(
    method num_errors (line 6577) | def num_errors(
    method num_observables (line 6599) | def num_observables(
    method rounded (line 6623) | def rounded(
    method shortest_graphlike_error (line 6659) | def shortest_graphlike_error(
    method to_file (line 6748) | def to_file(
    method without_tags (line 6782) | def without_tags(
  class ExplainedError (line 6800) | class ExplainedError:
    method __init__ (line 6825) | def __init__(
    method circuit_error_locations (line 6856) | def circuit_error_locations(
    method dem_error_terms (line 6889) | def dem_error_terms(
  class FlipSimulator (line 6894) | class FlipSimulator:
    method __init__ (line 6907) | def __init__(
    method append_measurement_flips (line 6997) | def append_measurement_flips(
    method batch_size (line 7071) | def batch_size(
    method broadcast_pauli_errors (line 7085) | def broadcast_pauli_errors(
    method clear (line 7137) | def clear(
    method copy (line 7166) | def copy(
    method do (line 7236) | def do(
    method generate_bernoulli_samples (line 7273) | def generate_bernoulli_samples(
    method get_detector_flips (line 7336) | def get_detector_flips(
    method get_measurement_flips (line 7404) | def get_measurement_flips(
    method get_observable_flips (line 7473) | def get_observable_flips(
    method num_detectors (line 7542) | def num_detectors(
    method num_measurements (line 7560) | def num_measurements(
    method num_observables (line 7575) | def num_observables(
    method num_qubits (line 7593) | def num_qubits(
    method peek_pauli_flips (line 7611) | def peek_pauli_flips(
    method peek_pauli_flips (line 7616) | def peek_pauli_flips(
    method peek_pauli_flips (line 7622) | def peek_pauli_flips(
    method set_pauli_flip (line 7672) | def set_pauli_flip(
    method to_numpy (line 7701) | def to_numpy(
  class FlippedMeasurement (line 7853) | class FlippedMeasurement:
    method __init__ (line 7871) | def __init__(
    method observable (line 7890) | def observable(
    method record_index (line 7907) | def record_index(
  class Flow (line 7923) | class Flow:
    method __eq__ (line 7963) | def __eq__(
    method __init__ (line 7969) | def __init__(
    method __mul__ (line 8030) | def __mul__(
    method __ne__ (line 8057) | def __ne__(
    method __repr__ (line 8063) | def __repr__(
    method __str__ (line 8068) | def __str__(
    method included_observables_copy (line 8073) | def included_observables_copy(
    method input_copy (line 8097) | def input_copy(
    method measurements_copy (line 8111) | def measurements_copy(
    method output_copy (line 8125) | def output_copy(
  class GateData (line 8139) | class GateData:
    method __eq__ (line 8158) | def __eq__(
    method __init__ (line 8164) | def __init__(
    method __ne__ (line 8175) | def __ne__(
    method __repr__ (line 8181) | def __repr__(
    method __str__ (line 8186) | def __str__(
    method aliases (line 8192) | def aliases(
    method flows (line 8208) | def flows(
    method generalized_inverse (line 8245) | def generalized_inverse(
    method hadamard_conjugated (line 8289) | def hadamard_conjugated(
    method inverse (line 8344) | def inverse(
    method is_noisy_gate (line 8384) | def is_noisy_gate(
    method is_reset (line 8417) | def is_reset(
    method is_single_qubit_gate (line 8454) | def is_single_qubit_gate(
    method is_symmetric_gate (line 8492) | def is_symmetric_gate(
    method is_two_qubit_gate (line 8541) | def is_two_qubit_gate(
    method is_unitary (line 8579) | def is_unitary(
    method name (line 8608) | def name(
    method num_parens_arguments_range (line 8621) | def num_parens_arguments_range(
    method produces_measurements (line 8649) | def produces_measurements(
    method tableau (line 8682) | def tableau(
    method takes_measurement_record_targets (line 8713) | def takes_measurement_record_targets(
    method takes_pauli_targets (line 8749) | def takes_pauli_targets(
    method unitary_matrix (line 8783) | def unitary_matrix(
  class GateTarget (line 8804) | class GateTarget:
    method __eq__ (line 8817) | def __eq__(
    method __init__ (line 8823) | def __init__(
    method __ne__ (line 8846) | def __ne__(
    method __repr__ (line 8852) | def __repr__(
    method is_combiner (line 8858) | def is_combiner(
    method is_inverted_result_target (line 8883) | def is_inverted_result_target(
    method is_measurement_record_target (line 8908) | def is_measurement_record_target(
    method is_qubit_target (line 8931) | def is_qubit_target(
    method is_sweep_bit_target (line 8954) | def is_sweep_bit_target(
    method is_x_target (line 8977) | def is_x_target(
    method is_y_target (line 9000) | def is_y_target(
    method is_z_target (line 9023) | def is_z_target(
    method pauli_type (line 9046) | def pauli_type(
    method qubit_value (line 9071) | def qubit_value(
    method value (line 9094) | def value(
  class GateTargetWithCoords (line 9119) | class GateTargetWithCoords:
    method __init__ (line 9139) | def __init__(
    method coords (line 9155) | def coords(
    method gate_target (line 9169) | def gate_target(
  class PauliString (line 9180) | class PauliString:
    method __add__ (line 9193) | def __add__(
    method __eq__ (line 9216) | def __eq__(
    method __getitem__ (line 9223) | def __getitem__(
    method __getitem__ (line 9229) | def __getitem__(
    method __getitem__ (line 9234) | def __getitem__(
    method __iadd__ (line 9265) | def __iadd__(
    method __imul__ (line 9291) | def __imul__(
    method __init__ (line 9335) | def __init__(
    method __itruediv__ (line 9404) | def __itruediv__(
    method __len__ (line 9427) | def __len__(
    method __mul__ (line 9439) | def __mul__(
    method __ne__ (line 9491) | def __ne__(
    method __neg__ (line 9497) | def __neg__(
    method __pos__ (line 9511) | def __pos__(
    method __repr__ (line 9525) | def __repr__(
    method __rmul__ (line 9530) | def __rmul__(
    method __setitem__ (line 9581) | def __setitem__(
    method __str__ (line 9613) | def __str__(
    method __truediv__ (line 9618) | def __truediv__(
    method after (line 9640) | def after(
    method after (line 9646) | def after(
    method after (line 9652) | def after(
    method before (line 9688) | def before(
    method before (line 9694) | def before(
    method before (line 9700) | def before(
    method commutes (line 9735) | def commutes(
    method copy (line 9768) | def copy(
    method extended_product (line 9784) | def extended_product(
    method from_numpy (line 9791) | def from_numpy(
    method from_unitary_matrix (line 9841) | def from_unitary_matrix(
    method iter_all (line 9894) | def iter_all(
    method pauli_indices (line 9948) | def pauli_indices(
    method random (line 9986) | def random(
    method sign (line 10017) | def sign(
    method sign (line 10034) | def sign(self, value: complex):
    method to_numpy (line 10036) | def to_numpy(
    method to_tableau (line 10088) | def to_tableau(
    method to_unitary_matrix (line 10131) | def to_unitary_matrix(
    method weight (line 10158) | def weight(
  class PauliStringIterator (line 10174) | class PauliStringIterator:
    method __iter__ (line 10192) | def __iter__(
    method __next__ (line 10201) | def __next__(
  class Tableau (line 10206) | class Tableau:
    method __add__ (line 10239) | def __add__(
    method __call__ (line 10263) | def __call__(
    method __eq__ (line 10295) | def __eq__(
    method __iadd__ (line 10301) | def __iadd__(
    method __init__ (line 10329) | def __init__(
    method __len__ (line 10348) | def __len__(
    method __mul__ (line 10359) | def __mul__(
    method __ne__ (line 10381) | def __ne__(
    method __pow__ (line 10387) | def __pow__(
    method __repr__ (line 10417) | def __repr__(
    method __str__ (line 10422) | def __str__(
    method append (line 10427) | def append(
    method copy (line 10450) | def copy(
    method from_circuit (line 10465) | def from_circuit(
    method from_conjugated_generators (line 10519) | def from_conjugated_generators(
    method from_named_gate (line 10557) | def from_named_gate(
    method from_numpy (line 10584) | def from_numpy(
    method from_stabilizers (line 10683) | def from_stabilizers(
    method from_state_vector (line 10766) | def from_state_vector(
    method from_unitary_matrix (line 10827) | def from_unitary_matrix(
    method inverse (line 10882) | def inverse(
    method inverse_x_output (line 10948) | def inverse_x_output(
    method inverse_x_output_pauli (line 10982) | def inverse_x_output_pauli(
    method inverse_y_output (line 11018) | def inverse_y_output(
    method inverse_y_output_pauli (line 11052) | def inverse_y_output_pauli(
    method inverse_z_output (line 11088) | def inverse_z_output(
    method inverse_z_output_pauli (line 11124) | def inverse_z_output_pauli(
    method iter_all (line 11161) | def iter_all(
    method prepend (line 11192) | def prepend(
    method random (line 11213) | def random(
    method then (line 11233) | def then(
    method to_circuit (line 11257) | def to_circuit(
    method to_numpy (line 11382) | def to_numpy(
    method to_pauli_string (line 11544) | def to_pauli_string(
    method to_stabilizers (line 11574) | def to_stabilizers(
    method to_state_vector (line 11623) | def to_state_vector(
    method to_unitary_matrix (line 11675) | def to_unitary_matrix(
    method x_output (line 11720) | def x_output(
    method x_output_pauli (line 11741) | def x_output_pauli(
    method x_sign (line 11777) | def x_sign(
    method y_output (line 11795) | def y_output(
    method y_output_pauli (line 11816) | def y_output_pauli(
    method y_sign (line 11852) | def y_sign(
    method z_output (line 11872) | def z_output(
    method z_output_pauli (line 11893) | def z_output_pauli(
    method z_sign (line 11929) | def z_sign(
  class TableauIterator (line 11947) | class TableauIterator:
    method __iter__ (line 11959) | def __iter__(
    method __next__ (line 11968) | def __next__(
  class TableauSimulator (line 11973) | class TableauSimulator:
    method __init__ (line 12003) | def __init__(
    method c_xyz (line 12050) | def c_xyz(
    method c_zyx (line 12071) | def c_zyx(
    method canonical_stabilizers (line 12092) | def canonical_stabilizers(
    method cnot (line 12141) | def cnot(
    method copy (line 12164) | def copy(
    method current_inverse_tableau (line 12238) | def current_inverse_tableau(
    method current_measurement_record (line 12272) | def current_measurement_record(
    method cx (line 12297) | def cx(
    method cy (line 12320) | def cy(
    method cz (line 12343) | def cz(
    method depolarize1 (line 12366) | def depolarize1(
    method depolarize2 (line 12383) | def depolarize2(
    method do (line 12402) | def do(
    method do_circuit (line 12428) | def do_circuit(
    method do_pauli_string (line 12447) | def do_pauli_string(
    method do_tableau (line 12463) | def do_tableau(
    method h (line 12505) | def h(
    method h_xy (line 12526) | def h_xy(
    method h_xz (line 12547) | def h_xz(
    method h_yz (line 12568) | def h_yz(
    method iswap (line 12589) | def iswap(
    method iswap_dag (line 12612) | def iswap_dag(
    method measure (line 12635) | def measure(
    method measure_kickback (line 12662) | def measure_kickback(
    method measure_many (line 12717) | def measure_many(
    method measure_observable (line 12736) | def measure_observable(
    method num_qubits (line 12774) | def num_qubits(
    method peek_bloch (line 12792) | def peek_bloch(
    method peek_observable_expectation (line 12838) | def peek_observable_expectation(
    method peek_x (line 12884) | def peek_x(
    method peek_y (line 12917) | def peek_y(
    method peek_z (line 12950) | def peek_z(
    method postselect_observable (line 12983) | def postselect_observable(
    method postselect_x (line 13016) | def postselect_x(
    method postselect_y (line 13055) | def postselect_y(
    method postselect_z (line 13094) | def postselect_z(
    method reset (line 13134) | def reset(
    method reset_x (line 13151) | def reset_x(
    method reset_y (line 13167) | def reset_y(
    method reset_z (line 13183) | def reset_z(
    method s (line 13200) | def s(
    method s_dag (line 13221) | def s_dag(
    method set_inverse_tableau (line 13242) | def set_inverse_tableau(
    method set_num_qubits (line 13269) | def set_num_qubits(
    method set_state_from_stabilizers (line 13306) | def set_state_from_stabilizers(
    method set_state_from_state_vector (line 13396) | def set_state_from_state_vector(
    method sqrt_x (line 13459) | def sqrt_x(
    method sqrt_x_dag (line 13480) | def sqrt_x_dag(
    method sqrt_y (line 13501) | def sqrt_y(
    method sqrt_y_dag (line 13522) | def sqrt_y_dag(
    method state_vector (line 13543) | def state_vector(
    method swap (line 13594) | def swap(
    method x (line 13617) | def x(
    method x_error (line 13638) | def x_error(
    method xcx (line 13655) | def xcx(
    method xcy (line 13678) | def xcy(
    method xcz (line 13701) | def xcz(
    method y (line 13724) | def y(
    method y_error (line 13745) | def y_error(
    method ycx (line 13762) | def ycx(
    method ycy (line 13785) | def ycy(
    method ycz (line 13808) | def ycz(
    method z (line 13831) | def z(
    method z_error (line 13852) | def z_error(
    method zcx (line 13869) | def zcx(
    method zcy (line 13892) | def zcy(
    method zcz (line 13915) | def zcz(
  function gate_data (line 13939) | def gate_data(
  function gate_data (line 13944) | def gate_data(
  function gate_data (line 13947) | def gate_data(
  function main (line 13964) | def main(
  function read_shot_data_file (line 14038) | def read_shot_data_file(
  function read_shot_data_file (line 14049) | def read_shot_data_file(
  function read_shot_data_file (line 14060) | def read_shot_data_file(
  function target_combined_paulis (line 14140) | def target_combined_paulis(
  function target_combiner (line 14167) | def target_combiner(
  function target_inv (line 14186) | def target_inv(
  function target_logical_observable_id (line 14208) | def target_logical_observable_id(
  function target_pauli (line 14230) | def target_pauli(
  function target_rec (line 14269) | def target_rec(
  function target_relative_detector_id (line 14296) | def target_relative_detector_id(
  function target_separator (line 14318) | def target_separator(
  function target_sweep_bit (line 14335) | def target_sweep_bit(
  function target_x (line 14352) | def target_x(
  function target_y (line 14378) | def target_y(
  function target_z (line 14404) | def target_z(
  function write_shot_data_file (line 14430) | def write_shot_data_file(

FILE: glue/python/src/stim/_main_argv.py
  function main_argv (line 6) | def main_argv():

FILE: glue/sample/src/sinter/_collection/_collection.py
  class Progress (line 19) | class Progress:
  function iter_collect (line 36) | def iter_collect(*,
  function collect (line 245) | def collect(*,
  function post_selection_mask_from_predicate (line 434) | def post_selection_mask_from_predicate(
  function post_selection_mask_from_4th_coord (line 448) | def post_selection_mask_from_4th_coord(dem: Union[stim.Circuit, stim.Det...

FILE: glue/sample/src/sinter/_collection/_collection_manager.py
  class _ManagedWorkerState (line 21) | class _ManagedWorkerState:
    method __init__ (line 22) | def __init__(self, worker_id: int, *, cpu_pin: Optional[int] = None):
    method send_message (line 34) | def send_message(self, message: Any):
    method ask_to_return_all_shots (line 37) | def ask_to_return_all_shots(self):
    method has_returned_all_shots (line 48) | def has_returned_all_shots(self) -> bool:
    method is_available_to_reassign (line 51) | def is_available_to_reassign(self) -> bool:
  class _ManagedTaskState (line 55) | class _ManagedTaskState:
    method __init__ (line 56) | def __init__(self, *, partial_task: Task, strong_id: str, shots_left: ...
    method is_completed (line 66) | def is_completed(self) -> bool:
  class CollectionManager (line 70) | class CollectionManager:
    method __init__ (line 71) | def __init__(
    method __enter__ (line 118) | def __enter__(self):
    method __exit__ (line 123) | def __exit__(self, exc_type, exc_val, exc_tb):
    method start_workers (line 129) | def start_workers(self, *, actually_start_worker_processes: bool = True):
    method start_distributing_work (line 187) | def start_distributing_work(self):
    method _compute_task_ids (line 191) | def _compute_task_ids(self):
    method hard_stop (line 251) | def hard_stop(self):
    method _handle_task_progress (line 274) | def _handle_task_progress(self, task_id: Any):
    method state_summary (line 296) | def state_summary(self) -> str:
    method process_message (line 312) | def process_message(self) -> bool:
    method run_until_done (line 392) | def run_until_done(self) -> bool:
    method _distribute_unassigned_workers_to_jobs (line 404) | def _distribute_unassigned_workers_to_jobs(self):
    method _distribute_unassigned_work_to_workers_within_a_job (line 439) | def _distribute_unassigned_work_to_workers_within_a_job(self, task_sta...
    method status_message (line 460) | def status_message(self) -> str:
    method _update_soft_error_threshold_for_a_job (line 533) | def _update_soft_error_threshold_for_a_job(self, task_state: _ManagedT...
    method _take_work_if_unsatisfied_workers_within_a_job (line 546) | def _take_work_if_unsatisfied_workers_within_a_job(self, task_state: _...
    method _distribute_work_within_a_job (line 573) | def _distribute_work_within_a_job(self, t: _ManagedTaskState):
    method _distribute_work (line 577) | def _distribute_work(self):

FILE: glue/sample/src/sinter/_collection/_collection_manager_test.py
  function _assert_drain_queue (line 11) | def _assert_drain_queue(q: multiprocessing.Queue, expected_contents: Lis...
  function _put_wait_not_empty (line 18) | def _put_wait_not_empty(q: Union[multiprocessing.Queue, multiprocessing....
  function test_manager (line 24) | def test_manager():

FILE: glue/sample/src/sinter/_collection/_collection_test.py
  function test_iter_collect (line 13) | def test_iter_collect():
  function test_collect (line 48) | def test_collect():
  function test_collect_from_paths (line 83) | def test_collect_from_paths():
  class AlternatingPredictionsDecoder (line 124) | class AlternatingPredictionsDecoder(sinter.Decoder):
    method decode_via_files (line 125) | def decode_via_files(self,
  function test_collect_custom_decoder (line 141) | def test_collect_custom_decoder():
  function test_iter_collect_list (line 163) | def test_iter_collect_list():
  function test_iter_collect_worker_fails (line 198) | def test_iter_collect_worker_fails():
  class FixedSizeSampler (line 215) | class FixedSizeSampler(sinter.Sampler, sinter.CompiledSampler):
    method compiled_sampler_for_task (line 216) | def compiled_sampler_for_task(self, task: sinter.Task) -> sinter.Compi...
    method sample (line 219) | def sample(self, suggested_shots: int) -> 'sinter.AnonTaskStats':
  function test_fixed_size_sampler (line 226) | def test_fixed_size_sampler():
  class MockTimingSampler (line 245) | class MockTimingSampler(sinter.Sampler, sinter.CompiledSampler):
    method compiled_sampler_for_task (line 246) | def compiled_sampler_for_task(self, task: sinter.Task) -> sinter.Compi...
    method sample (line 249) | def sample(self, suggested_shots: int) -> 'sinter.AnonTaskStats':
  function test_mock_timing_sampler (line 259) | def test_mock_timing_sampler():
  class BatchSizeTrackingSampler (line 275) | class BatchSizeTrackingSampler(sinter.Sampler, sinter.CompiledSampler):
    method __init__ (line 278) | def __init__(self, batch_sizes: list[int]):
    method compiled_sampler_for_task (line 281) | def compiled_sampler_for_task(self, task: sinter.Task) -> sinter.Compi...
    method sample (line 284) | def sample(self, suggested_shots: int) -> sinter.AnonTaskStats:
  function test_ramp_throttled_sampler_respects_max_batch_size (line 293) | def test_ramp_throttled_sampler_respects_max_batch_size():

FILE: glue/sample/src/sinter/_collection/_collection_worker_loop.py
  function collection_worker_loop (line 11) | def collection_worker_loop(

FILE: glue/sample/src/sinter/_collection/_collection_worker_state.py
  function _fill_in_task (line 19) | def _fill_in_task(task: Task) -> Task:
  class CollectionWorkerState (line 48) | class CollectionWorkerState:
    method __init__ (line 49) | def __init__(
    method _send_message_to_manager (line 77) | def _send_message_to_manager(self, message: Any):
    method state_summary (line 80) | def state_summary(self) -> str:
    method flush_results (line 98) | def flush_results(self):
    method accept_shots (line 111) | def accept_shots(self, *, shots_delta: int):
    method return_shots (line 120) | def return_shots(self, *, requested_shots: int):
    method compute_strong_id (line 132) | def compute_strong_id(self, *, new_task: Task):
    method change_job (line 140) | def change_job(self, *, new_task: Task, new_collection_options: Collec...
    method process_messages (line 156) | def process_messages(self) -> int:
    method num_unflushed_errors (line 203) | def num_unflushed_errors(self) -> int:
    method do_some_work (line 208) | def do_some_work(self) -> bool:
    method run_message_loop (line 240) | def run_message_loop(self):

FILE: glue/sample/src/sinter/_collection/_collection_worker_test.py
  class MockWorkHandler (line 12) | class MockWorkHandler(sinter.Sampler, sinter.CompiledSampler):
    method __init__ (line 13) | def __init__(self):
    method compiled_sampler_for_task (line 17) | def compiled_sampler_for_task(self, task: sinter.Task) -> sinter.Compi...
    method handles_throttling (line 21) | def handles_throttling(self) -> bool:
    method sample (line 24) | def sample(self, shots: int) -> sinter.AnonTaskStats:
  function _assert_drain_queue (line 31) | def _assert_drain_queue(q: multiprocessing.Queue, expected_contents: Lis...
  function _put_wait_not_empty (line 37) | def _put_wait_not_empty(q: multiprocessing.Queue, item: Any):
  function test_worker_stop (line 43) | def test_worker_stop():
  function test_worker_skip_work (line 80) | def test_worker_skip_work():
  function test_worker_finish_work (line 136) | def test_worker_finish_work():

FILE: glue/sample/src/sinter/_collection/_mux_sampler.py
  class MuxSampler (line 13) | class MuxSampler(Sampler):
    method __init__ (line 16) | def __init__(
    method compiled_sampler_for_task (line 29) | def compiled_sampler_for_task(self, task: Task) -> CompiledSampler:
    method _resolve_sampler (line 32) | def _resolve_sampler(self, name: str) -> Sampler:

FILE: glue/sample/src/sinter/_collection/_printer.py
  class ThrottledProgressPrinter (line 8) | class ThrottledProgressPrinter:
    method __init__ (line 14) | def __init__(self, *, outs: List[Any], print_progress: bool, min_progr...
    method print_out (line 24) | def print_out(self, msg: str) -> None:
    method show_latest_progress (line 29) | def show_latest_progress(self, msg: str) -> None:
    method flush (line 42) | def flush(self):
    method _try_print_else_delay (line 48) | def _try_print_else_delay(self) -> float:
    method _print_worker (line 59) | def _print_worker(self):

FILE: glue/sample/src/sinter/_collection/_sampler_ramp_throttled.py
  class RampThrottledSampler (line 7) | class RampThrottledSampler(Sampler):
    method __init__ (line 18) | def __init__(self, sub_sampler: Sampler, target_batch_seconds: float, ...
    method __str__ (line 23) | def __str__(self) -> str:
    method compiled_sampler_for_task (line 26) | def compiled_sampler_for_task(self, task: Task) -> CompiledSampler:
  class CompiledRampThrottledSampler (line 38) | class CompiledRampThrottledSampler(CompiledSampler):
    method __init__ (line 39) | def __init__(self, sub_sampler: CompiledSampler, target_batch_seconds:...
    method __str__ (line 45) | def __str__(self) -> str:
    method sample (line 48) | def sample(self, max_shots: int) -> AnonTaskStats:

FILE: glue/sample/src/sinter/_collection/_sampler_ramp_throttled_test.py
  class MockSampler (line 14) | class MockSampler(sinter.Sampler, sinter.CompiledSampler):
    method __init__ (line 17) | def __init__(self):
    method compiled_sampler_for_task (line 20) | def compiled_sampler_for_task(self, task: Task) -> sinter.CompiledSamp...
    method sample (line 23) | def sample(self, suggested_shots: int) -> AnonTaskStats:
  function mock_sampler (line 33) | def mock_sampler():
  function test_initial_batch_size (line 37) | def test_initial_batch_size(mock_sampler):
  function test_batch_size_ramps_up (line 50) | def test_batch_size_ramps_up(mock_sampler):
  function test_batch_size_decreases (line 70) | def test_batch_size_decreases(mock_sampler):
  function test_respects_max_batch_shots (line 89) | def test_respects_max_batch_shots(mock_sampler):
  function test_respects_max_shots_parameter (line 112) | def test_respects_max_shots_parameter(mock_sampler):
  function test_sub_sampler_parameter_pass_through (line 130) | def test_sub_sampler_parameter_pass_through(mock_sampler):

FILE: glue/sample/src/sinter/_command/_main.py
  function main (line 5) | def main(*, command_line_args: Optional[List[str]] = None):

FILE: glue/sample/src/sinter/_command/_main_collect.py
  function iter_file_paths_into_goals (line 18) | def iter_file_paths_into_goals(circuit_paths: Iterator[str],
  function parse_args (line 55) | def parse_args(args: List[str]) -> Any:
  function open_merge_file (line 272) | def open_merge_file(path: str) -> Tuple[Any, ExistingData]:
  function main_collect (line 282) | def main_collect(*, command_line_args: List[str]):

FILE: glue/sample/src/sinter/_command/_main_collect_test.py
  function test_split_by (line 14) | def test_split_by():
  function test_main_collect (line 18) | def test_main_collect():
  class AlternatingPredictionsDecoder (line 106) | class AlternatingPredictionsDecoder(sinter.Decoder):
    method decode_via_files (line 107) | def decode_via_files(self,
  function _make_custom_decoders (line 123) | def _make_custom_decoders():
  function test_main_collect_with_custom_decoder (line 127) | def test_main_collect_with_custom_decoder():
  function test_main_collect_post_select_observables (line 180) | def test_main_collect_post_select_observables():
  function test_main_collect_comma_separated_key_values (line 217) | def test_main_collect_comma_separated_key_values():
  function test_main_collect_count_observable_error_combos (line 260) | def test_main_collect_count_observable_error_combos():
  function test_main_collect_count_detection_events (line 301) | def test_main_collect_count_detection_events():
  function test_cpu_pin (line 340) | def test_cpu_pin():
  function test_custom_error_stopping_count (line 383) | def test_custom_error_stopping_count():
  function test_auto_processes (line 424) | def test_auto_processes():
  function test_implicit_auto_processes (line 455) | def test_implicit_auto_processes():

FILE: glue/sample/src/sinter/_command/_main_combine.py
  function main_combine (line 13) | def main_combine(*, command_line_args: List[str]):

FILE: glue/sample/src/sinter/_command/_main_combine_test.py
  function test_main_combine (line 9) | def test_main_combine():
  function test_main_combine_legacy_custom_counts (line 44) | def test_main_combine_legacy_custom_counts():
  function test_order_flag (line 71) | def test_order_flag():
  function test_order_custom_counts (line 136) | def test_order_custom_counts():

FILE: glue/sample/src/sinter/_command/_main_plot.py
  function parse_args (line 18) | def parse_args(args: List[str]) -> Any:
  function _log_ticks (line 350) | def _log_ticks(
  function _sqrt_ticks (line 367) | def _sqrt_ticks(
  function _pick_min_max (line 402) | def _pick_min_max(
  function _set_axis_scale_label_ticks (line 447) | def _set_axis_scale_label_ticks(
  function _common_json_properties (line 514) | def _common_json_properties(stats: List['sinter.TaskStats']) -> Dict[str...
  function _plot_helper (line 533) | def _plot_helper(
  class _FieldToMetadataWrapper (line 752) | class _FieldToMetadataWrapper:
    method __init__ (line 753) | def __init__(self, d: Dict):
    method __getattr__ (line 756) | def __getattr__(self, item):
  function main_plot (line 762) | def main_plot(*, command_line_args: List[str]):

FILE: glue/sample/src/sinter/_command/_main_plot_test.py
  function test_main_plot (line 11) | def test_main_plot():
  function test_main_plot_2 (line 42) | def test_main_plot_2():
  function test_main_plot_failure_units (line 71) | def test_main_plot_failure_units():
  function test_main_plot_xaxis (line 131) | def test_main_plot_xaxis():
  function test_main_plot_custom_y_func (line 186) | def test_main_plot_custom_y_func():
  function test_log_ticks (line 234) | def test_log_ticks():
  function test_sqrt_ticks (line 250) | def test_sqrt_ticks():
  function test_main_plot_degenerate_data (line 280) | def test_main_plot_degenerate_data():
  function test_main_plot_degenerate_data_sqrt_axis (line 299) | def test_main_plot_degenerate_data_sqrt_axis():
  function test_failure_values_func (line 320) | def test_failure_values_func():
  function test_m_fields (line 354) | def test_m_fields():
  function test_split_custom_counts (line 384) | def test_split_custom_counts():
  function test_line_fits (line 417) | def test_line_fits():

FILE: glue/sample/src/sinter/_command/_main_predict.py
  function parse_args (line 8) | def parse_args(args: List[str]) -> Any:
  function main_predict (line 63) | def main_predict(*, command_line_args: List[str]):

FILE: glue/sample/src/sinter/_command/_main_predict_test.py
  function test_main_predict (line 7) | def test_main_predict():

FILE: glue/sample/src/sinter/_data/_anon_task_stats.py
  class AnonTaskStats (line 11) | class AnonTaskStats:
    method __post_init__ (line 37) | def __post_init__(self):
    method __repr__ (line 49) | def __repr__(self) -> str:
    method __add__ (line 63) | def __add__(self, other: 'AnonTaskStats') -> 'AnonTaskStats':

FILE: glue/sample/src/sinter/_data/_anon_task_stats_test.py
  function test_repr (line 6) | def test_repr():
  function test_add (line 21) | def test_add():

FILE: glue/sample/src/sinter/_data/_collection_options.py
  class CollectionOptions (line 9) | class CollectionOptions:
    method __post_init__ (line 40) | def __post_init__(self):
    method __repr__ (line 54) | def __repr__(self) -> str:
    method combine (line 68) | def combine(self, other: 'sinter.CollectionOptions') -> 'sinter.Collec...
  function nullable_min (line 101) | def nullable_min(a: Optional[int], b: Optional[int]) -> Optional[int]:

FILE: glue/sample/src/sinter/_data/_collection_options_test.py
  function test_repr (line 4) | def test_repr():
  function test_combine (line 21) | def test_combine():

FILE: glue/sample/src/sinter/_data/_csv_out.py
  function escape_csv (line 8) | def escape_csv(text: Any, width: Optional[int]) -> str:
  function csv_line (line 17) | def csv_line(*,

FILE: glue/sample/src/sinter/_data/_existing_data.py
  class ExistingData (line 14) | class ExistingData:
    method __init__ (line 15) | def __init__(self):
    method stats_for (line 18) | def stats_for(self, case: Task) -> AnonTaskStats:
    method add_sample (line 27) | def add_sample(self, sample: TaskStats) -> None:
    method __iadd__ (line 35) | def __iadd__(self, other: 'ExistingData') -> 'ExistingData':
    method from_file (line 41) | def from_file(path_or_file: Any) -> 'ExistingData':
  function stats_from_csv_files (line 91) | def stats_from_csv_files(*paths_or_files: Any) -> List['sinter.TaskStats']:
  function read_stats_from_csv_files (line 135) | def read_stats_from_csv_files(*paths_or_files: Any) -> List['sinter.Task...

FILE: glue/sample/src/sinter/_data/_existing_data_test.py
  function test_read_stats_from_csv_files (line 8) | def test_read_stats_from_csv_files():

FILE: glue/sample/src/sinter/_data/_task.py
  class Task (line 18) | class Task:
    method __init__ (line 66) | def __init__(
    method strong_id_value (line 167) | def strong_id_value(self) -> Dict[str, Any]:
    method strong_id_text (line 206) | def strong_id_text(self) -> str:
    method strong_id_bytes (line 226) | def strong_id_bytes(self) -> bytes:
    method _recomputed_strong_id (line 245) | def _recomputed_strong_id(self) -> str:
    method strong_id (line 248) | def strong_id(self) -> str:
    method __repr__ (line 273) | def __repr__(self) -> str:
    method __eq__ (line 297) | def __eq__(self, other: Any) -> bool:

FILE: glue/sample/src/sinter/_data/_task_stats.py
  function _is_equal_json_values (line 12) | def _is_equal_json_values(json1: Any, json2: Any):
  class TaskStats (line 28) | class TaskStats:
    method __post_init__ (line 73) | def __post_init__(self):
    method with_edits (line 88) | def with_edits(
    method __add__ (line 112) | def __add__(self, other: AnonTaskStats) -> AnonTaskStats:
    method __add__ (line 115) | def __add__(self, other: 'TaskStats') -> 'TaskStats':
    method __add__ (line 117) | def __add__(self, other: Union[AnonTaskStats, 'TaskStats']) -> Union[A...
    method to_anon_stats (line 152) | def to_anon_stats(self) -> AnonTaskStats:
    method to_csv_line (line 177) | def to_csv_line(self) -> str:
    method _split_custom_counts (line 206) | def _split_custom_counts(self, custom_keys: List[str]) -> List['TaskSt...
    method __str__ (line 226) | def __str__(self) -> str:
    method __repr__ (line 229) | def __repr__(self) -> str:

FILE: glue/sample/src/sinter/_data/_task_stats_test.py
  function test_repr (line 9) | def test_repr():
  function test_to_csv_line (line 22) | def test_to_csv_line():
  function test_to_anon_stats (line 35) | def test_to_anon_stats():
  function test_add (line 48) | def test_add():
  function test_with_edits (line 93) | def test_with_edits():
  function test_is_equal_json_values (line 126) | def test_is_equal_json_values():

FILE: glue/sample/src/sinter/_data/_task_test.py
  function test_repr (line 8) | def test_repr():

FILE: glue/sample/src/sinter/_decoding/_decoding.py
  function streaming_post_select (line 22) | def streaming_post_select(*,
  function _streaming_count_mistakes (line 80) | def _streaming_count_mistakes(
  function sample_decode (line 137) | def sample_decode(*,
  function _sample_decode_helper_using_memory (line 257) | def _sample_decode_helper_using_memory(
  function _sample_decode_helper_using_disk (line 326) | def _sample_decode_helper_using_disk(

FILE: glue/sample/src/sinter/_decoding/_decoding_decoder_class.py
  class CompiledDecoder (line 8) | class CompiledDecoder(metaclass=abc.ABCMeta):
    method decode_shots_bit_packed (line 20) | def decode_shots_bit_packed(
  class Decoder (line 58) | class Decoder:
    method compile_decoder_for_dem (line 72) | def compile_decoder_for_dem(
    method decode_via_files (line 102) | def decode_via_files(self,

FILE: glue/sample/src/sinter/_decoding/_decoding_fusion_blossom.py
  class FusionBlossomCompiledDecoder (line 14) | class FusionBlossomCompiledDecoder(CompiledDecoder):
    method __init__ (line 15) | def __init__(self, solver: 'fusion_blossom.SolverSerial', fault_masks:...
    method decode_shots_bit_packed (line 21) | def decode_shots_bit_packed(
  class FusionBlossomDecoder (line 42) | class FusionBlossomDecoder(Decoder):
    method compile_decoder_for_dem (line 45) | def compile_decoder_for_dem(self, *, dem: 'stim.DetectorErrorModel') -...
    method decode_via_files (line 59) | def decode_via_files(self,
  function iter_flatten_model (line 95) | def iter_flatten_model(model: stim.DetectorErrorModel,
  function detector_error_model_to_fusion_blossom_solver_and_fault_masks (line 144) | def detector_error_model_to_fusion_blossom_solver_and_fault_masks(model:...

FILE: glue/sample/src/sinter/_decoding/_decoding_mwpf.py
  function mwpf_import_error (line 14) | def mwpf_import_error() -> ImportError:
  class MwpfCompiledDecoder (line 22) | class MwpfCompiledDecoder(CompiledDecoder):
    method __init__ (line 23) | def __init__(
    method decode_shots_bit_packed (line 35) | def decode_shots_bit_packed(
  class MwpfDecoder (line 73) | class MwpfDecoder(Decoder):
    method __init__ (line 76) | def __init__(
    method compile_decoder_for_dem (line 90) | def compile_decoder_for_dem(
    method decode_via_files (line 107) | def decode_via_files(
  class HyperUFDecoder (line 154) | class HyperUFDecoder(MwpfDecoder):
    method __init__ (line 155) | def __init__(self):
  function iter_flatten_model (line 159) | def iter_flatten_model(
  function deduplicate_hyperedges (line 206) | def deduplicate_hyperedges(
  function detector_error_model_to_mwpf_solver_and_fault_masks (line 230) | def detector_error_model_to_mwpf_solver_and_fault_masks(

FILE: glue/sample/src/sinter/_decoding/_decoding_pymatching.py
  class PyMatchingCompiledDecoder (line 4) | class PyMatchingCompiledDecoder(CompiledDecoder):
    method __init__ (line 5) | def __init__(self, matcher: 'pymatching.Matching'):
    method decode_shots_bit_packed (line 8) | def decode_shots_bit_packed(
  class PyMatchingDecoder (line 21) | class PyMatchingDecoder(Decoder):
    method compile_decoder_for_dem (line 24) | def compile_decoder_for_dem(self, *, dem: 'stim.DetectorErrorModel') -...
    method decode_via_files (line 36) | def decode_via_files(self,

FILE: glue/sample/src/sinter/_decoding/_decoding_test.py
  function get_test_decoders (line 20) | def get_test_decoders() -> Tuple[List[str], Dict[str, sinter.Decoder]]:
  function test_decode_repetition_code (line 59) | def test_decode_repetition_code(decoder: str, force_streaming: Optional[...
  function test_decode_surface_code (line 81) | def test_decode_surface_code(decoder: str, force_streaming: Optional[boo...
  function test_empty (line 103) | def test_empty(decoder: str, force_streaming: Optional[bool]):
  function test_no_observables (line 121) | def test_no_observables(decoder: str, force_streaming: Optional[bool]):
  function test_invincible_observables (line 143) | def test_invincible_observables(decoder: str, force_streaming: Optional[...
  function test_observable_offsets_mod8 (line 166) | def test_observable_offsets_mod8(decoder: str, force_streaming: bool, of...
  function test_no_detectors (line 192) | def test_no_detectors(decoder: str, force_streaming: Optional[bool]):
  function test_no_detectors_with_post_mask (line 213) | def test_no_detectors_with_post_mask(decoder: str, force_streaming: Opti...
  function test_post_selection (line 235) | def test_post_selection(decoder: str, force_streaming: Optional[bool]):
  function test_observable_post_selection (line 268) | def test_observable_post_selection(decoder: str, force_streaming: Option...
  function test_error_splitting (line 294) | def test_error_splitting(decoder: str, force_streaming: Optional[bool]):
  function test_detector_counting (line 324) | def test_detector_counting(decoder: str, force_streaming: Optional[bool]):
  function test_decode_fails_correctly (line 353) | def test_decode_fails_correctly(decoder: str, force_streaming: Optional[...
  function test_full_scale (line 384) | def test_full_scale(decoder: str):
  function test_infer_decode_via_files_from_decode_from_compile_decoder_for_dem (line 397) | def test_infer_decode_via_files_from_decode_from_compile_decoder_for_dem():

FILE: glue/sample/src/sinter/_decoding/_decoding_vacuous.py
  class VacuousDecoder (line 6) | class VacuousDecoder(Decoder):
    method compile_decoder_for_dem (line 10) | def compile_decoder_for_dem(self, *, dem: 'stim.DetectorErrorModel') -...
    method decode_via_files (line 13) | def decode_via_files(self,
  class VacuousCompiledDecoder (line 27) | class VacuousCompiledDecoder(CompiledDecoder):
    method __init__ (line 30) | def __init__(self, shape: int):
    method decode_shots_bit_packed (line 33) | def decode_shots_bit_packed(

FILE: glue/sample/src/sinter/_decoding/_perfectionist_sampler.py
  class PerfectionistSampler (line 9) | class PerfectionistSampler(Sampler):
    method compiled_sampler_for_task (line 11) | def compiled_sampler_for_task(self, task: Task) -> CompiledSampler:
  class CompiledPerfectionistSampler (line 15) | class CompiledPerfectionistSampler(CompiledSampler):
    method __init__ (line 16) | def __init__(self, task: Task):
    method sample (line 19) | def sample(self, max_shots: int) -> AnonTaskStats:

FILE: glue/sample/src/sinter/_decoding/_sampler.py
  class CompiledSampler (line 8) | class CompiledSampler(metaclass=abc.ABCMeta):
    method sample (line 12) | def sample(self, suggested_shots: int) -> 'sinter.AnonTaskStats':
    method handles_throttling (line 43) | def handles_throttling(self) -> bool:
  class Sampler (line 54) | class Sampler(metaclass=abc.ABCMeta):
    method compiled_sampler_for_task (line 70) | def compiled_sampler_for_task(self, task: 'sinter.Task') -> 'sinter.Co...

FILE: glue/sample/src/sinter/_decoding/_stim_then_decode_sampler.py
  class StimThenDecodeSampler (line 15) | class StimThenDecodeSampler(Sampler):
    method __init__ (line 26) | def __init__(
    method compiled_sampler_for_task (line 39) | def compiled_sampler_for_task(self, task: Task) -> CompiledSampler:
  function classify_discards_and_errors (line 49) | def classify_discards_and_errors(
  class DiskDecoder (line 87) | class DiskDecoder(CompiledDecoder):
    method __init__ (line 88) | def __init__(self, decoder: Decoder, task: Task, tmp_dir: pathlib.Path):
    method decode_shots_bit_packed (line 110) | def decode_shots_bit_packed(
  function _compile_decoder_with_disk_fallback (line 136) | def _compile_decoder_with_disk_fallback(
  class _CompiledStimThenDecodeSampler (line 150) | class _CompiledStimThenDecodeSampler(CompiledSampler):
    method __init__ (line 151) | def __init__(
    method sample (line 168) | def sample(self, max_shots: int) -> AnonTaskStats:

FILE: glue/sample/src/sinter/_decoding/_stim_then_decode_sampler_test.py
  function test_classify_discards_and_errors (line 9) | def test_classify_discards_and_errors():

FILE: glue/sample/src/sinter/_plotting.py
  function split_by (line 40) | def split_by(vs: Iterable[T], key_func: Callable[[T], Any]) -> List[List...
  class LooseCompare (line 57) | class LooseCompare:
    method __init__ (line 58) | def __init__(self, val: Any):
    method __lt__ (line 63) | def __lt__(self, other: Any) -> bool:
    method __gt__ (line 71) | def __gt__(self, other: Any) -> bool:
    method __str__ (line 79) | def __str__(self) -> str:
    method __eq__ (line 82) | def __eq__(self, other: Any) -> bool:
  function better_sorted_str_terms (line 92) | def better_sorted_str_terms(val: Any) -> Any:
  function group_by (line 154) | def group_by(items: Iterable[TVal],
  class _FrozenDict (line 189) | class _FrozenDict:
    method __init__ (line 190) | def __init__(self, v: dict):
    method __eq__ (line 202) | def __eq__(self, other):
    method __lt__ (line 207) | def __lt__(self, other):
    method __ne__ (line 212) | def __ne__(self, other):
    method __hash__ (line 215) | def __hash__(self):
    method __getitem__ (line 218) | def __getitem__(self, item):
    method get (line 221) | def get(self, item, alternate = None):
    method __str__ (line 224) | def __str__(self):
  function plot_discard_rate (line 228) | def plot_discard_rate(
  function plot_error_rate (line 317) | def plot_error_rate(
  function _rescale (line 422) | def _rescale(v: Sequence[float], scale: str, invert: bool) -> np.ndarray:
  function plot_custom (line 433) | def plot_custom(

FILE: glue/sample/src/sinter/_plotting_test.py
  function test_better_sorted_str_terms (line 8) | def test_better_sorted_str_terms():
  function test_plotting_does_not_crash (line 41) | def test_plotting_does_not_crash():
  function test_group_by (line 104) | def test_group_by():

FILE: glue/sample/src/sinter/_predict.py
  function _converted_on_disk (line 17) | def _converted_on_disk(
  function predict_on_disk (line 43) | def predict_on_disk(
  function predict_discards_bit_packed (line 172) | def predict_discards_bit_packed(
  function predict_observables (line 216) | def predict_observables(
  function predict_observables_bit_packed (line 287) | def predict_observables_bit_packed(

FILE: glue/sample/src/sinter/_predict_test.py
  function test_predict_on_disk_no_postselect (line 10) | def test_predict_on_disk_no_postselect():
  function test_predict_on_disk_yes_postselect (line 42) | def test_predict_on_disk_yes_postselect():
  function test_predict_discards_bit_packed_none_postselected (line 77) | def test_predict_discards_bit_packed_none_postselected():
  function test_predict_discards_bit_packed_some_postselected (line 95) | def test_predict_discards_bit_packed_some_postselected():
  function test_predict_observables_bit_packed (line 114) | def test_predict_observables_bit_packed():
  function test_predict_observables (line 136) | def test_predict_observables():

FILE: glue/sample/src/sinter/_probability_util.py
  function log_binomial (line 23) | def log_binomial(*, p: Union[float, np.ndarray], n: int, hits: int) -> n...
  function log_factorial (line 87) | def log_factorial(n: int) -> float:
  function binary_search (line 110) | def binary_search(*, func: Callable[[int], float], min_x: int, max_x: in...
  function binary_intercept (line 128) | def binary_intercept(*, func: Callable[[float], float], start_x: float, ...
  function least_squares_cost (line 154) | def least_squares_cost(*, xs: np.ndarray, ys: np.ndarray, intercept: flo...
  function least_squares_through_point (line 160) | def least_squares_through_point(*, xs: np.ndarray, ys: np.ndarray, requi...
  function least_squares_with_slope (line 179) | def least_squares_with_slope(*, xs: np.ndarray, ys: np.ndarray, required...
  class Fit (line 195) | class Fit:
    method __repr__ (line 216) | def __repr__(self) -> str:
  function fit_line_y_at_x (line 220) | def fit_line_y_at_x(*,
  function fit_line_slope (line 274) | def fit_line_slope(*,
  function fit_binomial (line 327) | def fit_binomial(
  function shot_error_rate_to_piece_error_rate (line 384) | def shot_error_rate_to_piece_error_rate(shot_error_rate: float, *, piece...
  function shot_error_rate_to_piece_error_rate (line 387) | def shot_error_rate_to_piece_error_rate(shot_error_rate: 'sinter.Fit', *...
  function shot_error_rate_to_piece_error_rate (line 389) | def shot_error_rate_to_piece_error_rate(shot_error_rate: Union[float, 's...
  function comma_separated_key_values (line 482) | def comma_separated_key_values(path: str) -> Dict[str, Any]:

FILE: glue/sample/src/sinter/_probability_util_test.py
  function test_log_factorial (line 30) | def test_log_factorial(arg, result):
  function test_log_binomial (line 57) | def test_log_binomial(
  function test_binary_search (line 63) | def test_binary_search():
  function test_least_squares_through_point (line 73) | def test_least_squares_through_point():
  function test_binary_intercept (line 91) | def test_binary_intercept():
  function test_fit_y_at_x (line 102) | def test_fit_y_at_x():
  function test_fit_slope (line 112) | def test_fit_slope():
  function test_fit_binomial_shrink_towards_half (line 122) | def test_fit_binomial_shrink_towards_half():
  function test_fit_binomial_vs_log_binomial (line 166) | def test_fit_binomial_vs_log_binomial(n: int, c: int, factor: float):
  function test_comma_separated_key_values (line 193) | def test_comma_separated_key_values():
  function test_shot_error_rate_to_piece_error_rate (line 206) | def test_shot_error_rate_to_piece_error_rate():
  function test_shot_error_rate_to_piece_error_rate_unions (line 241) | def test_shot_error_rate_to_piece_error_rate_unions():
  function test_fit_repr (line 279) | def test_fit_repr():

FILE: glue/zx/stimzx/_external_stabilizer.py
  class ExternalStabilizer (line 6) | class ExternalStabilizer:
    method __init__ (line 9) | def __init__(self, *, input: stim.PauliString, output: stim.PauliString):
    method from_dual (line 14) | def from_dual(dual: stim.PauliString, num_inputs: int) -> 'ExternalSta...
    method canonicals_from_duals (line 28) | def canonicals_from_duals(duals: List[stim.PauliString], num_inputs: i...
    method __mul__ (line 55) | def __mul__(self, other: 'ExternalStabilizer') -> 'ExternalStabilizer':
    method __str__ (line 58) | def __str__(self) -> str:
    method __eq__ (line 61) | def __eq__(self, other: Any) -> bool:
    method __ne__ (line 66) | def __ne__(self, other: Any) -> bool:
    method __repr__ (line 69) | def __repr__(self):
  function _eliminate_stabilizers (line 73) | def _eliminate_stabilizers(stabilizers: List[stim.PauliString], eliminat...

FILE: glue/zx/stimzx/_external_stabilizer_test.py
  function test_repr (line 5) | def test_repr():

FILE: glue/zx/stimzx/_text_diagram_parsing.py
  function text_diagram_to_networkx_graph (line 9) | def text_diagram_to_networkx_graph(text_diagram: str, *, value_func: Cal...
  function _text_to_char_map (line 63) | def _text_to_char_map(text: str) -> Dict[complex, str]:
  function _find_all_edges (line 97) | def _find_all_edges(char_map: Dict[complex, str], terminal_map: Dict[com...
  function _find_end_of_edge (line 115) | def _find_end_of_edge(xy: complex, dxy: complex, char_map: Dict[complex,...
  function _find_nodes (line 144) | def _find_nodes(char_map: Dict[complex, str], value_func: Callable[[str]...

FILE: glue/zx/stimzx/_text_diagram_parsing_test.py
  function test_text_to_char_map (line 6) | def test_text_to_char_map():
  function test_find_nodes (line 24) | def test_find_nodes():
  function test_find_end_of_edge (line 85) | def test_find_end_of_edge():
  function test_find_all_edges (line 101) | def test_find_all_edges():
  function test_from_text_diagram (line 115) | def test_from_text_diagram():

FILE: glue/zx/stimzx/_zx_graph_solver.py
  class ZxType (line 9) | class ZxType:
    method __init__ (line 12) | def __init__(self, kind: str, quarter_turns: int = 0):
    method __eq__ (line 16) | def __eq__(self, other):
    method __ne__ (line 21) | def __ne__(self, other):
    method __hash__ (line 24) | def __hash__(self):
    method __repr__ (line 27) | def __repr__(self):
  function text_diagram_to_zx_graph (line 46) | def text_diagram_to_zx_graph(text_diagram: str) -> nx.MultiGraph:
  function _reduced_zx_graph (line 95) | def _reduced_zx_graph(graph: Union[nx.Graph, nx.MultiGraph]) -> nx.Graph:
  function zx_graph_to_external_stabilizers (line 110) | def zx_graph_to_external_stabilizers(graph: Union[nx.Graph, nx.MultiGrap...
  function _pseudo_postselect (line 189) | def _pseudo_postselect(sim: stim.TableauSimulator, target: int):

FILE: glue/zx/stimzx/_zx_graph_solver_test.py
  function test_disconnected (line 8) | def test_disconnected():
  function test_cnot (line 33) | def test_cnot():
  function test_cz (line 47) | def test_cz():
  function test_s (line 57) | def test_s():
  function test_s_dag (line 63) | def test_s_dag():
  function test_sqrt_x (line 69) | def test_sqrt_x():
  function test_sqrt_x_sqrt_x (line 75) | def test_sqrt_x_sqrt_x():
  function test_sqrt_z_sqrt_z (line 81) | def test_sqrt_z_sqrt_z():
  function test_sqrt_x_dag (line 87) | def test_sqrt_x_dag():
  function test_x (line 93) | def test_x():
  function test_z (line 99) | def test_z():
  function test_id (line 105) | def test_id():
  function test_s_state_distill (line 111) | def test_s_state_distill():
  function external_stabilizers_of_circuit (line 125) | def external_stabilizers_of_circuit(circuit: stim.Circuit) -> List[Exter...
  function test_sign (line 140) | def test_sign():

FILE: setup.py
  function _get_extensions (line 100) | def _get_extensions():

FILE: src/main.cc
  function main (line 17) | int main(int argc, const char **argv) {

FILE: src/stim.test.cc
  function TEST (line 21) | TEST(stim, include1) {
  function TEST (line 27) | TEST(stim, include3) {

FILE: src/stim/circuit/circuit.cc
  type READ_CONDITION (line 27) | enum class READ_CONDITION {
  function fuse_data (line 37) | void fuse_data(SpanRef<const GateTarget> &dst, SpanRef<const GateTarget>...
  function Circuit (line 72) | Circuit &Circuit::operator=(const Circuit &circuit) {
  function Circuit (line 90) | Circuit &Circuit::operator=(Circuit &&circuit) noexcept {
  function is_name_char (line 145) | inline bool is_name_char(int c) {
  function Gate (line 150) | inline const Gate &read_gate_name(int &c, SOURCE read_char) {
  function read_uint63_t (line 167) | uint64_t read_uint63_t(int &c, SOURCE read_char) {
  function read_arbitrary_targets_into (line 184) | inline void read_arbitrary_targets_into(int &c, SOURCE read_char, Circui...
  function read_result_targets64_into (line 194) | inline void read_result_targets64_into(int &c, SOURCE read_char, Circuit...
  function circuit_read_single_operation (line 203) | void circuit_read_single_operation(Circuit &circuit, char lead_char, SOU...
  function circuit_read_operations (line 254) | void circuit_read_operations(Circuit &circuit, SOURCE read_char, READ_CO...
  function Circuit (line 535) | Circuit Circuit::operator+(const Circuit &other) const {
  function Circuit (line 540) | Circuit Circuit::operator*(uint64_t repetitions) const {
  function mono_extend (line 574) | SpanRef<const T> mono_extend(MonotonicBuffer<T> &cur, SpanRef<const T> o...
  function Circuit (line 592) | Circuit &Circuit::operator+=(const Circuit &other) {
  function Circuit (line 619) | Circuit &Circuit::operator*=(uint64_t repetitions) {
  function Circuit (line 634) | Circuit Circuit::from_file(FILE *file) {
  function CircuitStats (line 719) | CircuitStats Circuit::compute_stats() const {
  function Circuit (line 727) | Circuit Circuit::py_get_slice(int64_t start, int64_t step, int64_t slice...
  function Circuit (line 775) | const Circuit Circuit::aliased_noiseless_circuit() const {
  function Circuit (line 809) | Circuit Circuit::without_tags() const {
  function Circuit (line 822) | Circuit Circuit::without_noise() const {
  function flattened_helper (line 865) | void flattened_helper(
  function Circuit (line 895) | Circuit Circuit::flattened() const {
  function Circuit (line 903) | Circuit Circuit::inverse(bool allow_weak_inverse) const {
  function get_final_qubit_coords_helper (line 991) | void get_final_qubit_coords_helper(
  function get_detector_coordinates_helper (line 1068) | void get_detector_coordinates_helper(

FILE: src/stim/circuit/circuit.h
  function namespace (line 36) | namespace stim {
  function is_double_char (line 340) | inline bool is_double_char(int c) {

FILE: src/stim/circuit/circuit.perf.cc
  function BENCHMARK (line 21) | BENCHMARK(circuit_parse) {
  function BENCHMARK (line 35) | BENCHMARK(circuit_parse_sparse) {

FILE: src/stim/circuit/circuit.pybind.cc
  function circuit_repr (line 44) | std::string circuit_repr(const Circuit &self) {
  function circuit_shortest_graphlike_error (line 55) | std::vector<ExplainedError> circuit_shortest_graphlike_error(
  function py_find_undetectable_logical_error (line 63) | std::vector<ExplainedError> py_find_undetectable_logical_error(
  function py_shortest_error_sat_problem (line 78) | std::string py_shortest_error_sat_problem(const Circuit &self, std::stri...
  function py_likeliest_error_sat_problem (line 83) | std::string py_likeliest_error_sat_problem(const Circuit &self, int quan...
  function circuit_get_item (line 88) | pybind11::object circuit_get_item(const Circuit &self, const pybind11::o...
  function circuit_pop (line 110) | pybind11::object circuit_pop(Circuit &self, pybind11::ssize_t index) {
  function circuit_insert (line 124) | void circuit_insert(Circuit &self, pybind11::ssize_t &index, pybind11::o...
  function handle_to_gate_targets (line 153) | void handle_to_gate_targets(const pybind11::handle &obj, std::vector<uin...
  function circuit_append (line 208) | void circuit_append(
  function circuit_append_backwards_compat (line 277) | void circuit_append_backwards_compat(
  function circuit_append_strict (line 285) | void circuit_append_strict(
  function obj_to_abs_detector_id (line 338) | uint64_t obj_to_abs_detector_id(const pybind11::handle &obj, bool fail) {
  function obj_to_abs_detector_id_set (line 360) | std::set<uint64_t> obj_to_abs_detector_id_set(

FILE: src/stim/circuit/circuit.pybind.h
  function namespace (line 22) | namespace stim_pybind {

FILE: src/stim/circuit/circuit.test.cc
  function TEST (line 23) | TEST(circuit, from_text) {
  function TEST (line 172) | TEST(circuit, parse_mpp) {
  function TEST (line 210) | TEST(circuit, parse_spp) {
  function TEST (line 232) | TEST(circuit, parse_spp_dag) {
  function TEST (line 254) | TEST(circuit, parse_tag) {
  function TEST (line 317) | TEST(circuit, parse_sweep_bits) {
  function TEST (line 332) | TEST(circuit, append_circuit) {
  function TEST (line 352) | TEST(circuit, append_op_fuse) {
  function TEST (line 387) | TEST(circuit, str) {
  function TEST (line 415) | TEST(circuit, append_op_validation) {
  function TEST (line 446) | TEST(circuit, repeat_validation) {
  function TEST (line 456) | TEST(circuit, tick_validation) {
  function TEST (line 461) | TEST(circuit, detector_validation) {
  function TEST (line 466) | TEST(circuit, x_error_validation) {
  function TEST (line 476) | TEST(circuit, pauli_err_1_validation) {
  function TEST (line 489) | TEST(circuit, pauli_err_2_validation) {
  function TEST (line 498) | TEST(circuit, qubit_coords) {
  function TEST (line 503) | TEST(circuit, classical_controls) {
  function TEST (line 525) | TEST(circuit, for_each_operation) {
  function TEST (line 557) | TEST(circuit, for_each_operation_reverse) {
  function TEST (line 589) | TEST(circuit, count_qubits) {
  function TEST (line 629) | TEST(circuit, count_sweep_bits) {
  function TEST (line 686) | TEST(circuit, count_detectors_num_observables) {
  function TEST (line 755) | TEST(circuit, max_lookback) {
  function TEST (line 797) | TEST(circuit, count_measurements) {
  function TEST (line 900) | TEST(circuit, preserves_repetition_blocks) {
  function TEST (line 921) | TEST(circuit, multiplication_repeats) {
  function TEST (line 948) | TEST(circuit, self_addition) {
  function TEST (line 981) | TEST(circuit, addition_shares_blocks) {
  function TEST (line 1009) | TEST(circuit, big_rep_count) {
  function TEST (line 1025) | TEST(circuit, zero_repetitions_not_allowed) {
  function TEST (line 1036) | TEST(circuit, negative_float_coordinates) {
  function TEST (line 1052) | TEST(circuit, py_get_slice) {
  function TEST (line 1121) | TEST(circuit, append_repeat_block) {
  function TEST (line 1162) | TEST(circuit, aliased_noiseless_circuit) {
  function TEST (line 1193) | TEST(circuit, noiseless_heralded_erase) {
  function TEST (line 1213) | TEST(circuit, validate_nan_probability) {
  function TEST (line 1218) | TEST(circuit, validate_mpad) {
  function TEST (line 1225) | TEST(circuit, get_final_qubit_coords) {
  function TEST (line 1261) | TEST(circuit, get_final_qubit_coords_huge_repetition_count_efficiency) {
  function TEST (line 1304) | TEST(circuit, count_ticks) {
  function TEST (line 1349) | TEST(circuit, coords_of_detector) {
  function TEST (line 1395) | TEST(circuit, final_coord_shift) {
  function TEST (line 1410) | TEST(circuit, concat_fuse) {
  function TEST (line 1418) | TEST(circuit, concat_self_fuse) {
  function TEST (line 1425) | TEST(circuit, assignment_copies_operations) {
  function TEST (line 1435) | TEST(circuit, flattened) {
  function TEST (line 1443) | TEST(circuit, approx_equals) {
  function TEST (line 1516) | TEST(circuit, equality) {
  function TEST (line 1551) | TEST(circuit, parse_windows_newlines) {
  function TEST (line 1555) | TEST(circuit, inverse) {
  function Circuit (line 1706) | Circuit stim::generate_test_circuit_with_all_operations() {
  function TEST (line 1841) | TEST(circuit, generate_test_circuit_with_all_operations) {
  function TEST (line 1850) | TEST(circuit, insert_circuit) {
  function TEST (line 1914) | TEST(circuit, insert_instruction) {
  function TEST (line 1989) | TEST(circuit, without_tags) {

FILE: src/stim/circuit/circuit.test.h
  function namespace (line 22) | namespace stim {

FILE: src/stim/circuit/circuit2.pybind.cc
  function py_dem_filter_to_dem_target_set (line 36) | static std::set<DemTarget> py_dem_filter_to_dem_target_set(

FILE: src/stim/circuit/circuit_instruction.cc
  function Circuit (line 31) | Circuit &CircuitInstruction::repeat_block_body(Circuit &host) const {
  function CircuitStats (line 38) | CircuitStats CircuitInstruction::compute_stats(const Circuit *host) const {
  function Circuit (line 101) | const Circuit &CircuitInstruction::repeat_block_body(const Circuit &host...

FILE: src/stim/circuit/circuit_instruction.h
  function namespace (line 25) | namespace stim {
  function else (line 129) | else if (flags & stim::GateFlags::GATE_IS_SINGLE_QUBIT_GATE) {
  function else (line 131) | else if (flags & stim::GateFlags::GATE_TARGETS_PAIRS) {
  function else (line 138) | else if (flags & stim::GateFlags::GATE_ONLY_TARGETS_MEASUREMENT_RECORD) {
  function else (line 141) | else if (gate_type == GateType::MPAD || gate_type == GateType::QUBIT_COO...

FILE: src/stim/circuit/circuit_instruction.pybind.cc
  function PyCircuitInstruction (line 32) | PyCircuitInstruction PyCircuitInstruction::from_str(std::string_view tex...
  function PyCircuitInstruction (line 41) | PyCircuitInstruction PyCircuitInstruction::from_instruction(CircuitInstr...
  function CircuitInstruction (line 89) | CircuitInstruction PyCircuitInstruction::as_operation_ref() const {

FILE: src/stim/circuit/circuit_instruction.pybind.h
  function namespace (line 24) | namespace stim_pybind {

FILE: src/stim/circuit/circuit_instruction.test.cc
  function TEST (line 10) | TEST(circuit_instruction, for_combined_targets) {
  function TEST (line 74) | TEST(circuit_instruction, for_combined_targets_works_on_all) {

FILE: src/stim/circuit/circuit_instruction_pybind_test.py
  function test_init_and_equality (line 19) | def test_init_and_equality():
  function test_repr (line 38) | def test_repr(value):
  function test_str (line 43) | def test_str():
  function test_hashable (line 47) | def test_hashable():
  function test_num_measurements (line 55) | def test_num_measurements():
  function test_target_groups (line 62) | def test_target_groups():
  function test_eager_validate (line 81) | def test_eager_validate():
  function test_init_from_str (line 86) | def test_init_from_str():

FILE: src/stim/circuit/circuit_pybind_test.py
  function test_circuit_init_num_measurements_num_qubits (line 24) | def test_circuit_init_num_measurements_num_qubits():
  function test_circuit_append_operation (line 45) | def test_circuit_append_operation():
  function test_circuit_iadd (line 87) | def test_circuit_iadd():
  function test_circuit_add (line 114) | def test_circuit_add():
  function test_circuit_mul (line 134) | def test_circuit_mul():
  function test_circuit_repr (line 169) | def test_circuit_repr():
  function test_circuit_eq (line 182) | def test_circuit_eq():
  function test_circuit_clear (line 207) | def test_circuit_clear():
  function test_circuit_compile_sampler (line 216) | def test_circuit_compile_sampler():
  function test_circuit_compile_detector_sampler (line 244) | def test_circuit_compile_detector_sampler():
  function test_circuit_flattened_operations (line 263) | def test_circuit_flattened_operations():
  function test_copy (line 283) | def test_copy():
  function test_hash (line 290) | def test_hash():
  function test_circuit_generation (line 297) | def test_circuit_generation():
  function test_circuit_generation_errors (line 307) | def test_circuit_generation_errors():
  function test_num_detectors (line 350) | def test_num_detectors():
  function test_num_observables (line 369) | def test_num_observables():
  function test_indexing_operations (line 386) | def test_indexing_operations():
  function test_slicing (line 423) | def test_slicing():
  function test_reappend_gate_targets (line 452) | def test_reappend_gate_targets():
  function test_append_instructions_and_blocks (line 463) | def test_append_instructions_and_blocks():
  function test_circuit_measurement_sampling_seeded (line 522) | def test_circuit_measurement_sampling_seeded():
  function test_circuit_detector_sampling_seeded (line 547) | def test_circuit_detector_sampling_seeded():
  function test_approx_equals (line 573) | def test_approx_equals():
  function test_append_extended_cases (line 585) | def test_append_extended_cases():
  function test_pickle (line 599) | def test_pickle():
  function test_backwards_compatibility_vs_safety_append_vs_append_operation (line 613) | def test_backwards_compatibility_vs_safety_append_vs_append_operation():
  function test_anti_commuting_mpp_error_message (line 626) | def test_anti_commuting_mpp_error_message():
  function test_blocked_remnant_edge_error (line 634) | def test_blocked_remnant_edge_error():
  function test_shortest_graphlike_error (line 664) | def test_shortest_graphlike_error():
  function test_shortest_graphlike_error_empty (line 712) | def test_shortest_graphlike_error_empty():
  function test_shortest_graphlike_error_msgs (line 717) | def test_shortest_graphlike_error_msgs():
  function test_search_for_undetectable_logical_errors_empty (line 767) | def test_search_for_undetectable_logical_errors_empty():
  function test_search_for_undetectable_logical_errors_msgs (line 776) | def test_search_for_undetectable_logical_errors_msgs():
  function test_shortest_error_sat_problem_unrecognized_format (line 831) | def test_shortest_error_sat_problem_unrecognized_format():
  function test_shortest_error_sat_problem (line 844) | def test_shortest_error_sat_problem():
  function test_likeliest_error_sat_problem (line 857) | def test_likeliest_error_sat_problem():
  function test_shortest_graphlike_error_ignore (line 870) | def test_shortest_graphlike_error_ignore():
  function test_coords (line 885) | def test_coords():
  function test_explain_errors (line 899) | def test_explain_errors():
  function test_without_noise (line 964) | def test_without_noise():
  function test_flattened (line 982) | def test_flattened():
  function test_complex_slice_does_not_seg_fault (line 1012) | def test_complex_slice_does_not_seg_fault():
  function test_circuit_from_file (line 1017) | def test_circuit_from_file():
  function test_circuit_to_file (line 1043) | def test_circuit_to_file():
  function test_diagram (line 1070) | def test_diagram():
  function test_circuit_inverse (line 1145) | def test_circuit_inverse():
  function test_circuit_slice_reverse (line 1155) | def test_circuit_slice_reverse():
  function test_with_inlined_feedback_bad_end_eats_into_loop (line 1162) | def test_with_inlined_feedback_bad_end_eats_into_loop():
  function test_with_inlined_feedback (line 1326) | def test_with_inlined_feedback():
  function test_detslice_ops_diagram_no_ticks_does_not_hang (line 1474) | def test_detslice_ops_diagram_no_ticks_does_not_hang():
  function test_num_ticks (line 1478) | def test_num_ticks():
  function test_reference_sample (line 1499) | def test_reference_sample():
  function test_max_mix_depolarization_is_allowed_in_dem_conversion_without_args (line 1527) | def test_max_mix_depolarization_is_allowed_in_dem_conversion_without_arg...
  function test_shortest_graphlike_error_many_obs (line 1573) | def test_shortest_graphlike_error_many_obs():
  function test_detslice_filter_coords_flexibility (line 1588) | def test_detslice_filter_coords_flexibility():
  function test_has_flow_ry (line 1614) | def test_has_flow_ry():
  function test_has_flow_cxs (line 1626) | def test_has_flow_cxs():
  function test_has_flow_cxm (line 1643) | def test_has_flow_cxm():
  function test_has_flow_lattice_surgery (line 1658) | def test_has_flow_lattice_surgery():
  function test_has_flow_lattice_surgery_without_feedback (line 1682) | def test_has_flow_lattice_surgery_without_feedback():
  function test_has_flow_shorthands (line 1714) | def test_has_flow_shorthands():
  function test_decomposed (line 1738) | def test_decomposed():
  function test_detecting_regions (line 1768) | def test_detecting_regions():
  function test_detecting_region_filters (line 1785) | def test_detecting_region_filters():
  function test_detecting_regions_mzz (line 1795) | def test_detecting_regions_mzz():
  function test_insert (line 1811) | def test_insert():
  function test_pop (line 1876) | def test_pop():
  function test_circuit_create_with_odd_cx (line 1894) | def test_circuit_create_with_odd_cx():
  function test_to_tableau (line 1899) | def test_to_tableau():
  function test_circuit_tags (line 1910) | def test_circuit_tags():
  function test_circuit_add_tags (line 1928) | def test_circuit_add_tags():
  function test_circuit_eq_tags (line 1939) | def test_circuit_eq_tags():
  function test_circuit_get_item_tags (line 1966) | def test_circuit_get_item_tags():
  function test_tags_iadd (line 1995) | def test_tags_iadd():
  function test_tags_imul (line 2014) | def test_tags_imul():
  function test_tags_mul (line 2028) | def test_tags_mul():
  function test_tags_append (line 2041) | def test_tags_append():
  function test_tags_append_from_stim_program_text (line 2058) | def test_tags_append_from_stim_program_text():
  function test_tag_approx_equals (line 2070) | def test_tag_approx_equals():
  function test_tag_clear (line 2075) | def test_tag_clear():
  function test_tag_compile_samplers (line 2081) | def test_tag_compile_samplers():
  function test_tag_detector_error_model (line 2095) | def test_tag_detector_error_model():
  function test_tag_copy (line 2109) | def test_tag_copy():
  function test_tag_count_determined_measurements (line 2122) | def test_tag_count_determined_measurements():
  function test_tag_decomposed (line 2131) | def test_tag_decomposed():
  function test_tag_detecting_regions (line 2159) | def test_tag_detecting_regions():
  function test_tag_diagram (line 2169) | def test_tag_diagram():
  function test_tag_flattened (line 2181) | def test_tag_flattened():
  function test_tag_from_file (line 2194) | def test_tag_from_file():
  function test_tag_insert (line 2213) | def test_tag_insert():
  function test_tag_fuse (line 2226) | def test_tag_fuse():
  function test_tag_inverse (line 2239) | def test_tag_inverse():
  function test_tag_time_reversed_for_flows (line 2257) | def test_tag_time_reversed_for_flows():
  function test_tag_with_inlined_feedback (line 2274) | def test_tag_with_inlined_feedback():
  function test_tag_without_noise (line 2291) | def test_tag_without_noise():
  function test_append_tag (line 2304) | def test_append_tag():
  function test_append_pauli_string (line 2318) | def test_append_pauli_string():
  function test_without_tags (line 2349) | def test_without_tags():
  function test_reference_detector_and_observable_signs (line 2358) | def test_reference_detector_and_observable_signs():
  function test_without_noise_removes_id_errors (line 2393) | def test_without_noise_removes_id_errors():
  function test_append_circuit_to_circuit (line 2405) | def test_append_circuit_to_circuit():

FILE: src/stim/circuit/circuit_repeat_block.pybind.cc
  function Circuit (line 32) | Circuit CircuitRepeatBlock::body_copy() {

FILE: src/stim/circuit/circuit_repeat_block.pybind.h
  function namespace (line 22) | namespace stim_pybind {

FILE: src/stim/circuit/circuit_repeat_block_test.py
  function test_init_and_equality (line 19) | def test_init_and_equality():
  function test_repr (line 39) | def test_repr(value):
  function test_name (line 44) | def test_name():

FILE: src/stim/circuit/gate_decomposition.cc
  type ConjugateBySelfInverse (line 25) | struct ConjugateBySelfInverse {
    method ConjugateBySelfInverse (line 28) | ConjugateBySelfInverse(
  function decompose_spp_or_spp_dag_operation_helper (line 163) | static void decompose_spp_or_spp_dag_operation_helper(

FILE: src/stim/circuit/gate_decomposition.h
  function namespace (line 27) | namespace stim {

FILE: src/stim/circuit/gate_decomposition.test.cc
  function TEST (line 24) | TEST(gate_decomposition, decompose_mpp_operation) {
  function TEST (line 98) | TEST(gate_decomposition, decompose_mpp_to_mpad) {
  function TEST (line 125) | TEST(gate_decomposition, decompose_pair_instruction_into_disjoint_segmen...
  function TEST (line 163) | TEST(gate_decomposition, decompose_spp_or_spp_dag_operation_simple) {
  function TEST (line 173) | TEST(gate_decomposition, decompose_spp_or_spp_dag_operation_inverted) {
  function TEST (line 184) | TEST(gate_decomposition, decompose_spp_or_spp_dag_operation_inverted2) {
  function TEST (line 194) | TEST(gate_decomposition, decompose_spp_or_spp_dag_operation_inverted3) {
  function TEST (line 205) | TEST(gate_decomposition, decompose_spp_or_spp_dag_operation_double_inver...
  function TEST (line 215) | TEST(gate_decomposition, decompose_spp_or_spp_dag_operation_triple_inver...
  function TEST (line 226) | TEST(gate_decomposition, decompose_spp_or_spp_dag_operation_complex) {
  function TEST (line 243) | TEST(gate_decomposition, decompose_spp_or_spp_dag_operation_multiple) {
  function TEST (line 261) | TEST(gate_decomposition, decompose_spp_or_spp_dag_operation_empty) {
  function TEST (line 270) | TEST(gate_decomposition, decompose_spp_or_spp_dag_operation_bad) {
  function TEST (line 288) | TEST(gate_decomposition, for_each_disjoint_target_segment_in_instruction...
  function TEST (line 314) | TEST(gate_decomposition, for_each_combined_targets_group) {

FILE: src/stim/circuit/gate_target.cc
  function GateTarget (line 19) | GateTarget GateTarget::pauli_xz(uint32_t qubit, bool x, bool z, bool inv...
  function GateTarget (line 26) | GateTarget GateTarget::from_target_str(std::string_view text) {
  function GateTarget (line 38) | GateTarget GateTarget::x(uint32_t qubit, bool inverted) {
  function GateTarget (line 44) | GateTarget GateTarget::y(uint32_t qubit, bool inverted) {
  function GateTarget (line 50) | GateTarget GateTarget::z(uint32_t qubit, bool inverted) {
  function GateTarget (line 56) | GateTarget GateTarget::qubit(uint32_t qubit, bool inverted) {
  function GateTarget (line 62) | GateTarget GateTarget::rec(int32_t lookback) {
  function GateTarget (line 68) | GateTarget GateTarget::sweep_bit(uint32_t index) {
  function GateTarget (line 71) | GateTarget GateTarget::combiner() {
  function GateTarget (line 240) | GateTarget GateTarget::operator!() const {

FILE: src/stim/circuit/gate_target.h
  type GateTarget (line 35) | struct GateTarget {

FILE: src/stim/circuit/gate_target.pybind.cc
  function GateTarget (line 23) | GateTarget handle_to_gate_target(const pybind11::handle &obj) {
  function GateTarget (line 41) | GateTarget obj_to_gate_target(const pybind11::object &obj) {

FILE: src/stim/circuit/gate_target.pybind.h
  function namespace (line 24) | namespace stim_pybind {

FILE: src/stim/circuit/gate_target.test.cc
  function TEST (line 21) | TEST(gate_target, xyz) {
  function TEST (line 105) | TEST(gate_target, qubit) {
  function TEST (line 136) | TEST(gate_target, record) {
  function TEST (line 156) | TEST(gate_target, sweep) {
  function TEST (line 171) | TEST(gate_target, combiner) {
  function TEST (line 186) | TEST(gate_target, equality) {
  function TEST (line 196) | TEST(gate_target, inverse) {
  function TEST (line 211) | TEST(gate_target, pauli) {
  function TEST (line 226) | TEST(gate_target, from_target_str) {
  function TEST (line 231) | TEST(gate_target, target_str_round_trip) {
  function TEST (line 250) | TEST(gate_target, is_pauli_target) {
  function TEST (line 264) | TEST(gate_target, is_classical_bit_target) {

FILE: src/stim/circuit/gate_target_pybind_test.py
  function test_init_and_equality (line 19) | def test_init_and_equality():
  function test_properties (line 29) | def test_properties():
  function test_repr (line 118) | def test_repr(value):
  function test_hashable (line 123) | def test_hashable():
  function test_pauli_type (line 131) | def test_pauli_type():

FILE: src/stim/cmd/command_analyze_errors.cc
  function SubCommandHelp (line 74) | SubCommandHelp stim::command_analyze_errors_help() {

FILE: src/stim/cmd/command_analyze_errors.h
  function namespace (line 22) | namespace stim {

FILE: src/stim/cmd/command_analyze_errors.test.cc
  function TEST (line 21) | TEST(command_analyze_errors, detector_hypergraph_deprecated) {
  function TEST (line 31) | TEST(command_analyze_errors, analyze_errors) {
  function TEST (line 55) | TEST(command_analyze_errors, analyze_errors_fold_loops) {
  function TEST (line 73) | TEST(command_analyze_errors, analyze_errors_allow_gauge_detectors) {
  function TEST (line 129) | TEST(command_analyze_errors, analyze_errors_all_approximate_disjoint_err...

FILE: src/stim/cmd/command_convert.cc
  type DataDetails (line 29) | struct DataDetails {
  function process_num_flags (line 39) | void process_num_flags(int argc, const char **argv, DataDetails *details...
  function process_dem (line 49) | static void process_dem(const char *dem_path_c_str, DataDetails *details...
  function process_circuit (line 68) | static void process_circuit(const char *circuit_path_c_str, const char *...
  function SubCommandHelp (line 247) | SubCommandHelp stim::command_convert_help() {

FILE: src/stim/cmd/command_convert.h
  function namespace (line 22) | namespace stim {

FILE: src/stim/cmd/command_convert.test.cc
  function TEST (line 22) | TEST(command_convert, convert_measurements_with_circuit_to_dets) {
  function TEST (line 53) | TEST(command_convert, convert_detections_observables_with_circuit_to_det...
  function TEST (line 102) | TEST(command_convert, convert_detections_observables_with_circuit_to_det...
  function TEST (line 157) | TEST(command_convert, convert_detections_observables_with_circuit_no_det...
  function TEST (line 200) | TEST(command_convert, convert_detections_observables_with_dem) {
  function TEST (line 231) | TEST(command_convert, convert_measurements_no_circuit_or_dem) {
  function TEST (line 258) | TEST(command_convert, convert_detections_observables_no_circuit_or_dem) {
  function TEST (line 285) | TEST(command_convert, convert_bits_per_shot_no_dets) {
  function TEST (line 308) | TEST(command_convert, convert_multiple_bitword_sized_records) {
  function TEST (line 315) | TEST(command_convert, convert_circuit_fail_without_types) {
  function TEST (line 334) | TEST(command_convert, convert_fail_without_any_information) {
  function TEST (line 340) | TEST(command_convert, convert_fail_with_bits_per_shot_to_dets) {
  function TEST (line 346) | TEST(command_convert, convert_invalid_types) {

FILE: src/stim/cmd/command_detect.cc
  function SubCommandHelp (line 81) | SubCommandHelp stim::command_detect_help() {

FILE: src/stim/cmd/command_detect.h
  function namespace (line 22) | namespace stim {

FILE: src/stim/cmd/command_detect.test.cc
  function TEST (line 21) | TEST(command_detect, detect_basic) {
  function TEST (line 185) | TEST(command_detect, detection_event_simulator_counts_measurements_corre...
  function TEST (line 198) | TEST(command_detect, seeded_detecting) {

FILE: src/stim/cmd/command_diagram.cc
  type DiagramTypes (line 34) | enum class DiagramTypes {
  function _read_circuit (line 50) | stim::Circuit _read_circuit(RaiiFile &in, int argc, const char **argv) {
  function _read_dem (line 59) | stim::DetectorErrorModel _read_dem(RaiiFile &in, int argc, const char **...
  function _read_coord_filter (line 90) | std::vector<CoordFilter> _read_coord_filter(int argc, const char **argv) {
  function DiagramTypes (line 103) | DiagramTypes _read_diagram_type(int argc, const char **argv) {
  function _read_tick (line 140) | bool _read_tick(int argc, const char **argv, uint64_t *tick, uint64_t *t...
  function SubCommandHelp (line 255) | SubCommandHelp stim::command_diagram_help() {

FILE: src/stim/cmd/command_diagram.h
  function namespace (line 22) | namespace stim {

FILE: src/stim/cmd/command_diagram.pybind.cc
  function escape_html_for_srcdoc (line 49) | std::string escape_html_for_srcdoc(std::string_view src) {
  function diagram_as_html (line 77) | pybind11::object diagram_as_html(const DiagramHelper &self) {
  function DiagramHelper (line 161) | DiagramHelper stim_pybind::dem_diagram(const DetectorErrorModel &dem, st...
  function CoordFilter (line 186) | CoordFilter item_to_filter_single(const pybind11::handle &obj) {
  function item_to_filter_multi (line 219) | std::vector<CoordFilter> item_to_filter_multi(const pybind11::object &ob...
  function DiagramHelper (line 237) | DiagramHelper stim_pybind::circuit_diagram(

FILE: src/stim/cmd/command_diagram.pybind.h
  function DiagramType (line 25) | enum class DiagramType {

FILE: src/stim/cmd/command_diagram.test.cc
  function TEST (line 22) | TEST(command_diagram, run_captured_stim_main) {
  function TEST (line 41) | TEST(command_diagram, run_captured_stim_main_detector_slice) {
  function TEST (line 100) | TEST(command_diagram, run_captured_stim_main_timeline_ticking) {
  function TEST (line 137) | TEST(command_diagram, run_captured_stim_main_works_various_arguments) {
  function TEST (line 175) | TEST(command_diagram, warn_about_noiseless_match_graphs) {

FILE: src/stim/cmd/command_explain_errors.cc
  function SubCommandHelp (line 47) | SubCommandHelp stim::command_explain_errors_help() {

FILE: src/stim/cmd/command_explain_errors.h
  function namespace (line 22) | namespace stim {

FILE: src/stim/cmd/command_explain_errors.test.cc
  function TEST (line 22) | TEST(command_explain_errors, explain_errors) {

FILE: src/stim/cmd/command_gen.cc
  function SubCommandHelp (line 65) | SubCommandHelp stim::command_gen_help() {

FILE: src/stim/cmd/command_gen.h
  function namespace (line 22) | namespace stim {

FILE: src/stim/cmd/command_gen.test.cc
  function TEST (line 57) | TEST(command_gen, execute) {

FILE: src/stim/cmd/command_help.cc
  function make_sub_command_help (line 94) | std::vector<SubCommandHelp> make_sub_command_help() {
  function to_upper_case (line 117) | std::string to_upper_case(std::string_view val) {
  type Acc (line 126) | struct Acc {
    method flush (line 131) | void flush() {
    method change_indent (line 144) | void change_indent(int t) {
    method Acc (line 154) | Acc &operator<<(const T &other) {
  function print_fixed_width_float (line 160) | void print_fixed_width_float(Acc &out, float f, char u) {
  function print_example (line 175) | void print_example(Acc &out, std::string_view name, const Gate &gate) {
  function print_decomposition (line 247) | void print_decomposition(Acc &out, const Gate &gate) {
  function print_mbqc_decomposition (line 269) | void print_mbqc_decomposition(Acc &out, const Gate &gate) {
  function print_stabilizer_generators (line 292) | void print_stabilizer_generators(Acc &out, const Gate &gate) {
  function print_bloch_vector (line 319) | void print_bloch_vector(Acc &out, const Gate &gate) {
  function print_unitary_matrix (line 372) | void print_unitary_matrix(Acc &out, const Gate &gate) {
  function generate_per_gate_help_markdown (line 425) | std::string generate_per_gate_help_markdown(const Gate &alt_gate, int in...
  function generate_subcommand_markdown (line 460) | std::string generate_subcommand_markdown(const SubCommandHelp &data, int...
  function generate_per_format_markdown (line 475) | std::string generate_per_format_markdown(const FileFormatData &format_da...
  function generate_format_help_markdown (line 499) | std::map<std::string, std::string> generate_format_help_markdown() {
  function generate_command_help_topics (line 554) | std::map<std::string, std::string> generate_command_help_topics() {
  function generate_gate_help_markdown (line 607) | std::map<std::string, std::string> generate_gate_help_markdown() {

FILE: src/stim/cmd/command_help.h
  function namespace (line 27) | namespace stim {

FILE: src/stim/cmd/command_m2d.cc
  function SubCommandHelp (line 85) | SubCommandHelp stim::command_m2d_help() {

FILE: src/stim/cmd/command_m2d.h
  function namespace (line 22) | namespace stim {

FILE: src/stim/cmd/command_m2d.test.cc
  function TEST (line 22) | TEST(command_m2d, m2d) {
  function TEST (line 64) | TEST(command_m2d, m2d_without_feedback) {
  function TEST (line 122) | TEST(command_m2d, m2d_obs_size_misalign_1_obs) {
  function TEST (line 140) | TEST(command_m2d, m2d_obs_size_misalign_11_obs) {
  function TEST (line 158) | TEST(command_m2d, unphysical_observable_annotations) {

FILE: src/stim/cmd/command_repl.cc
  function SubCommandHelp (line 31) | SubCommandHelp stim::command_repl_help() {

FILE: src/stim/cmd/command_repl.h
  function namespace (line 22) | namespace stim {

FILE: src/stim/cmd/command_sample.cc
  function SubCommandHelp (line 81) | SubCommandHelp stim::command_sample_help() {

FILE: src/stim/cmd/command_sample.h
  function namespace (line 22) | namespace stim {

FILE: src/stim/cmd/command_sample.test.cc
  function line_freq_with_lifetime_matching_arg (line 24) | std::unordered_map<std::string_view, size_t> line_freq_with_lifetime_mat...
  function deviation (line 37) | std::string deviation(std::string_view sample_content, const std::unorde...
  function TEST (line 73) | TEST(command_sample, sample_flag) {
  function TEST (line 140) | TEST(command_sample, intentional_failures) {
  function TEST (line 160) | TEST(command_sample, basic_distributions) {
  function TEST (line 194) | TEST(command_sample, sample_x_error) {
  function TEST (line 216) | TEST(command_sample, sample_z_error) {
  function TEST (line 238) | TEST(command_sample, sample_y_error) {
  function TEST (line 260) | TEST(command_sample, sample_depolarize1_error) {
  function TEST (line 293) | TEST(command_sample, sample_depolarize2_error) {
  function TEST (line 317) | TEST(command_sample, sample_measure_reset) {
  function TEST (line 338) | TEST(command_sample, skip_reference_sample_flag) {
  function TEST (line 388) | TEST(command_sample, seeded_sampling) {

FILE: src/stim/cmd/command_sample_dem.cc
  function SubCommandHelp (line 93) | SubCommandHelp stim::command_sample_dem_help() {

FILE: src/stim/cmd/command_sample_dem.h
  function namespace (line 22) | namespace stim {

FILE: src/stim/cmd/command_sample_dem.test.cc
  function TEST (line 22) | TEST(main, sample_dem) {

FILE: src/stim/dem/dem_instruction.cc
  function DemTarget (line 14) | DemTarget DemTarget::observable_id(uint64_t id) {
  function DemTarget (line 20) | DemTarget DemTarget::relative_detector_id(uint64_t id) {
  function DemTarget (line 78) | DemTarget DemTarget::from_text(std::string_view text) {
  function DetectorErrorModel (line 266) | const DetectorErrorModel &DemInstruction::repeat_block_body(const Detect...
  function DetectorErrorModel (line 273) | DetectorErrorModel &DemInstruction::repeat_block_body(DetectorErrorModel...

FILE: src/stim/dem/dem_instruction.h
  type class (line 16) | enum class
  type DemTarget (line 24) | struct DemTarget {
  type DetectorErrorModel (line 47) | struct DetectorErrorModel
  type DemInstruction (line 48) | struct DemInstruction {

FILE: src/stim/dem/dem_instruction.pybind.cc
  function DemInstruction (line 22) | DemInstruction ExposedDemInstruction::as_dem_instruction() const {
  function ExposedDemInstruction (line 26) | ExposedDemInstruction ExposedDemInstruction::from_dem_instruction(stim::...
  function ExposedDemInstruction (line 34) | ExposedDemInstruction ExposedDemInstruction::from_str(std::string_view t...

FILE: src/stim/dem/dem_instruction.pybind.h
  function namespace (line 8) | namespace stim_pybind {

FILE: src/stim/dem/dem_instruction.test.cc
  function TEST (line 9) | TEST(dem_instruction, from_str) {
  function TEST (line 35) | TEST(dem_instruction, for_separated_targets) {

FILE: src/stim/dem/dem_instruction_pybind_test.py
  function test_args_copy (line 5) | def test_args_copy():
  function test_targets_copy (line 12) | def test_targets_copy():
  function test_type (line 20) | def test_type():
  function test_equality (line 28) | def test_equality():
  function test_validation (line 38) | def test_validation():
  function test_str (line 56) | def test_str():
  function test_repr (line 63) | def test_repr():
  function test_hashable (line 70) | def test_hashable():
  function test_target_groups (line 78) | def test_target_groups():
  function test_init_from_str (line 83) | def test_init_from_str():
  function test_tag (line 104) | def test_tag():

FILE: src/stim/dem/detector_error_model.cc
  function DetectorErrorModel (line 167) | DetectorErrorModel &DetectorErrorModel::operator=(const DetectorErrorMod...
  function DetectorErrorModel (line 185) | DetectorErrorModel &DetectorErrorModel::operator=(DetectorErrorModel &&o...
  type DEM_READ_CONDITION (line 196) | enum class DEM_READ_CONDITION {
  function is_name_char (line 202) | inline bool is_name_char(int c) {
  function DemInstructionType (line 207) | inline DemInstructionType read_instruction_name(int &c, SOURCE read_char) {
  function read_uint60_t (line 235) | uint64_t read_uint60_t(int &c, SOURCE read_char) {
  function read_arbitrary_dem_targets_into (line 252) | inline void read_arbitrary_dem_targets_into(int &c, SOURCE read_char, De...
  function dem_read_instruction (line 276) | void dem_read_instruction(DetectorErrorModel &model, char lead_char, SOU...
  function model_read_operations (line 327) | void model_read_operations(DetectorErrorModel &model, SOURCE read_char, ...
  function DetectorErrorModel (line 382) | DetectorErrorModel DetectorErrorModel::from_file(FILE *file) {
  function DetectorErrorModel (line 398) | DetectorErrorModel DetectorErrorModel::rounded(uint8_t digits) const {
  function flattened_helper (line 435) | void flattened_helper(
  function DetectorErrorModel (line 492) | DetectorErrorModel DetectorErrorModel::flattened() const {
  function DetectorErrorModel (line 588) | DetectorErrorModel DetectorErrorModel::py_get_slice(int64_t start, int64...
  function DetectorErrorModel (line 605) | DetectorErrorModel DetectorErrorModel::operator*(size_t repetitions) con...
  function DetectorErrorModel (line 611) | DetectorErrorModel &DetectorErrorModel::operator*=(size_t repetitions) {
  function DetectorErrorModel (line 624) | DetectorErrorModel DetectorErrorModel::operator+(const DetectorErrorMode...
  function DetectorErrorModel (line 630) | DetectorErrorModel &DetectorErrorModel::operator+=(const DetectorErrorMo...
  function get_detector_coordinates_helper (line 666) | bool get_detector_coordinates_helper(
  function DetectorErrorModel (line 784) | DetectorErrorModel DetectorErrorModel::without_tags() const {

FILE: src/stim/dem/detector_error_model.h
  function namespace (line 13) | namespace stim {

FILE: src/stim/dem/detector_error_model.pybind.cc
  function python_arg_to_instruction_arguments (line 42) | std::vector<double> python_arg_to_instruction_arguments(const pybind11::...
  function DemInstructionType (line 57) | static DemInstructionType non_block_instruction_name_to_enum(std::string...

FILE: src/stim/dem/detector_error_model.pybind.h
  function namespace (line 22) | namespace stim_pybind {

FILE: src/stim/dem/detector_error_model.test.cc
  function TEST (line 25) | TEST(detector_error_model, init_equality) {
  function TEST (line 48) | TEST(detector_error_model, append_shift_detectors_instruction) {
  function TEST (line 64) | TEST(detector_error_model, append_detector_instruc
Copy disabled (too large) Download .json
Condensed preview — 753 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (14,576K chars).
[
  {
    "path": ".bazelrc",
    "chars": 26,
    "preview": "test --test_output=errors\n"
  },
  {
    "path": ".bazelversion",
    "chars": 6,
    "preview": "7.2.0\n"
  },
  {
    "path": ".clang-format",
    "chars": 560,
    "preview": "---\nLanguage: Cpp\nBasedOnStyle: Google\nIndentWidth: 4\nColumnLimit: 120\nAlignAfterOpenBracket: AlwaysBreak\nAllowShortBloc"
  },
  {
    "path": ".editorconfig",
    "chars": 1492,
    "preview": "# Copyright 2025 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this f"
  },
  {
    "path": ".github/SECURITY.md",
    "chars": 1526,
    "preview": "# Reporting security issues\n\nThe Stim developers and community take security bugs in Stim seriously. We\nappreciate your "
  },
  {
    "path": ".github/workflows/ci.yml",
    "chars": 22608,
    "preview": "# Copyright 2021 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this f"
  },
  {
    "path": ".gitignore",
    "chars": 541,
    "preview": ".idea/*\ncmake-build-debug/*\na.out\nperf.data\nperf.data.old\nCMakeFiles/*\nCMakeCache.txt\ngoogletest-build/*\ngoogletest-down"
  },
  {
    "path": ".markdownlintrc",
    "chars": 5094,
    "preview": "{ // -*- jsonc -*-\n  // Copyright 2025 Google LLC\n  //\n  // Licensed under the Apache License, Version 2.0 (the \"License"
  },
  {
    "path": "BUILD",
    "chars": 2248,
    "preview": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:packaging.bzl\", \"py_wheel\")\n\nSOURCE_F"
  },
  {
    "path": "CITATION.cff",
    "chars": 2849,
    "preview": "# Citation information for this repository.                         -*- yaml -*-\n#\n# CITATION.cff files provide human- &"
  },
  {
    "path": "CMakeLists.txt",
    "chars": 4900,
    "preview": "# Copyright 2021 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this f"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 4402,
    "preview": "# Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, we as\ncontributors and"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 4949,
    "preview": "# How to contribute\n\nWe'd love to accept your patches and contributions to this project. We do have\nsome guidelines to f"
  },
  {
    "path": "LICENSE",
    "chars": 11357,
    "preview": "\n                                 Apache License\n                           Version 2.0, January 2004\n                  "
  },
  {
    "path": "MANIFEST.in",
    "chars": 109,
    "preview": "include glue/python/src/stim/__init__.pyi\ninclude glue/python/README.md\nrecursive-include src *.cc *.h *.inl\n"
  },
  {
    "path": "MODULE.bazel",
    "chars": 106,
    "preview": "bazel_dep(name = \"googletest\", version = \"1.14.0\")\nbazel_dep(name = \"pybind11_bazel\", version = \"2.11.1\")\n"
  },
  {
    "path": "README.md",
    "chars": 7873,
    "preview": "# Stim\n\n<img align=\"right\" width=\"125em\" alt=\"Stim logo\" src=\"https://raw.githubusercontent.com/quantumlib/Stim/refs/hea"
  },
  {
    "path": "SUPPORT.md",
    "chars": 900,
    "preview": "# Support\n\nThank you for your interest in this project! If you are experiencing problems\nor have questions, the followin"
  },
  {
    "path": "WORKSPACE",
    "chars": 480,
    "preview": "load(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\nload(\"@pybind11_bazel//:python_configure.bzl\", \"pyt"
  },
  {
    "path": "dev/canvas_with_texture_for_3d_diagrams.html",
    "chars": 9484,
    "preview": "<meta charset=\"utf-8\">\n<body style=\"margin: 0\">\n<canvas width=\"512\" height=\"512\" id=\"cv\" style=\"border: 1px solid black;"
  },
  {
    "path": "dev/clean_build_files.sh",
    "chars": 660,
    "preview": "#!/bin/bash\nset -e\n\n#########################################################################\n# Deletes files created by"
  },
  {
    "path": "dev/compile_crumble_into_cpp_string_file.sh",
    "chars": 560,
    "preview": "#!/bin/bash\nset -e\n\n# Get to this script's git repo root.\ncd \"$( dirname \"${BASH_SOURCE[0]}\" )\"\ncd \"$(git rev-parse --sh"
  },
  {
    "path": "dev/compile_crumble_into_single_html_page.sh",
    "chars": 404,
    "preview": "#!/bin/bash\nset -e\n\ncd \"$( dirname \"${BASH_SOURCE[0]}\" )\"\ncd \"$(git rev-parse --show-toplevel)\"\n\ncat glue/crumble/crumbl"
  },
  {
    "path": "dev/doctest_proper.py",
    "chars": 3302,
    "preview": "#!/usr/bin/env python3\n\n\"\"\"Runs doctests on a module, including any objects imported into the module.\"\"\"\nimport argparse"
  },
  {
    "path": "dev/gen_known_gates_for_js.sh",
    "chars": 446,
    "preview": "#!/bin/bash\nset -e\n\n#########################################################################\n# Generates javascript exp"
  },
  {
    "path": "dev/gen_sinter_api_reference.py",
    "chars": 3058,
    "preview": "\"\"\"\nIterates over modules and classes, listing their attributes and methods in markdown.\n\"\"\"\n\nimport sinter\n\nimport sys\n"
  },
  {
    "path": "dev/gen_stim_api_reference.py",
    "chars": 1844,
    "preview": "\"\"\"\nIterates over modules and classes, listing their attributes and methods in markdown.\n\"\"\"\n\nimport stim\n\nimport sys\n\nf"
  },
  {
    "path": "dev/gen_stim_stub_file.py",
    "chars": 1191,
    "preview": "#!/usr/bin/env python3\n\n\"\"\"\nProduces a .pyi file for stim, describing the contained classes and functions.\n\"\"\"\n\nimport s"
  },
  {
    "path": "dev/make_logo.html",
    "chars": 2277,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n<body style=\"margin: 0\">\n</body>\n<script type=\"module\">\n    function make_svg(diam) {\n "
  },
  {
    "path": "dev/overwrite_dev_versions_with_date.py",
    "chars": 1958,
    "preview": "#!/usr/bin/env python3\n\n#########################################################\n# Sets version numbers to a date-based"
  },
  {
    "path": "dev/regen_crumble_cpp_resource.sh",
    "chars": 214,
    "preview": "#!/bin/bash\nset -e\n\n# Get to this script's git repo root.\ncd \"$( dirname \"${BASH_SOURCE[0]}\" )\"\ncd \"$(git rev-parse --sh"
  },
  {
    "path": "dev/regen_docs.sh",
    "chars": 1011,
    "preview": "#!/bin/bash\nset -e\n\n#########################################################################\n# Regenerates doc files us"
  },
  {
    "path": "dev/regen_file_lists.sh",
    "chars": 1560,
    "preview": "#!/bin/bash\nset -e\n\n#########################################################################\n# Regenerate file_lists\n##"
  },
  {
    "path": "dev/regen_texture_to_cpp_base64_string.sh",
    "chars": 892,
    "preview": "#!/bin/bash\nset -e\n\n#########################################################################\n# Transforms binary data i"
  },
  {
    "path": "dev/util_gen_stub_file.py",
    "chars": 10707,
    "preview": "import dataclasses\nimport types\nfrom typing import Any\nfrom typing import Optional, Iterator, List\n\nimport inspect\nfrom "
  },
  {
    "path": "doc/circuit_data_references.md",
    "chars": 6801,
    "preview": "## 2021\n\n- [arXiv:2103.02202](https://arxiv.org/abs/2103.02202) → [Ancillary files of \"Stim: a fast stabilizer circuit s"
  },
  {
    "path": "doc/developer_documentation.md",
    "chars": 23529,
    "preview": "# Stim Developer Documentation\n\nThis is documentation for programmers working with stim, e.g. how to build it.\nThese not"
  },
  {
    "path": "doc/file_format_dem_detector_error_model.md",
    "chars": 27153,
    "preview": "# The Detector Error Model File Format (.dem)\n\nA detector error model file (.dem) is a human-readable specification of e"
  },
  {
    "path": "doc/file_format_stim_circuit.md",
    "chars": 21564,
    "preview": "# The Stim Circuit File Format (.stim)\n\nA stim circuit file (.stim) is a human-readable specification of an annotated st"
  },
  {
    "path": "doc/gates.md",
    "chars": 118303,
    "preview": "# Gates supported by Stim\n\n- Pauli Gates\n    - [I](#I)\n    - [X](#X)\n    - [Y](#Y)\n    - [Z](#Z)\n- Single Qubit Clifford"
  },
  {
    "path": "doc/getting_started.ipynb",
    "chars": 3166486,
    "preview": "{\n  \"cells\": [\n    {\n      \"cell_type\": \"markdown\",\n      \"metadata\": {\n        \"id\": \"7vg1S92NEAXs\"\n      },\n      \"sou"
  },
  {
    "path": "doc/python_api_reference_vDev.md",
    "chars": 569572,
    "preview": "# Stim (Development Version) API Reference\n\n*CAUTION*: this API reference is for the in-development version of stim.\nMet"
  },
  {
    "path": "doc/result_formats.md",
    "chars": 17119,
    "preview": "# Introduction\n\nA *result format* is a way of representing bits from shots sampled from a circuit.\nIt is some way of con"
  },
  {
    "path": "doc/sinter_api.md",
    "chars": 85299,
    "preview": "# Sinter (Development Version) API Reference\n\n*CAUTION*: this API reference is for the in-development version of sinter."
  },
  {
    "path": "doc/sinter_command_line.md",
    "chars": 25823,
    "preview": "# Sinter command line reference\n\n## Index\n\n- [sinter collect](#collect)\n- [sinter combine](#combine)\n- [sinter plot](#pl"
  },
  {
    "path": "doc/stim.pyi",
    "chars": 528988,
    "preview": "\"\"\"Stim (Development Version): a fast quantum stabilizer circuit library.\"\"\"\n# (This is a stubs file describing the clas"
  },
  {
    "path": "doc/usage_command_line.md",
    "chars": 73464,
    "preview": "# Stim command line reference\n\n## Index\n\n- [stim analyze_errors](#analyze_errors)\n- [stim convert](#convert)\n- [stim det"
  },
  {
    "path": "file_lists/perf_files",
    "chars": 897,
    "preview": "src/stim/circuit/circuit.perf.cc\nsrc/stim/gates/gates.perf.cc\nsrc/stim/io/measure_record_reader.perf.cc\nsrc/stim/main.pe"
  },
  {
    "path": "file_lists/pybind_files",
    "chars": 1210,
    "preview": "src/stim/circuit/circuit.pybind.cc\nsrc/stim/circuit/circuit2.pybind.cc\nsrc/stim/circuit/circuit_instruction.pybind.cc\nsr"
  },
  {
    "path": "file_lists/source_files_no_main",
    "chars": 3621,
    "preview": "src/stim.cc\nsrc/stim/circuit/circuit.cc\nsrc/stim/circuit/circuit_instruction.cc\nsrc/stim/circuit/gate_decomposition.cc\ns"
  },
  {
    "path": "file_lists/test_files",
    "chars": 4234,
    "preview": "src/stim.test.cc\nsrc/stim/circuit/circuit.test.cc\nsrc/stim/circuit/circuit_instruction.test.cc\nsrc/stim/circuit/gate_dec"
  },
  {
    "path": "glue/cirq/README.md",
    "chars": 4859,
    "preview": "# stimcirq\n\nTools for interop between the quantum python package `cirq` and the stabilizer simulator `stim`.\n\nIncludes:\n"
  },
  {
    "path": "glue/cirq/setup.py",
    "chars": 1242,
    "preview": "# Copyright 2021 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this f"
  },
  {
    "path": "glue/cirq/stimcirq/__init__.py",
    "chars": 1215,
    "preview": "__version__ = '1.16.dev0'\nfrom ._cirq_to_stim import cirq_circuit_to_stim_circuit\nfrom ._cx_swap_gate import CXSwapGate\n"
  },
  {
    "path": "glue/cirq/stimcirq/_cirq_to_stim.py",
    "chars": 19962,
    "preview": "import functools\nimport itertools\nimport math\nfrom typing import Callable, cast, Dict, Iterable, List, Optional, Sequenc"
  },
  {
    "path": "glue/cirq/stimcirq/_cirq_to_stim_test.py",
    "chars": 14605,
    "preview": "import itertools\nfrom typing import Dict, List, Sequence, Tuple, Union\n\nimport cirq\nimport numpy as np\nimport pytest\nimp"
  },
  {
    "path": "glue/cirq/stimcirq/_cx_swap_gate.py",
    "chars": 1584,
    "preview": "from typing import Any, Dict, List\n\nimport cirq\nimport stim\n\n\n@cirq.value_equality\nclass CXSwapGate(cirq.Gate):\n    \"\"\"H"
  },
  {
    "path": "glue/cirq/stimcirq/_cx_swap_test.py",
    "chars": 2208,
    "preview": "import cirq\nimport stim\nimport stimcirq\n\n\ndef test_stim_conversion():\n    a, b, c = cirq.LineQubit.range(3)\n\n    cirq_ci"
  },
  {
    "path": "glue/cirq/stimcirq/_cz_swap_gate.py",
    "chars": 1110,
    "preview": "from typing import Any, Dict, List\n\nimport cirq\nimport stim\n\n\n@cirq.value_equality\nclass CZSwapGate(cirq.Gate):\n    \"\"\"H"
  },
  {
    "path": "glue/cirq/stimcirq/_cz_swap_test.py",
    "chars": 1784,
    "preview": "import cirq\nimport stim\nimport stimcirq\n\n\ndef test_stim_conversion():\n    a, b, c = cirq.LineQubit.range(3)\n\n    cirq_ci"
  },
  {
    "path": "glue/cirq/stimcirq/_det_annotation.py",
    "chars": 4411,
    "preview": "from typing import Any, Dict, Iterable, List, Tuple\n\nimport cirq\nimport stim\n\n\n@cirq.value_equality\nclass DetAnnotation("
  },
  {
    "path": "glue/cirq/stimcirq/_det_annotation_test.py",
    "chars": 5249,
    "preview": "import cirq\nimport numpy as np\nimport pytest\nimport stim\nimport stimcirq\n\n\ndef test_stim_conversion():\n    a, b, c = cir"
  },
  {
    "path": "glue/cirq/stimcirq/_i_error_gate.py",
    "chars": 1112,
    "preview": "from typing import Any, Dict, List, Iterable\n\nimport cirq\nimport stim\n\n\n\n@cirq.value_equality\nclass IErrorGate(cirq.Gate"
  },
  {
    "path": "glue/cirq/stimcirq/_i_error_gate_test.py",
    "chars": 829,
    "preview": "import cirq\nimport stimcirq\n\n\ndef test_repr():\n    r = stimcirq.IErrorGate([0.25, 0.125])\n    assert eval(repr(r), {'sti"
  },
  {
    "path": "glue/cirq/stimcirq/_ii_error_gate.py",
    "chars": 1149,
    "preview": "from typing import Any, Dict, List, Iterable\n\nimport cirq\nimport stim\n\n\n\n@cirq.value_equality\nclass IIErrorGate(cirq.Gat"
  },
  {
    "path": "glue/cirq/stimcirq/_ii_error_gate_test.py",
    "chars": 853,
    "preview": "import cirq\nimport stimcirq\n\n\ndef test_repr():\n    r = stimcirq.IIErrorGate([0.25, 0.125])\n    assert eval(repr(r), {'st"
  },
  {
    "path": "glue/cirq/stimcirq/_ii_gate.py",
    "chars": 905,
    "preview": "from typing import Any, Dict, List\n\nimport cirq\nimport stim\n\n@cirq.value_equality\nclass IIGate(cirq.Gate):\n    \"\"\"Handle"
  },
  {
    "path": "glue/cirq/stimcirq/_ii_gate_test.py",
    "chars": 661,
    "preview": "import cirq\nimport stimcirq\n\n\ndef test_repr():\n    r = stimcirq.IIGate()\n    assert eval(repr(r), {'stimcirq': stimcirq}"
  },
  {
    "path": "glue/cirq/stimcirq/_measure_and_or_reset_gate.py",
    "chars": 4424,
    "preview": "from typing import Any, Dict, List, Tuple\n\nimport cirq\nimport stim\n\n\n@cirq.value_equality\nclass MeasureAndOrResetGate(ci"
  },
  {
    "path": "glue/cirq/stimcirq/_measure_and_or_reset_gate_test.py",
    "chars": 1305,
    "preview": "import cirq\nimport stimcirq\n\n\ndef test_repr():\n    r = stimcirq.MeasureAndOrResetGate(\n        measure=True,\n        res"
  },
  {
    "path": "glue/cirq/stimcirq/_obs_annotation.py",
    "chars": 4731,
    "preview": "from typing import Any, Dict, Iterable, List, Tuple\n\nimport cirq\nimport stim\n\n\n@cirq.value_equality\nclass CumulativeObse"
  },
  {
    "path": "glue/cirq/stimcirq/_obs_annotation_test.py",
    "chars": 7927,
    "preview": "import cirq\nimport numpy as np\nimport pytest\nimport stim\nimport stimcirq\n\n\ndef test_stim_conversion():\n    a, b, c = cir"
  },
  {
    "path": "glue/cirq/stimcirq/_shift_coords_annotation.py",
    "chars": 1379,
    "preview": "from typing import Any, Dict, Iterable, List, Tuple\n\nimport cirq\nimport stim\n\n\n@cirq.value_equality\nclass ShiftCoordsAnn"
  },
  {
    "path": "glue/cirq/stimcirq/_shift_coords_annotation_test.py",
    "chars": 2748,
    "preview": "import cirq\nimport numpy as np\nimport stim\nimport stimcirq\n\n\ndef test_conversion():\n    stim_circuit = stim.Circuit(\"\"\"\n"
  },
  {
    "path": "glue/cirq/stimcirq/_stim_sampler.py",
    "chars": 2494,
    "preview": "import collections\nfrom typing import Dict, List, Sequence\n\nimport cirq\n\nfrom ._cirq_to_stim import cirq_circuit_to_stim"
  },
  {
    "path": "glue/cirq/stimcirq/_stim_sampler_test.py",
    "chars": 3908,
    "preview": "import cirq\nimport numpy as np\nimport pytest\nimport stimcirq\n\n\ndef test_end_to_end():\n    sampler = stimcirq.StimSampler"
  },
  {
    "path": "glue/cirq/stimcirq/_stim_to_cirq.py",
    "chars": 28844,
    "preview": "import collections\nimport functools\nfrom typing import (\n    Any,\n    Callable,\n    cast,\n    DefaultDict,\n    Dict,\n   "
  },
  {
    "path": "glue/cirq/stimcirq/_stim_to_cirq_test.py",
    "chars": 24190,
    "preview": "import itertools\nfrom typing import cast\n\nimport cirq\nimport pytest\nimport stim\n\nimport stimcirq\nfrom ._stim_to_cirq imp"
  },
  {
    "path": "glue/cirq/stimcirq/_sweep_pauli.py",
    "chars": 2960,
    "preview": "from typing import AbstractSet, Any, Dict, List, Optional, Union\n\nimport cirq\nimport stim\nimport sympy\n\n\n@cirq.value_equ"
  },
  {
    "path": "glue/cirq/stimcirq/_sweep_pauli_test.py",
    "chars": 5079,
    "preview": "import cirq\nimport numpy as np\nimport stim\nimport stimcirq\n\n\ndef test_repr():\n    cirq.testing.assert_equivalent_repr(\n "
  },
  {
    "path": "glue/cirq/stimcirq/_two_qubit_asymmetric_depolarize.py",
    "chars": 2184,
    "preview": "from typing import Any, Dict, List, Sequence, Tuple\n\nimport cirq\nimport stim\n\n\n@cirq.value_equality\nclass TwoQubitAsymme"
  },
  {
    "path": "glue/cirq/stimcirq/_two_qubit_asymmetric_depolarize_test.py",
    "chars": 2435,
    "preview": "import cirq\nimport stim\nimport stimcirq\n\n\ndef test_mixture():\n    r = stimcirq.TwoQubitAsymmetricDepolarizingChannel(\n  "
  },
  {
    "path": "glue/crumble/README.md",
    "chars": 13288,
    "preview": "# Crumble\n\nCrumble is an in-development tool for exploring and inspecting 2D stabilizer circuits, with a\nfocus on quantu"
  },
  {
    "path": "glue/crumble/base/cooldown_throttle.js",
    "chars": 4437,
    "preview": "/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "glue/crumble/base/describe.js",
    "chars": 4429,
    "preview": "/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "glue/crumble/base/describe.test.js",
    "chars": 4082,
    "preview": "/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "glue/crumble/base/equate.js",
    "chars": 6034,
    "preview": "/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "glue/crumble/base/equate.test.js",
    "chars": 4351,
    "preview": "/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "glue/crumble/base/history_pusher.js",
    "chars": 3858,
    "preview": "/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "glue/crumble/base/obs.js",
    "chars": 9942,
    "preview": "/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "glue/crumble/base/obs.test.js",
    "chars": 7251,
    "preview": "/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "glue/crumble/base/revision.js",
    "chars": 6242,
    "preview": "/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "glue/crumble/base/revision.test.js",
    "chars": 11480,
    "preview": "/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "glue/crumble/base/seq.js",
    "chars": 516,
    "preview": "/**\n * @param {!Iterable<TItem> | !Iterator<TItem>}items\n * @param {!function(item: TItem): TKey} func\n * @returns {!Map"
  },
  {
    "path": "glue/crumble/base/seq.test.js",
    "chars": 353,
    "preview": "import {assertThat, test} from \"../test/test_util.js\"\nimport {groupBy} from \"./seq.js\"\n\ntest(\"seq.groupBy\", () => {\n    "
  },
  {
    "path": "glue/crumble/circuit/circuit.js",
    "chars": 32348,
    "preview": "import {Operation} from \"./operation.js\"\nimport {GATE_ALIAS_MAP, GATE_MAP} from \"../gates/gateset.js\"\nimport {Layer} fro"
  },
  {
    "path": "glue/crumble/circuit/circuit.test.js",
    "chars": 20035,
    "preview": "import {test, assertThat} from \"../test/test_util.js\"\nimport {Circuit, processTargetsTextIntoTargets, splitUncombinedTar"
  },
  {
    "path": "glue/crumble/circuit/layer.js",
    "chars": 11089,
    "preview": "import {Operation} from \"./operation.js\"\nimport {GATE_MAP} from \"../gates/gateset.js\";\nimport {groupBy} from \"../base/se"
  },
  {
    "path": "glue/crumble/circuit/layer.test.js",
    "chars": 2204,
    "preview": "import {test, assertThat} from \"../test/test_util.js\"\nimport {PauliFrame} from \"./pauli_frame.js\"\nimport {GATE_MAP} from"
  },
  {
    "path": "glue/crumble/circuit/operation.js",
    "chars": 5261,
    "preview": "import {Gate} from \"../gates/gate.js\"\n\n/**\n * @param {!string} base\n * @returns {!Array<!string>}\n */\nfunction expandBas"
  },
  {
    "path": "glue/crumble/circuit/pauli_frame.js",
    "chars": 17476,
    "preview": "import {describe} from \"../base/describe.js\";\n\nclass PauliFrame {\n    /**\n     * @param {!int} num_frames\n     * @param "
  },
  {
    "path": "glue/crumble/circuit/pauli_frame.test.js",
    "chars": 3677,
    "preview": "import {test, assertThat} from \"../test/test_util.js\"\nimport {PauliFrame} from \"./pauli_frame.js\"\nimport {GATE_MAP} from"
  },
  {
    "path": "glue/crumble/circuit/propagated_pauli_frames.js",
    "chars": 10887,
    "preview": "import {PauliFrame} from './pauli_frame.js';\nimport {equate} from '../base/equate.js';\nimport {Layer} from './layer.js';"
  },
  {
    "path": "glue/crumble/circuit/propagated_pauli_frames.test.js",
    "chars": 3396,
    "preview": "import {test, assertThat} from \"../test/test_util.js\"\nimport {Circuit} from \"./circuit.js\";\nimport {PropagatedPauliFrame"
  },
  {
    "path": "glue/crumble/crumble.html",
    "chars": 112507,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Crumble</title>\n    <link rel=\"shortcut ic"
  },
  {
    "path": "glue/crumble/draw/config.js",
    "chars": 186,
    "preview": "const pitch = 50;\nconst rad = 10;\nconst OFFSET_X = -pitch + Math.floor(pitch / 4) + 0.5;\nconst OFFSET_Y = -pitch + Math."
  },
  {
    "path": "glue/crumble/draw/draw_util.js",
    "chars": 1493,
    "preview": "import {rad} from './config.js';\n\n/**\n * @param {!CanvasRenderingContext2D} ctx\n * @param {!Array<![!number, !number]>} "
  },
  {
    "path": "glue/crumble/draw/main_draw.js",
    "chars": 17324,
    "preview": "import {pitch, rad, OFFSET_X, OFFSET_Y} from \"./config.js\"\nimport {marker_placement} from \"../gates/gateset_markers.js\";"
  },
  {
    "path": "glue/crumble/draw/main_draw.test.js",
    "chars": 1269,
    "preview": "import {draw, setDefensiveDrawEnabled} from './main_draw.js';\nimport {StateSnapshot} from './state_snapshot.js';\nimport "
  },
  {
    "path": "glue/crumble/draw/state_snapshot.js",
    "chars": 2070,
    "preview": "import {Circuit} from \"../circuit/circuit.js\";\nimport {Layer} from \"../circuit/layer.js\";\n\n/**\n * A copy of the editor s"
  },
  {
    "path": "glue/crumble/draw/timeline_viewer.js",
    "chars": 8010,
    "preview": "import {OFFSET_Y, rad} from \"./config.js\";\nimport {stroke_connector_to} from \"../gates/gate_draw_util.js\"\nimport {marker"
  },
  {
    "path": "glue/crumble/editor/editor_state.js",
    "chars": 28025,
    "preview": "import {Circuit} from \"../circuit/circuit.js\";\nimport {Chorder} from \"../keyboard/chord.js\";\nimport {Layer, minXY} from "
  },
  {
    "path": "glue/crumble/editor/editor_state.test.js",
    "chars": 9557,
    "preview": "import {test, assertThat} from \"../test/test_util.js\";\nimport {EditorState} from \"./editor_state.js\";\nimport {GATE_MAP} "
  },
  {
    "path": "glue/crumble/editor/sync_url_to_state.js",
    "chars": 3608,
    "preview": "/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not u"
  },
  {
    "path": "glue/crumble/gates/gate.js",
    "chars": 1701,
    "preview": "/**\n * Gate drawing callback.\n *\n * @callback gateDrawCallback\n * @param {!Operation} op\n * @param {!function(qubit: !in"
  },
  {
    "path": "glue/crumble/gates/gate_draw_util.js",
    "chars": 5668,
    "preview": "import {pitch, rad} from \"../draw/config.js\"\n\n/**\n * @param {!CanvasRenderingContext2D} ctx\n * @param {undefined|!number"
  },
  {
    "path": "glue/crumble/gates/gateset.js",
    "chars": 3601,
    "preview": "import {Gate} from \"./gate.js\"\nimport {iter_gates_controlled_paulis} from \"./gateset_controlled_paulis.js\";\nimport {iter"
  },
  {
    "path": "glue/crumble/gates/gateset.test.js",
    "chars": 1760,
    "preview": "import {GATE_MAP, GATE_ALIAS_MAP} from \"./gateset.js\"\nimport {test, assertThat, skipRestOfTestIfHeadless} from \"../test/"
  },
  {
    "path": "glue/crumble/gates/gateset_controlled_paulis.js",
    "chars": 3904,
    "preview": "import {Gate} from \"./gate.js\"\nimport {\n    draw_x_control,\n    draw_y_control,\n    draw_z_control,\n    draw_connector,\n"
  },
  {
    "path": "glue/crumble/gates/gateset_demolition_measurements.js",
    "chars": 2532,
    "preview": "import {rad} from \"../draw/config.js\"\nimport {Gate} from \"./gate.js\"\n\nfunction *iter_gates_demolition_measurements() {\n "
  },
  {
    "path": "glue/crumble/gates/gateset_hadamard_likes.js",
    "chars": 4913,
    "preview": "import {rad} from \"../draw/config.js\"\nimport {Gate} from \"./gate.js\"\n\nfunction *iter_gates_hadamard_likes() {\n    yield "
  },
  {
    "path": "glue/crumble/gates/gateset_markers.js",
    "chars": 4447,
    "preview": "import {rad} from \"../draw/config.js\"\nimport {Gate} from \"./gate.js\"\nimport {beginPathPolygon} from '../draw/draw_util.j"
  },
  {
    "path": "glue/crumble/gates/gateset_mpp.js",
    "chars": 3189,
    "preview": "import {rad} from \"../draw/config.js\"\nimport {Gate} from \"./gate.js\"\nimport {draw_connector} from \"./gate_draw_util.js\";"
  },
  {
    "path": "glue/crumble/gates/gateset_pair_measurements.js",
    "chars": 4437,
    "preview": "import {rad} from \"../draw/config.js\"\nimport {Gate} from \"./gate.js\"\nimport {draw_connector} from \"./gate_draw_util.js\";"
  },
  {
    "path": "glue/crumble/gates/gateset_paulis.js",
    "chars": 3375,
    "preview": "import {rad} from \"../draw/config.js\"\nimport {Gate} from \"./gate.js\"\n\nfunction *iter_gates_paulis() {\n    yield new Gate"
  },
  {
    "path": "glue/crumble/gates/gateset_quarter_turns.js",
    "chars": 4568,
    "preview": "import {rad} from \"../draw/config.js\"\nimport {Gate} from \"./gate.js\"\n\nfunction *iter_gates_quarter_turns() {\n    yield n"
  },
  {
    "path": "glue/crumble/gates/gateset_resets.js",
    "chars": 2456,
    "preview": "import {rad} from \"../draw/config.js\"\nimport {Gate} from \"./gate.js\"\n\nfunction *iter_gates_resets() {\n    yield new Gate"
  },
  {
    "path": "glue/crumble/gates/gateset_solo_measurements.js",
    "chars": 2556,
    "preview": "import {rad} from \"../draw/config.js\"\nimport {Gate} from \"./gate.js\"\n\nfunction *iter_gates_solo_measurements() {\n    yie"
  },
  {
    "path": "glue/crumble/gates/gateset_sqrt_pauli_pairs.js",
    "chars": 7156,
    "preview": "import {Gate} from \"./gate.js\"\nimport {draw_connector} from \"./gate_draw_util.js\";\nimport {rad} from \"../draw/config.js\""
  },
  {
    "path": "glue/crumble/gates/gateset_swaps.js",
    "chars": 3351,
    "preview": "import {Gate} from \"./gate.js\"\nimport {\n    draw_connector,\n    draw_swap_control,\n    draw_iswap_control,\n    draw_zswa"
  },
  {
    "path": "glue/crumble/gates/gateset_third_turns.js",
    "chars": 6467,
    "preview": "import {rad} from \"../draw/config.js\"\nimport {Gate} from \"./gate.js\"\n\nfunction *iter_gates_third_turns() {\n    yield new"
  },
  {
    "path": "glue/crumble/keyboard/chord.js",
    "chars": 3923,
    "preview": "import {describe} from \"../base/describe.js\";\nimport {equate} from \"../base/equate.js\";\n\nclass ChordEvent {\n    /**\n    "
  },
  {
    "path": "glue/crumble/keyboard/chord.test.js",
    "chars": 2000,
    "preview": "import {test, assertThat, skipRestOfTestIfHeadless} from \"../test/test_util.js\"\nimport {Chorder, ChordEvent} from \"./cho"
  },
  {
    "path": "glue/crumble/keyboard/toolbox.js",
    "chars": 10370,
    "preview": "import {GATE_MAP} from \"../gates/gateset.js\"\n\nlet toolboxCanvas = /** @type {!HTMLCanvasElement} */ document.getElementB"
  },
  {
    "path": "glue/crumble/main.js",
    "chars": 21527,
    "preview": "import {Circuit} from \"./circuit/circuit.js\"\nimport {minXY} from \"./circuit/layer.js\"\nimport {pitch} from \"./draw/config"
  },
  {
    "path": "glue/crumble/package.json",
    "chars": 23,
    "preview": "{\n  \"type\": \"module\"\n}\n"
  },
  {
    "path": "glue/crumble/run_tests_headless.js",
    "chars": 201,
    "preview": "import {run_tests} from \"./test/test_util.js\"\nimport \"./test/test_import_all.js\"\n\nlet total = await run_tests(() => {}, "
  },
  {
    "path": "glue/crumble/test/generated_gate_name_list.test.js",
    "chars": 712,
    "preview": "const KNOWN_GATE_NAMES_FROM_STIM = `\nI\nX\nY\nZ\nC_NXYZ\nC_NZYX\nC_XNYZ\nC_XYNZ\nC_XYZ\nC_ZNYX\nC_ZYNX\nC_ZYX\nH\nH_NXY\nH_NXZ\nH_NYZ\nH"
  },
  {
    "path": "glue/crumble/test/test.html",
    "chars": 1305,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Test Crumble</title>\n    <link rel=\"shortc"
  },
  {
    "path": "glue/crumble/test/test_import_all.js",
    "chars": 549,
    "preview": "import \"../base/describe.test.js\"\nimport \"../base/equate.test.js\"\nimport \"../base/obs.test.js\"\nimport \"../base/revision."
  },
  {
    "path": "glue/crumble/test/test_main.js",
    "chars": 2295,
    "preview": "import {run_tests, test, assertThat} from \"./test_util.js\"\n\nlet imported = import(\"./test_import_all.js\");\ntest(\"init\", "
  },
  {
    "path": "glue/crumble/test/test_util.js",
    "chars": 12546,
    "preview": "import {describe} from \"../base/describe.js\";\nimport {equate} from \"../base/equate.js\";\n\nlet _tests = /** @type {!Array<"
  },
  {
    "path": "glue/crumble/test/test_util.test.js",
    "chars": 3714,
    "preview": "import {test, assertThat} from \"./test_util.js\";\n\nfunction expectFailure(func, match) {\n    try {\n        func();\n    } "
  },
  {
    "path": "glue/javascript/README.md",
    "chars": 1732,
    "preview": "# Stim in Javascript\n\nThis directory contains glue code for exposing stim to javascript.\n\nFor build instructions, see [t"
  },
  {
    "path": "glue/javascript/build_wasm.sh",
    "chars": 1120,
    "preview": "#!/bin/bash\nset -e\n\n# Get to this script's git repo root.\ncd \"$( dirname \"${BASH_SOURCE[0]}\" )\"\ncd \"$(git rev-parse --sh"
  },
  {
    "path": "glue/javascript/circuit.js.cc",
    "chars": 1670,
    "preview": "#include \"circuit.js.h\"\n\n#include <emscripten/bind.h>\n#include <emscripten/val.h>\n\nusing namespace stim;\n\nExposedCircuit"
  },
  {
    "path": "glue/javascript/circuit.js.h",
    "chars": 733,
    "preview": "#ifndef STIM_CIRCUIT_JS_H\n#define STIM_CIRCUIT_JS_H\n\n#include <cstddef>\n#include <cstdint>\n#include <emscripten/val.h>\n\n"
  },
  {
    "path": "glue/javascript/circuit.test.js",
    "chars": 1903,
    "preview": "test(\"circuit.constructor\", ({stim, assert}) => {\n    let c = new stim.Circuit();\n    assert(c.toString() === '');\n\n    "
  },
  {
    "path": "glue/javascript/common.js.cc",
    "chars": 322,
    "preview": "#include \"common.js.h\"\n\nusing namespace stim;\n\nuint32_t js_val_to_uint32_t(const emscripten::val &val) {\n    double v = "
  },
  {
    "path": "glue/javascript/common.js.h",
    "chars": 439,
    "preview": "#ifndef STIM_COMMON_JS_H\n#define STIM_COMMON_JS_H\n\n#include <emscripten/val.h>\n\n#include \"stim/util_bot/probability_util"
  },
  {
    "path": "glue/javascript/pauli_string.js.cc",
    "chars": 2922,
    "preview": "#include \"pauli_string.js.h\"\n\n#include <emscripten/bind.h>\n\n#include \"common.js.h\"\n\nusing namespace stim;\n\nExposedPauliS"
  },
  {
    "path": "glue/javascript/pauli_string.js.h",
    "chars": 864,
    "preview": "#ifndef STIM_PAULI_STRING_JS_H\n#define STIM_PAULI_STRING_JS_H\n\n#include <cstddef>\n#include <cstdint>\n#include <emscripte"
  },
  {
    "path": "glue/javascript/pauli_string.test.js",
    "chars": 2874,
    "preview": "test(\"pauli_string.constructor<int>\", ({stim, assert}) => {\n    let p = new stim.PauliString(0);\n    assert(p.length ==="
  },
  {
    "path": "glue/javascript/stim.js.cc",
    "chars": 339,
    "preview": "#include <emscripten/bind.h>\n#include <emscripten/val.h>\n\n#include \"circuit.js.h\"\n#include \"pauli_string.js.h\"\n#include "
  },
  {
    "path": "glue/javascript/stim.test_harness.js",
    "chars": 1453,
    "preview": "let tests = [];\nlet __any_failures = false;\n\nfunction test(name, handler) {\n    tests.push({name, handler});\n}\n\nfunction"
  },
  {
    "path": "glue/javascript/tableau.js.cc",
    "chars": 3925,
    "preview": "#include \"tableau.js.h\"\n\n#include <emscripten/bind.h>\n\n#include \"common.js.h\"\n#include \"stim/gates/gates.h\"\n\nusing names"
  },
  {
    "path": "glue/javascript/tableau.js.h",
    "chars": 906,
    "preview": "#ifndef STIM_TABLEAU_JS_H\n#define STIM_TABLEAU_JS_H\n\n#include <cstddef>\n#include <cstdint>\n\n#include \"pauli_string.js.h\""
  },
  {
    "path": "glue/javascript/tableau.test.js",
    "chars": 2829,
    "preview": "test(\"tableau.constructor<int>\", ({stim, assert}) => {\n    let p = new stim.Tableau(0);\n    assert(p.length === 0);\n\n   "
  },
  {
    "path": "glue/javascript/tableau_simulator.js.cc",
    "chars": 6519,
    "preview": "#include \"tableau_simulator.js.h\"\n\n#include <emscripten/bind.h>\n#include <emscripten/val.h>\n\n#include \"common.js.h\"\n\nusi"
  },
  {
    "path": "glue/javascript/tableau_simulator.js.h",
    "chars": 1197,
    "preview": "#ifndef STIM_TABLEAU_SIMULATOR_JS_H\n#define STIM_TABLEAU_SIMULATOR_JS_H\n\n#include <cstddef>\n#include <cstdint>\n#include "
  },
  {
    "path": "glue/javascript/tableau_simulator.test.js",
    "chars": 3969,
    "preview": "test(\"tableau_simulator.constructor\", ({stim, assert}) => {\n    let s = new stim.TableauSimulator();\n    assert(s.curren"
  },
  {
    "path": "glue/lattice_surgery/README.md",
    "chars": 2478,
    "preview": "# Lattice Surgery Subroutine Synthesizer (LaSsynth)\nA lattice surgery subroutine (LaS) is a confined volume with a set o"
  },
  {
    "path": "glue/lattice_surgery/docs/demo.ipynb",
    "chars": 179939,
    "preview": "{\n \"cells\": [\n  {\n   \"attachments\": {},\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Introductio"
  },
  {
    "path": "glue/lattice_surgery/lassynth/__init__.py",
    "chars": 127,
    "preview": "from .lattice_surgery_synthesis import LatticeSurgerySynthesizer\nfrom .lattice_surgery_synthesis import LatticeSurgerySo"
  },
  {
    "path": "glue/lattice_surgery/lassynth/lattice_surgery_synthesis.py",
    "chars": 24192,
    "preview": "\"\"\"Two wrapper classes, rewrite passes, and translators.\"\"\"\n\nimport functools\nimport itertools\nimport json\nimport time\ni"
  },
  {
    "path": "glue/lattice_surgery/lassynth/rewrite_passes/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "glue/lattice_surgery/lassynth/rewrite_passes/attach_fixups.py",
    "chars": 3753,
    "preview": "\"\"\"assuming all T injections requiring fixup are on the top floor.\nThe output is also on the top floor\"\"\"\n\nfrom typing i"
  },
  {
    "path": "glue/lattice_surgery/lassynth/rewrite_passes/color_z.py",
    "chars": 9536,
    "preview": "\"\"\"We do not have ColorZ from the SAT/SMT. Now we color the Z-pipes.\"\"\"\n\nfrom typing import Sequence, Mapping, Any, Unio"
  },
  {
    "path": "glue/lattice_surgery/lassynth/rewrite_passes/remove_unconnected.py",
    "chars": 6325,
    "preview": "\"\"\"In the generated LaS, there can be some 'floating donuts' not connecting to\nany ports. These objects won't affect the"
  },
  {
    "path": "glue/lattice_surgery/lassynth/sat_synthesis/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "glue/lattice_surgery/lassynth/sat_synthesis/lattice_surgery_sat.py",
    "chars": 84849,
    "preview": "\"\"\"LatticeSurgerySAT to encode the synthesis problem to SAT/SMT\"\"\"\n\nimport os\nimport subprocess\nimport sys\nimport tempfi"
  },
  {
    "path": "glue/lattice_surgery/lassynth/tools/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "glue/lattice_surgery/lassynth/tools/verify_stabilizers.py",
    "chars": 1286,
    "preview": "from typing import Sequence\nimport stim\nimport stimzx\n\n\ndef verify_stabilizers(\n    specified_paulistrings: Sequence[str"
  },
  {
    "path": "glue/lattice_surgery/lassynth/translators/__init__.py",
    "chars": 59,
    "preview": "from lassynth.translators.zx_grid_graph import ZXGridGraph\n"
  },
  {
    "path": "glue/lattice_surgery/lassynth/translators/gltf_generator.py",
    "chars": 89626,
    "preview": "\"\"\"generating a 3D modelling file in gltf format from our LaSRe.\"\"\"\n\nimport json\nfrom typing import Any, Mapping, Option"
  },
  {
    "path": "glue/lattice_surgery/lassynth/translators/networkx_generator.py",
    "chars": 1956,
    "preview": "\"\"\"generate a annotated networkx.Graph corresponding to the LaS.\"\"\"\n\nimport networkx\nfrom lassynth.translators import ZX"
  },
  {
    "path": "glue/lattice_surgery/lassynth/translators/textfig_generator.py",
    "chars": 8861,
    "preview": "\"\"\"Generate text figures of 2D time slices of the LaS.\"\"\"\n\nfrom lassynth.translators import ZXGridGraph\n\n\nclass TextLaye"
  },
  {
    "path": "glue/lattice_surgery/lassynth/translators/zx_grid_graph.py",
    "chars": 12002,
    "preview": "\"\"\"Classes ZXGridEdge, ZXGridSpider, and ZXGridGraph. ZXGridGraph is a graph\nwhere nodes are the cubes in LaS and edges "
  },
  {
    "path": "glue/lattice_surgery/setup.py",
    "chars": 683,
    "preview": "from setuptools import find_packages, setup\n\nwith open('README.md', encoding='UTF-8') as f:\n    long_description = f.rea"
  },
  {
    "path": "glue/lattice_surgery/stimzx/__init__.py",
    "chars": 279,
    "preview": "__version__ = '1.12.dev0'\nfrom ._external_stabilizer import (\n    ExternalStabilizer,\n)\n\nfrom ._text_diagram_parsing imp"
  },
  {
    "path": "glue/lattice_surgery/stimzx/_external_stabilizer.py",
    "chars": 3343,
    "preview": "from typing import List, Any\n\nimport stim\n\n\nclass ExternalStabilizer:\n    \"\"\"An input-to-output relationship enforced by"
  },
  {
    "path": "glue/lattice_surgery/stimzx/_external_stabilizer_test.py",
    "chars": 203,
    "preview": "import stim\nimport stimzx\n\n\ndef test_repr():\n    e = stimzx.ExternalStabilizer(input=stim.PauliString(\"XX\"), output=stim"
  },
  {
    "path": "glue/lattice_surgery/stimzx/_text_diagram_parsing.py",
    "chars": 5975,
    "preview": "import re\nfrom typing import Dict, Tuple, TypeVar, List, Set, Callable\n\nimport networkx as nx\n\nK = TypeVar(\"K\")\n\n\ndef te"
  },
  {
    "path": "glue/lattice_surgery/stimzx/_text_diagram_parsing_test.py",
    "chars": 3468,
    "preview": "import networkx as nx\nimport pytest\nfrom ._text_diagram_parsing import _find_nodes, _text_to_char_map, _find_end_of_edge"
  },
  {
    "path": "glue/lattice_surgery/stimzx/_zx_graph_solver.py",
    "chars": 8208,
    "preview": "from typing import Dict, Tuple, List, Any, Union\nimport stim\nimport networkx as nx\n\nfrom ._text_diagram_parsing import t"
  },
  {
    "path": "glue/lattice_surgery/stimzx/_zx_graph_solver_test.py",
    "chars": 5002,
    "preview": "from typing import List\n\nimport stim\n\nfrom ._zx_graph_solver import zx_graph_to_external_stabilizers, text_diagram_to_zx"
  },
  {
    "path": "glue/python/README.md",
    "chars": 3816,
    "preview": "# Stim\n\nStim is a fast simulator for quantum stabilizer circuits.\n\nAPI references are available on the stim github wiki:"
  },
  {
    "path": "glue/python/src/stim/__init__.py",
    "chars": 2987,
    "preview": "\"\"\"Stim: a fast quantum stabilizer circuit library.\"\"\"\n\n# This is the entrypoint when running `import stim`.\n#\n# It does"
  },
  {
    "path": "glue/python/src/stim/__init__.pyi",
    "chars": 528988,
    "preview": "\"\"\"Stim (Development Version): a fast quantum stabilizer circuit library.\"\"\"\n# (This is a stubs file describing the clas"
  },
  {
    "path": "glue/python/src/stim/_main_argv.py",
    "chars": 134,
    "preview": "import sys\n\nimport stim\n\n\ndef main_argv():\n    stim.main(command_line_args=sys.argv[1:])\n\n\nif __name__ == '__main__':\n  "
  },
  {
    "path": "glue/sample/MANIFEST.in",
    "chars": 27,
    "preview": "recursive-include src *.py\n"
  },
  {
    "path": "glue/sample/README.md",
    "chars": 14309,
    "preview": "# sinter: fast QEC sampling\n\nSinter is a software tool/library for doing fast monte carlo sampling of\nquantum error corr"
  },
  {
    "path": "glue/sample/requirements.txt",
    "chars": 28,
    "preview": "matplotlib\nnumpy\nstim\nscipy\n"
  },
  {
    "path": "glue/sample/setup.py",
    "chars": 1531,
    "preview": "# Copyright 2021 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this f"
  },
  {
    "path": "glue/sample/src/sinter/__init__.py",
    "chars": 966,
    "preview": "__version__ = '1.16.dev0'\n\nfrom sinter._collection import (\n    collect,\n    iter_collect,\n    post_selection_mask_from_"
  },
  {
    "path": "glue/sample/src/sinter/_collection/__init__.py",
    "chars": 246,
    "preview": "from sinter._collection._collection import (\n    collect,\n    iter_collect,\n    post_selection_mask_from_4th_coord,\n    "
  },
  {
    "path": "glue/sample/src/sinter/_collection/_collection.py",
    "chars": 22189,
    "preview": "import contextlib\nimport dataclasses\nimport pathlib\nfrom typing import Any, Callable, Iterator, Optional, Union, Iterabl"
  },
  {
    "path": "glue/sample/src/sinter/_collection/_collection_manager.py",
    "chars": 25605,
    "preview": "import collections\nimport contextlib\nimport math\nimport multiprocessing\nimport os\nimport pathlib\nimport queue\nimport tem"
  },
  {
    "path": "glue/sample/src/sinter/_collection/_collection_manager_test.py",
    "chars": 10894,
    "preview": "import multiprocessing\nimport time\nfrom typing import Any, List, Union\n\nimport sinter\nimport stim\n\nfrom sinter._collecti"
  },
  {
    "path": "glue/sample/src/sinter/_collection/_collection_test.py",
    "chars": 10472,
    "preview": "import collections\nimport multiprocessing\nimport pathlib\nimport tempfile\nimport time\n\nimport pytest\n\nimport sinter\nimpor"
  }
]

// ... and 553 more files (download for full content)

About this extraction

This page contains the full source code of the quantumlib/Stim GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 753 files (13.2 MB), approximately 3.5M tokens, and a symbol index with 3946 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!