Dist m4ri 0.16.1
Computing distance of a classical or quantum CSS code
Loading...
Searching...
No Matches
test_dist_m4ri Namespace Reference

Functions

 test_find_binary ()
 test_classical_distance_file ()
 test_classical_distance_numpy ()
 test_matrix_writer (tmp_path)
 test_css_distance_files ()
 test_css_distance_sparse ()
 test_dem_distance_file ()
 test_dem_distance_stim ()
 test_caching ()
 test_codedistance_solver ()
 test_run_dist_m4ri_three_numbers ()
 test_dmin_dmax_parameters ()
 test_caching_cumulative_rw_steps ()
 test_format_bounds_list_and_str ()
 test_persistent_json_cache (tmp_path)
 test_quantum_distance_single_sided ()
 test_cli_argument_parsing ()
 test_debug_bits (capsys)
 test_quantum_cache_separation ()
 test_explain_bounds ()
 test_rw_infoset_estimate ()
 test_cli_css_dx_dz_bounds (capsys)
 test_cli_verbose_mode (capsys)
 test_check_finc_outc ()
 test_cli_identical_finc_outc_nonexistent (capsys)
 test_cli_help (capsys)
 test_cli_morehelp (capsys)
 test_cli_morehelp_topic (capsys)
 test_cli_no_args_error (capsys)
 test_cli_version (capsys)
 test_cli_binary_compatibility_silent (capsys)
 test_binary_compatibility_warning (tmp_path)
 test_cache_versioning (tmp_path)
 test_rw_ksub_kwin_min_hits (capsys)
 test_add_noise_and_noiseless_circuit ()
 _make_xzzx_circuit (int distance=3, int rounds=3, str memory_basis="Z")
 test_stim_simple_vs_full_and_basis_tracking (tmp_path, capsys)
 test_stim_xzzx_rotated_css (tmp_path, capsys)
 test_stim_rounds_option (tmp_path, capsys)
 test_stim_out_dem_out_stim_out_dir (tmp_path)
 test_normalize_start_list ()
 test_run_dist_m4ri_start_list_and_disabled_options (capsys)
 test_start_scan_option (tmp_path, capsys)
 test_sort_rows_option (tmp_path, capsys)
 test_cc_prune_option (tmp_path, capsys)
 test_ortho_option (capsys)
 test_cc_round_stats (capsys)
 test_win_hyb_option (capsys)
 test_pairs_option (capsys)
 test_model_lower_bound (tmp_path, capsys)
 test_start_list_cache_records (tmp_path, monkeypatch, capsys)
 test_start_list_trust_after_calculation_css (tmp_path)
 test_cli_start_trust_start_and_disabled_options (capsys)
 test_css_distance_requires_both_matrices (capsys)
 test_distance_result_eq ()
 test_cache_newer_version_not_overwritten (tmp_path, capsys)
 test_run_dist_m4ri_stop_event (capsys)
 test_add_noise_classically_controlled ()
 test_add_noise_gate_classes_and_strip_noise ()
 test_css_outc_sector_files_and_finc (tmp_path, capsys)
 _hgp_rep (int a, int b)
 test_dstop_stop_target (tmp_path, capsys)
 test_cli_dstop (capsys)
 test_css_user_dmax_and_sector_records (tmp_path, capsys)
 test_css_cache_migration (tmp_path)
 test_cached_outc_keeps_finc_codewords (tmp_path)
 test_unknown_keyword_arguments ()
 test_cli_conflict_warnings (capsys)
 test_cli_outc_keeps_finc_codewords (tmp_path, capsys)
 test_dem_cache_merged_bounds_and_circuit_key (tmp_path, capsys)
 test_dem_merge_equal_columns (tmp_path, capsys)
 test_dem_expand_equal_columns (tmp_path, capsys)
 test_dem_error_columns_parser (tmp_path)
 test_dem_circuit_outc_without_out_dem_warning (tmp_path, capsys)
 test_dem_drop_minority_detectors (tmp_path, capsys)
 test_dem_out_reduced (tmp_path, capsys)
 test_dem_force_noise_and_p_noise (tmp_path, capsys)
 test_stim_pauli_channel_circuit (tmp_path, capsys)
 _surface_memory_z (bool x_in_h_frame, bool meas_before_h, int rounds=3)
 test_classify_qubits_checks_measured_in_hadamard_frame ()
 test_explain_bounds_model_check_needs_hit_counts ()
 test_refresh_passed_to_binary (capsys)
 test_css_and_quantum_distance_inputs ()
 test_kwin_negative_turns_windows_off (capsys)
 test_codedistance_unused_defaults ()
 test_ignored_inputs_warnings (tmp_path, capsys, monkeypatch)
 test_model_detector_groups_end_of_circuit_and_pure_dem (tmp_path)
 test_cc_zero_col_strip_and_even_weight_parity (tmp_path)
 test_cert_engine_delegation_and_cache_rules (tmp_path, monkeypatch)
 test_zero_rank_g_and_css_sectors ()

Variables

 EXAMPLES_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "examples"))
 S5_H = os.path.join(EXAMPLES_DIR, "surf_d5_H.mmx")
 S5_L = os.path.join(EXAMPLES_DIR, "surf_d5_L.mmx")
 TRY_X = os.path.join(EXAMPLES_DIR, "tryX.mtx")
 TRY_Z = os.path.join(EXAMPLES_DIR, "tryZ.mtx")
 SURF_D3_DEM = os.path.join(EXAMPLES_DIR, "surf_d3.dem")

Detailed Description

Unit tests for dist_m4ri.py Python wrapper.

Function Documentation

◆ _hgp_rep()

test_dist_m4ri._hgp_rep ( int a,
int b )
protected
Hypergraph product of the repetition codes of lengths a and b (a planar surface code): dZ = a, dX = b.

Definition at line 1967 of file test_dist_m4ri.py.

Referenced by test_css_cache_migration(), and test_css_user_dmax_and_sector_records().

◆ _make_xzzx_circuit()

test_dist_m4ri._make_xzzx_circuit ( int distance = 3,
int rounds = 3,
str memory_basis = "Z" )
protected
Constructs a rotated-surface-code XZZX circuit by conjugating checkerboard data qubits.

Definition at line 823 of file test_dist_m4ri.py.

References dist_m4ri.classify_qubits_thorough().

Referenced by test_stim_xzzx_rotated_css().

◆ _surface_memory_z()

test_dist_m4ri._surface_memory_z ( bool x_in_h_frame,
bool meas_before_h,
int rounds = 3 )
protected
Memory-Z circuit of the d=3 rotated surface code (data 0..8, Z ancillas 9..12, X ancillas 13..16).  With
x_in_h_frame, the X checks are measured as Z checks in the Hadamard frame of the data qubits (H on all data, CX
data -> ancilla, H on all data), with the X ancillas measured before or after the closing H gates.

Definition at line 2549 of file test_dist_m4ri.py.

Referenced by test_classify_qubits_checks_measured_in_hadamard_frame().

◆ test_add_noise_and_noiseless_circuit()

test_dist_m4ri.test_add_noise_and_noiseless_circuit ( )

◆ test_add_noise_classically_controlled()

test_dist_m4ri.test_add_noise_classically_controlled ( )

Definition at line 1842 of file test_dist_m4ri.py.

References dist_m4ri.add_noise().

◆ test_add_noise_gate_classes_and_strip_noise()

test_dist_m4ri.test_add_noise_gate_classes_and_strip_noise ( )

◆ test_binary_compatibility_warning()

test_dist_m4ri.test_binary_compatibility_warning ( tmp_path)

Definition at line 721 of file test_dist_m4ri.py.

References dist_m4ri.check_binary_compatibility().

◆ test_cache_newer_version_not_overwritten()

test_dist_m4ri.test_cache_newer_version_not_overwritten ( tmp_path,
capsys )

◆ test_cache_versioning()

test_dist_m4ri.test_cache_versioning ( tmp_path)

◆ test_cached_outc_keeps_finc_codewords()

◆ test_caching()

test_dist_m4ri.test_caching ( )

◆ test_caching_cumulative_rw_steps()

test_dist_m4ri.test_caching_cumulative_rw_steps ( )

◆ test_cc_prune_option()

◆ test_cc_round_stats()

test_dist_m4ri.test_cc_round_stats ( capsys)

◆ test_cc_zero_col_strip_and_even_weight_parity()

◆ test_cert_engine_delegation_and_cache_rules()

test_dist_m4ri.test_cert_engine_delegation_and_cache_rules ( tmp_path,
monkeypatch )

◆ test_check_finc_outc()

test_dist_m4ri.test_check_finc_outc ( )

Definition at line 565 of file test_dist_m4ri.py.

References dist_m4ri.check_finc_outc().

◆ test_classical_distance_file()

test_dist_m4ri.test_classical_distance_file ( )

Definition at line 29 of file test_dist_m4ri.py.

References dist_m4ri.compute_classical_distance().

◆ test_classical_distance_numpy()

test_dist_m4ri.test_classical_distance_numpy ( )

Definition at line 35 of file test_dist_m4ri.py.

References dist_m4ri.compute_classical_distance().

◆ test_classify_qubits_checks_measured_in_hadamard_frame()

test_dist_m4ri.test_classify_qubits_checks_measured_in_hadamard_frame ( )

◆ test_cli_argument_parsing()

test_dist_m4ri.test_cli_argument_parsing ( )

Definition at line 380 of file test_dist_m4ri.py.

References dist_m4ri.parse_cli_args().

◆ test_cli_binary_compatibility_silent()

test_dist_m4ri.test_cli_binary_compatibility_silent ( capsys)

Definition at line 712 of file test_dist_m4ri.py.

References dist_m4ri.main().

◆ test_cli_conflict_warnings()

test_dist_m4ri.test_cli_conflict_warnings ( capsys)

Definition at line 2136 of file test_dist_m4ri.py.

References dist_m4ri.enable_distance_cache(), and dist_m4ri.main().

◆ test_cli_css_dx_dz_bounds()

test_dist_m4ri.test_cli_css_dx_dz_bounds ( capsys)

Definition at line 532 of file test_dist_m4ri.py.

References dist_m4ri.main().

◆ test_cli_dstop()

test_dist_m4ri.test_cli_dstop ( capsys)

◆ test_cli_help()

test_dist_m4ri.test_cli_help ( capsys)

Definition at line 621 of file test_dist_m4ri.py.

References dist_m4ri.main().

◆ test_cli_identical_finc_outc_nonexistent()

test_dist_m4ri.test_cli_identical_finc_outc_nonexistent ( capsys)

Definition at line 594 of file test_dist_m4ri.py.

References dist_m4ri.main().

◆ test_cli_morehelp()

test_dist_m4ri.test_cli_morehelp ( capsys)

Definition at line 632 of file test_dist_m4ri.py.

References dist_m4ri.main().

◆ test_cli_morehelp_topic()

test_dist_m4ri.test_cli_morehelp_topic ( capsys)

Definition at line 642 of file test_dist_m4ri.py.

References dist_m4ri.main().

◆ test_cli_no_args_error()

test_dist_m4ri.test_cli_no_args_error ( capsys)

Definition at line 695 of file test_dist_m4ri.py.

References dist_m4ri.main().

◆ test_cli_outc_keeps_finc_codewords()

test_dist_m4ri.test_cli_outc_keeps_finc_codewords ( tmp_path,
capsys )

◆ test_cli_start_trust_start_and_disabled_options()

test_dist_m4ri.test_cli_start_trust_start_and_disabled_options ( capsys)

◆ test_cli_verbose_mode()

test_dist_m4ri.test_cli_verbose_mode ( capsys)

Definition at line 546 of file test_dist_m4ri.py.

References dist_m4ri.main().

◆ test_cli_version()

test_dist_m4ri.test_cli_version ( capsys)

Definition at line 703 of file test_dist_m4ri.py.

References dist_m4ri.main().

◆ test_codedistance_solver()

test_dist_m4ri.test_codedistance_solver ( )

Definition at line 197 of file test_dist_m4ri.py.

◆ test_codedistance_unused_defaults()

test_dist_m4ri.test_codedistance_unused_defaults ( )

Definition at line 2643 of file test_dist_m4ri.py.

◆ test_css_and_quantum_distance_inputs()

test_dist_m4ri.test_css_and_quantum_distance_inputs ( )

◆ test_css_cache_migration()

test_dist_m4ri.test_css_cache_migration ( tmp_path)

◆ test_css_distance_files()

test_dist_m4ri.test_css_distance_files ( )

Definition at line 97 of file test_dist_m4ri.py.

References dist_m4ri.compute_css_distance().

◆ test_css_distance_requires_both_matrices()

test_dist_m4ri.test_css_distance_requires_both_matrices ( capsys)

◆ test_css_distance_sparse()

test_dist_m4ri.test_css_distance_sparse ( )

Definition at line 110 of file test_dist_m4ri.py.

References dist_m4ri.compute_css_distance().

◆ test_css_outc_sector_files_and_finc()

test_dist_m4ri.test_css_outc_sector_files_and_finc ( tmp_path,
capsys )

◆ test_css_user_dmax_and_sector_records()

test_dist_m4ri.test_css_user_dmax_and_sector_records ( tmp_path,
capsys )

◆ test_debug_bits()

◆ test_dem_cache_merged_bounds_and_circuit_key()

test_dist_m4ri.test_dem_cache_merged_bounds_and_circuit_key ( tmp_path,
capsys )

◆ test_dem_circuit_outc_without_out_dem_warning()

test_dist_m4ri.test_dem_circuit_outc_without_out_dem_warning ( tmp_path,
capsys )

◆ test_dem_distance_file()

test_dist_m4ri.test_dem_distance_file ( )

◆ test_dem_distance_stim()

test_dist_m4ri.test_dem_distance_stim ( )

Definition at line 159 of file test_dist_m4ri.py.

References dist_m4ri.compute_dem_distance().

◆ test_dem_drop_minority_detectors()

◆ test_dem_error_columns_parser()

test_dist_m4ri.test_dem_error_columns_parser ( tmp_path)

Definition at line 2287 of file test_dist_m4ri.py.

References dist_m4ri._dem_error_columns().

◆ test_dem_expand_equal_columns()

◆ test_dem_force_noise_and_p_noise()

◆ test_dem_merge_equal_columns()

test_dist_m4ri.test_dem_merge_equal_columns ( tmp_path,
capsys )

◆ test_dem_out_reduced()

◆ test_distance_result_eq()

test_dist_m4ri.test_distance_result_eq ( )

Definition at line 1773 of file test_dist_m4ri.py.

◆ test_dmin_dmax_parameters()

test_dist_m4ri.test_dmin_dmax_parameters ( )

◆ test_dstop_stop_target()

test_dist_m4ri.test_dstop_stop_target ( tmp_path,
capsys )

◆ test_explain_bounds()

test_dist_m4ri.test_explain_bounds ( )

Definition at line 463 of file test_dist_m4ri.py.

References dist_m4ri.explain_bounds().

◆ test_explain_bounds_model_check_needs_hit_counts()

test_dist_m4ri.test_explain_bounds_model_check_needs_hit_counts ( )

Definition at line 2601 of file test_dist_m4ri.py.

References dist_m4ri.explain_bounds().

◆ test_find_binary()

test_dist_m4ri.test_find_binary ( )

Definition at line 23 of file test_dist_m4ri.py.

References dist_m4ri.find_dist_m4ri_binary().

◆ test_format_bounds_list_and_str()

test_dist_m4ri.test_format_bounds_list_and_str ( )

◆ test_ignored_inputs_warnings()

test_dist_m4ri.test_ignored_inputs_warnings ( tmp_path,
capsys,
monkeypatch )

◆ test_kwin_negative_turns_windows_off()

test_dist_m4ri.test_kwin_negative_turns_windows_off ( capsys)

◆ test_matrix_writer()

test_dist_m4ri.test_matrix_writer ( tmp_path)

Definition at line 52 of file test_dist_m4ri.py.

References dist_m4ri._matrix_to_file(), and dist_m4ri.run_dist_m4ri().

◆ test_model_detector_groups_end_of_circuit_and_pure_dem()

test_dist_m4ri.test_model_detector_groups_end_of_circuit_and_pure_dem ( tmp_path)

◆ test_model_lower_bound()

◆ test_normalize_start_list()

test_dist_m4ri.test_normalize_start_list ( )

Definition at line 1197 of file test_dist_m4ri.py.

References dist_m4ri._start_key_suffix().

◆ test_ortho_option()

◆ test_pairs_option()

◆ test_persistent_json_cache()

◆ test_quantum_cache_separation()

◆ test_quantum_distance_single_sided()

test_dist_m4ri.test_quantum_distance_single_sided ( )

Definition at line 370 of file test_dist_m4ri.py.

References dist_m4ri.compute_quantum_distance().

◆ test_refresh_passed_to_binary()

test_dist_m4ri.test_refresh_passed_to_binary ( capsys)

Definition at line 2609 of file test_dist_m4ri.py.

References dist_m4ri.run_dist_m4ri().

◆ test_run_dist_m4ri_start_list_and_disabled_options()

test_dist_m4ri.test_run_dist_m4ri_start_list_and_disabled_options ( capsys)

Definition at line 1215 of file test_dist_m4ri.py.

References dist_m4ri.run_dist_m4ri().

◆ test_run_dist_m4ri_stop_event()

test_dist_m4ri.test_run_dist_m4ri_stop_event ( capsys)

Definition at line 1810 of file test_dist_m4ri.py.

References dist_m4ri.run_dist_m4ri().

◆ test_run_dist_m4ri_three_numbers()

test_dist_m4ri.test_run_dist_m4ri_three_numbers ( )

Definition at line 207 of file test_dist_m4ri.py.

References dist_m4ri.run_dist_m4ri().

◆ test_rw_infoset_estimate()

test_dist_m4ri.test_rw_infoset_estimate ( )

◆ test_rw_ksub_kwin_min_hits()

◆ test_sort_rows_option()

◆ test_start_list_cache_records()

test_dist_m4ri.test_start_list_cache_records ( tmp_path,
monkeypatch,
capsys )

◆ test_start_list_trust_after_calculation_css()

test_dist_m4ri.test_start_list_trust_after_calculation_css ( tmp_path)

◆ test_start_scan_option()

◆ test_stim_out_dem_out_stim_out_dir()

◆ test_stim_pauli_channel_circuit()

test_dist_m4ri.test_stim_pauli_channel_circuit ( tmp_path,
capsys )

◆ test_stim_rounds_option()

◆ test_stim_simple_vs_full_and_basis_tracking()

test_dist_m4ri.test_stim_simple_vs_full_and_basis_tracking ( tmp_path,
capsys )

◆ test_stim_xzzx_rotated_css()

test_dist_m4ri.test_stim_xzzx_rotated_css ( tmp_path,
capsys )

◆ test_unknown_keyword_arguments()

test_dist_m4ri.test_unknown_keyword_arguments ( )

◆ test_win_hyb_option()

◆ test_zero_rank_g_and_css_sectors()

Variable Documentation

◆ EXAMPLES_DIR

test_dist_m4ri.EXAMPLES_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "examples"))

Definition at line 20 of file test_dist_m4ri.py.

◆ S5_H

test_dist_m4ri.S5_H = os.path.join(EXAMPLES_DIR, "surf_d5_H.mmx")

Definition at line 1193 of file test_dist_m4ri.py.

◆ S5_L

test_dist_m4ri.S5_L = os.path.join(EXAMPLES_DIR, "surf_d5_L.mmx")

Definition at line 1194 of file test_dist_m4ri.py.

◆ SURF_D3_DEM

test_dist_m4ri.SURF_D3_DEM = os.path.join(EXAMPLES_DIR, "surf_d3.dem")

Definition at line 2118 of file test_dist_m4ri.py.

◆ TRY_X

test_dist_m4ri.TRY_X = os.path.join(EXAMPLES_DIR, "tryX.mtx")

Definition at line 1755 of file test_dist_m4ri.py.

◆ TRY_Z

test_dist_m4ri.TRY_Z = os.path.join(EXAMPLES_DIR, "tryZ.mtx")

Definition at line 1756 of file test_dist_m4ri.py.