Validation Suite¶
The cases and what they check are described in Validation Gallery.
Validation suite: textbook problems with known answers.
Every case solves a small open-quantum-system problem whose answer is known independently of this library (a closed formula, an exactly solvable rate equation, a higher-accuracy reference solve, or QuTiP) and reports one number: how far the solver is from that answer, next to the tolerance it must meet.
Run the suite and write a report with:
oqs validate --output-dir validation-report
or from Python:
import openquantumsim.validation as validation
report = validation.run_validation()
print(report.to_markdown())
The same cases back tests/physics/test_validation_suite.py, so a release
cannot pass its tests without also passing its validation report.
- class openquantumsim.validation.ValidationCase(name, title, category, solver, reference, metric, tolerance, run)[source]¶
Bases:
objectOne problem with a known answer.
- Parameters:
name (str)
title (str)
category (str)
solver (str)
reference (str)
metric (str)
tolerance (float)
run (Callable[[], tuple[float, str]])
- class openquantumsim.validation.ValidationOutcome(case, status, measured, wall_time, detail='')[source]¶
Bases:
objectResult of running one
ValidationCase.- Parameters:
case (ValidationCase)
status (str)
measured (float | None)
wall_time (float)
detail (str)
- property passed: bool¶
Whether the case met its tolerance.
- class openquantumsim.validation.ValidationReport(outcomes, environment)[source]¶
Bases:
objectOutcomes of a validation run together with the environment it ran in.
- Parameters:
outcomes (tuple[ValidationOutcome, ...])
environment (dict[str, str])
- property passed: bool¶
Whether no case failed or errored. Skipped cases do not fail.
- exception openquantumsim.validation.ValidationSkipped[source]¶
Bases:
ExceptionA case could not run because an optional dependency is missing.
- openquantumsim.validation.run_validation(names=None, *, progress=None)[source]¶
Run the validation cases and collect a report.
namesrestricts the run to the given case names.progressis called with each outcome as soon as it is available.- Parameters:
names (Sequence[str] | None)
progress (Callable[[ValidationOutcome], None] | None)
- Return type:
- openquantumsim.validation.validation_cases()[source]¶
Return every validation case, in report order.
- Return type:
list[ValidationCase]