更新脚本
Some checks failed
Build wheels / build (ubuntu-latest, 3.11) (push) Has been cancelled
Build wheels / build (ubuntu-latest, 3.12) (push) Has been cancelled
Build wheels / build (ubuntu-latest, 3.13) (push) Has been cancelled
Tests / check (push) Has been cancelled
Tests / build (ubuntu-latest, 3.11) (push) Has been cancelled
Tests / build (ubuntu-latest, 3.12) (push) Has been cancelled
Tests / build (ubuntu-latest, 3.13) (push) Has been cancelled

This commit is contained in:
2026-05-09 21:15:19 +08:00
parent ff96e36cfc
commit fea8e5abc0
2 changed files with 33 additions and 5 deletions

View File

@@ -70,6 +70,8 @@ def main():
parser.add_argument("--exact", action="store_true")
parser.add_argument("--exact-max-qubits", type=int, default=24)
parser.add_argument("--preprocess", action="store_true")
parser.add_argument("--compile-circuit", action="store_true")
parser.add_argument("--track-memory", action="store_true")
args = parser.parse_args()
logging.getLogger("qibo.config").setLevel(logging.ERROR)
logging.getLogger("qtealeaves").setLevel(logging.ERROR)
@@ -105,10 +107,17 @@ def main():
cut_ratio=args.cut_ratio,
svd_control=args.svd_control,
tensor_module=args.tensor_module,
compile_circuit=args.compile_circuit,
track_memory=args.track_memory,
)
start = time.perf_counter()
value = float(
backend.expectation(circuit, observable, preprocess=args.preprocess).real
backend.expectation(
circuit,
observable,
preprocess=args.preprocess,
compile_circuit=args.compile_circuit,
).real
)
elapsed = time.perf_counter() - start
abs_error = float("nan") if exact is None else abs(value - exact)