文档中的步骤
结构步骤(非实际执行时序)
marqdo
可选扩展(非 stdlib)。安装:marqdo ext add quantum(或编译 marqdo_plugin_quantum)。
GHZ(3 比特):q0 哈达玛,再控非 0→1、0→2。理想 |000⟩ / |111⟩ 各约 1/2。
Q7:密度 / 部分迹 / Schmidt / 绘图 种类=hinton 等 — examples/quantum-entanglement/。
| 步 | 门 | 比特 |
|---|---|---|
| 1 | H | 0 |
| 2 | CX | 0,1 |
| 3 | CX | 0,2 |
| _type | 门 |
| name | H |
| key | value |
|---|---|
| _type | 门 |
| name | H |
| _type | quantum_svg |
| kind | probs |
| ops | … |
| qubits | 3 |
| svg | <svg xmlns="http://www.w3.org/2000/s… |
| key | value |
|---|---|
| _type | quantum_svg |
| kind | probs |
| ops | 3 |
| qubits | 3 |
| svg | <svg xmlns="http://www.w3.org/2000/svg" width="152" height="180" viewBox="0 0 152.0 180.0" data-theme="dark" role="img" aria-label="measurement probabilities"><defs> <linearGradient id="mq-bg" x1="0" y1="0" x2="1" y2="1"> <stop offset="0%" stop-color="#0a0e14"/> <stop offset="55%" stop-color="#141c28"/> <stop offset="100%" stop-color="#0a0e14"/> </linearGradient> <filter id="mq-glow" x="-40%" y="-40%" width="180%" height="180%"> <feGaussianBlur stdDeviation="2.2" result="b"/> <feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge> </filter> <filter id="mq-soft" x="-20%" y="-20%" width="140%" height="140%"> <feDropShadow dx="0" dy="1.5" stdDeviation="1.8" flood-color="#4c6fff" flood-opacity="0.35"/> </filter> </defs><rect width="152.0" height="180.0" rx="14" fill="url(#mq-bg)"/><line x1="36" y1="144" x2="136" y2="144" stroke="#7d8fa3" stroke-width="1.2"/><line x1="36" y1="24" x2="36" y2="144" stroke="#7d8fa3" stroke-width="1.2"/><text x="8" y="28" font-family="ui-monospace,Menlo,Consolas,monospace" font-size="10" fill="#e8eef6">1</text><text x="8" y="148" font-family="ui-monospace,Menlo,Consolas,monospace" font-size="10" fill="#e8eef6">0</text><rect x="40" y="83.99999999999999" width="36" height="60.000000000000014" rx="4" fill="#5b7cfa" stroke="#f0f5ff" stroke-width="1" filter="url(#mq-soft)"/><text x="58" y="162" text-anchor="middle" font-family="ui-monospace,Menlo,Consolas,monospace" font-size="11" fill="#e8eef6">000</text><text x="58" y="78.99999999999999" text-anchor="middle" font-family="ui-monospace,Menlo,Consolas,monospace" font-size="10" fill="#93a4b8">0.50</text><rect x="88" y="83.99999999999999" width="36" height="60.000000000000014" rx="4" fill="#5b7cfa" stroke="#f0f5ff" stroke-width="1" filter="url(#mq-soft)"/><text x="106" y="162" text-anchor="middle" font-family="ui-monospace,Menlo,Consolas,monospace" font-size="11" fill="#e8eef6">111</text><text x="106" y="78.99999999999999" text-anchor="middle" font-family="ui-monospace,Menlo,Consolas,monospace" font-size="10" fill="#93a4b8">0.50</text></svg> |
| _type | quantum_svg |
| kind | matrix |
| svg | <svg xmlns="http://www.w3.org/2000/s… |
| key | value |
|---|---|
| _type | quantum_svg |
| kind | matrix |
| svg | <svg xmlns="http://www.w3.org/2000/svg" width="196" height="192" viewBox="0 0 196.0 192.0" role="img" aria-label="gate matrix heatmap"><text x="8" y="18" font-family="ui-monospace,Menlo,monospace" font-size="12" fill="#1a1a1a">H matrix</text><text x="8" y="67.6" font-family="ui-monospace,Menlo,monospace" font-size="10" fill="#666">0</text><text x="72" y="22" text-anchor="middle" font-family="ui-monospace,Menlo,monospace" font-size="10" fill="#666">0</text><rect x="36" y="28" width="72" height="72" fill="rgb(107,116,247)" stroke="#1a1a1a" stroke-width="0.8"/><text x="72" y="67.6" text-anchor="middle" font-family="ui-monospace,Menlo,monospace" font-size="9" fill="#fff">0.707</text><rect x="108" y="28" width="72" height="72" fill="rgb(107,116,247)" stroke="#1a1a1a" stroke-width="0.8"/><text x="144" y="67.6" text-anchor="middle" font-family="ui-monospace,Menlo,monospace" font-size="9" fill="#fff">0.707</text><text x="8" y="139.60000000000002" font-family="ui-monospace,Menlo,monospace" font-size="10" fill="#666">1</text><text x="144" y="22" text-anchor="middle" font-family="ui-monospace,Menlo,monospace" font-size="10" fill="#666">1</text><rect x="36" y="100" width="72" height="72" fill="rgb(107,116,247)" stroke="#1a1a1a" stroke-width="0.8"/><text x="72" y="139.6" text-anchor="middle" font-family="ui-monospace,Menlo,monospace" font-size="9" fill="#fff">0.707</text><rect x="108" y="100" width="72" height="72" fill="rgb(107,116,247)" stroke="#1a1a1a" stroke-width="0.8"/><text x="144" y="139.6" text-anchor="middle" font-family="ui-monospace,Menlo,monospace" font-size="9" fill="#fff">-0.707</text></svg> |
| 000 | 0.5 |
| 111 | 0.5 |
| key | value |
|---|---|
| 000 | 0.5 |
| 111 | 0.5 |
| _type | 电路 |
| ops | … |
| qubits | 3 |
| key | value | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| _type | 电路 | ||||||||||||||||||||||||||||
| ops |
| ||||||||||||||||||||||||||||
| qubits | 3 |
| 步 | List(3) |
| 门 | List(3) |
| 比特 | List(3) |
| key | value | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| 步 |
| ||||||||
| 门 |
| ||||||||
| 比特 |
|
--- markup: occlusion title: 量子电路(ext/quantum) description: 官方量子模拟 — 表、门、Q7 密度与高级图、Q8 主题 SVG 导入: 量子: ext/quantum/量子.mq.md --- # main 可选扩展(非 stdlib)。安装:`marqdo ext add quantum`(或编译 `marqdo_plugin_quantum`)。 GHZ(3 比特):q0 哈达玛,再控非 0→1、0→2。理想 |000⟩ / |111⟩ 各约 1/2。 Q7:密度 / 部分迹 / Schmidt / `绘图 种类=hinton` 等 — `examples/quantum-entanglement/`。 Q8:`绘图 主题="dark"|"light"|"bw"`(默认 dark 科技感)作用于电路 / 概率 / 布洛赫。改插件后须再 `ext add`,view 才会加载新 `.so`。 `步骤` = | 步 | 门 | 比特 | |----|----|------| | 1 | H | 0 | | 2 | CX | 0,1 | | 3 | CX | 0,2 | **`qc` = > 量子.电路 比特数=3 步骤=`步骤`** **`p` = > `qc`.概率** **`_` = > `qc`.绘图 种类="probs" 主题="dark"** **`H` = > 量子.门 名="H"** **`__` = > `H`.绘图 种类="matrix"** > 打印 内容=`p` > 打印 内容=量子特性-ok