2 """Benchmark matrix validation for performance evidence. 4 Freezes the dual-anchor benchmark matrix and representative review-set membership 5 through one stable machine-reviewable surface. 8 python benchmarks/density_matrix/performance_evidence/benchmark_matrix_validation.py 11 from __future__
import annotations
14 from pathlib
import Path
16 REPO_ROOT = Path(__file__).resolve().parents[3]
17 if str(REPO_ROOT)
not in sys.path:
18 sys.path.insert(0, str(REPO_ROOT))
20 from benchmarks.density_matrix.performance_evidence.common
import (
21 PERFORMANCE_EVIDENCE_BENCHMARK_SLICE_CONTINUITY,
22 PERFORMANCE_EVIDENCE_BENCHMARK_SLICE_STRUCTURED,
23 performance_evidence_output_dir,
25 from benchmarks.density_matrix.performance_evidence.case_selection
import (
26 build_performance_evidence_inventory_cases,
28 from benchmarks.density_matrix.performance_evidence.validation_support
import (
29 assemble_benchmark_matrix_bundle,
31 from benchmarks.density_matrix.validation_scaffold
import (
32 require_bundle_fields,
36 SUITE_NAME =
"performance_evidence_benchmark_matrix" 37 ARTIFACT_FILENAME =
"benchmark_matrix_bundle.json" 39 ARTIFACT_CORE_FIELDS = (
55 "total_cases": len(cases),
56 "continuity_cases": sum(
57 case[
"benchmark_slice"] == PERFORMANCE_EVIDENCE_BENCHMARK_SLICE_CONTINUITY
60 "structured_cases": sum(
61 case[
"benchmark_slice"] == PERFORMANCE_EVIDENCE_BENCHMARK_SLICE_STRUCTURED
64 "representative_review_cases": sum(case[
"representative_review_case"]
for case
in cases),
65 "continuity_qbits": sorted(
66 {case[
"qbit_num"]
for case
in cases
if case[
"case_kind"] ==
"continuity"}
68 "structured_qbits": sorted(
72 if case[
"case_kind"] ==
"structured_family" 75 "structured_seed_count": len(
79 if case[
"case_kind"] ==
"structured_family" 82 "noise_patterns": sorted(
86 if case[
"noise_pattern"]
is not None 95 def main(argv: list[str] |
None =
None) -> int:
98 build_cases=build_benchmark_matrix_cases,
99 build_artifact_bundle=build_benchmark_matrix_bundle,
100 artifact_filename=ARTIFACT_FILENAME,
101 default_output_dir=DEFAULT_OUTPUT_DIR,
102 description=__doc__
or "",
103 output_dir_help=
"Directory to write the benchmark matrix bundle into.",
104 quiet_report=
lambda b: print(
105 "total_cases={total_cases}, continuity_cases={continuity_cases}, structured_cases={structured_cases}, representative_review_cases={representative_review_cases}".format(
112 if __name__ ==
"__main__":
113 raise SystemExit(
main())
def build_benchmark_matrix_bundle
def build_benchmark_matrix_cases()
def performance_evidence_output_dir
def build_performance_evidence_inventory_cases()
def assemble_benchmark_matrix_bundle
def require_bundle_fields