qram_simulator.baseline.metrics¶
Distribution metrics shared by both sides of the baseline comparison.
The QRAM-Simulator side returns {"addr:bus": prob} dictionaries (from
QRAMCircuitQubit.get_output_distribution) and the circuit side returns the
same key convention (CircuitQRAMQubit.marginal_distribution), so all
metrics below are convention-identical on the two sides:
classical_fidelity: (sum sqrt(p q))^2 over the joint (addr, bus) keys;tvd: total variation distance of the same;renormalization is applied per side by its own total (survival / trace) before comparison whenever either side is sub-normalized (Damping).
Functions¶
|
Classical distribution fidelity (sum of sqrt(p*q))^2. |
|
Total mass (survival probability of a sub-normalized distribution). |
|
Element-wise mean over a collection of distributions (missing keys = 0). |
|
Return p divided by its total mass (identity when already normalized). |
|
Total variation distance 0.5 * sum |p - q|. |
Module Contents¶
- qram_simulator.baseline.metrics.classical_fidelity(p: Mapping[str, float], q: Mapping[str, float]) float[source]¶
Classical distribution fidelity (sum of sqrt(p*q))^2.
- qram_simulator.baseline.metrics.dist_total(p: Mapping[str, float]) float[source]¶
Total mass (survival probability of a sub-normalized distribution).
- qram_simulator.baseline.metrics.mean_of_dists(dists: Iterable[Mapping[str, float]]) dict[str, float][source]¶
Element-wise mean over a collection of distributions (missing keys = 0).