Datasets:
Formats:
json
Languages:
English
Size:
< 1K
Tags:
mathematics
information-theory
experimental-design
memory-compression
linear-algebra
quantum-information
Download research/experiments/continuation_experiments.py from PureOne/OQAIVAEI: direct link, hf CLI and curl.
- Browser
- Download file 2 kB
-
https://huggingface.co/datasets/PureOne/OQAIVAEI/resolve/main/research/experiments/continuation_experiments.py
- Command line
-
hf download hf://datasets/PureOne/OQAIVAEI/research/experiments/continuation_experiments.py
-
curl -L -o continuation_experiments.py https://huggingface.co/datasets/PureOne/OQAIVAEI/resolve/main/research/experiments/continuation_experiments.py
2 kB
| """Reproduce exact closure and the analytic rank-error frontier.""" | |
| import json | |
| import sys | |
| from pathlib import Path | |
| import numpy as np | |
| ROOT = Path(__file__).resolve().parents[1] | |
| sys.path.insert(0, str(ROOT / "src")) | |
| from oqaivaei.continuation import ( | |
| involution_pair, exact_closure, balanced_real_projector, | |
| coordinate_minimax_error, | |
| ) | |
| def run(): | |
| closures = [] | |
| for n in [3, 4, 5, 8, 12, 16]: | |
| a, b, c = involution_pair(n) | |
| combined = exact_closure([a, b], c) | |
| closures.append({ | |
| "n": n, "rank_a": exact_closure([a], c).dimension, | |
| "rank_b": exact_closure([b], c).dimension, | |
| "rank_combined": combined.dimension, | |
| "dimensions_by_round": combined.dimensions_by_round, | |
| "maximum_retained_word_length": max(map(len, combined.words)), | |
| }) | |
| rows = [] | |
| for n in [8, 16, 32, 64]: | |
| for k in range(n + 1): | |
| p = balanced_real_projector(n, k) | |
| measured = coordinate_minimax_error(p) | |
| expected = float(np.sqrt(1 - k / n)) | |
| rows.append({"n": n, "k": k, "formula": expected, | |
| "constructed_error": measured, | |
| "absolute_residual": abs(measured - expected)}) | |
| return {"exact_closures": closures, "rank_error_frontier": rows, | |
| "max_absolute_residual": max(r["absolute_residual"] for r in rows), | |
| "verification": "exact rational closure; floating-point projectors", | |
| "data_kind": "synthetic mathematical instances"} | |
| if __name__ == "__main__": | |
| out = ROOT / "results" / "continuation_results.json" | |
| out.parent.mkdir(exist_ok=True) | |
| result = run() | |
| out.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8") | |
| print(json.dumps({"output": str(out), "exact_instances": len(result["exact_closures"]), | |
| "frontier_points": len(result["rank_error_frontier"]), | |
| "max_residual": result["max_absolute_residual"]})) | |