Add ext/quantum Q0–Q1: ABI simulator with H/CX and Bell smoke.
Register the quantum catalog package, English/Chinese circuit APIs, and a state-vector plugin that verifies Bell-state probabilities. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
25b6b86c26
commit
4a7a33e29a
12 files changed
+799
-9
No files matched your search
@@ -0,0 +1,42 @@
|
||||
---
|
||||
title: quantum bell smoke
|
||||
description: H+CX Bell state probabilities ≈ 1/2 each.
|
||||
> ext/quantum/quantum.mq.md
|
||||
> lib/math.mq.md
|
||||
> lib/json.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
*`qc` = > quantum.circuit qubits=2 *
|
||||
*`qc` = > `qc`.h qubit=0 *
|
||||
*`qc` = > `qc`.cx control=0 target=1 *
|
||||
*`p` = > `qc`.probabilities *
|
||||
|
||||
*`p00` = > json.get value=`p` key="00" *
|
||||
*`p11` = > json.get value=`p` key="11" *
|
||||
*`lo` = > math.div a=2 b=5 *
|
||||
*`hi` = > math.div a=3 b=5 *
|
||||
|
||||
1. `p00` > `lo`
|
||||
1. `p00` < `hi`
|
||||
> print text=p00-ok
|
||||
2. *
|
||||
> print text=p00-fail
|
||||
2. *
|
||||
> print text=p00-fail
|
||||
|
||||
1. `p11` > `lo`
|
||||
1. `p11` < `hi`
|
||||
> print text=p11-ok
|
||||
2. *
|
||||
> print text=p11-fail
|
||||
2. *
|
||||
> print text=p11-fail
|
||||
|
||||
*`ping` = > quantum_ping *
|
||||
*`ok` = > json.get value=`ping` key=ok *
|
||||
1. `ok`
|
||||
> print text=ping-ok
|
||||
2. *
|
||||
> print text=ping-fail
|
||||
@@ -1374,6 +1374,22 @@ custom-ok",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ext_quantum_bell_smoke() {
|
||||
let status = Command::new("cargo")
|
||||
.args(["build", "-p", "marqdo_plugin_quantum"])
|
||||
.current_dir(env!("CARGO_MANIFEST_DIR"))
|
||||
.status()
|
||||
.expect("build quantum plugin");
|
||||
assert!(status.success(), "failed to build marqdo_plugin_quantum");
|
||||
assert_out(
|
||||
"tests/ext/quantum-bell-smoke.mq.md",
|
||||
"p00-ok
|
||||
p11-ok
|
||||
ping-ok",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ext_agent_framework_smoke() {
|
||||
let status = Command::new("cargo")
|
||||
|
||||
Reference in new issue
Block a user