MarqdoEXECUTABLE KNOWLEDGE

Quantum circuits (ext/quantum)ok

features/06-quantum.mq.md

文档

怎样读这份可执行文档

正文说明意图,标记指出哪些片段会执行。遮蔽只在正文显示动作说明,实际逻辑放在侧注;阅读、展开与定位都不会运行代码。

标记阅读含义
无标记文字作者的解释,按普通 Markdown 阅读。
空行分隔叙述与结构,不是计算步骤。
# / ##一级标题声明对象或入口,更深标题声明函数;说明按钮可查看输入、返回与依据。
>调用函数;实际执行结果另有标注。
1. 递增按条件选择分支,不是普通编号说明。
-重复或遍历结构;迭代选择器只切换已有运行记录。
+ `名`兼容的显式形参;新库优先在叙述中声明参数,标题下的表格解释契约。
GFM 表未绑定的契约表是说明;绑定表按列、行和 @ 形态构成数据。
```lang代码块;绑定的外语代码与普通示例区分展示,数学公式另有公式卡片。
--- / ***分隔内容,不能把分隔线当作函数返回。
<!-- marqdo-out -->程序写回的结果,区别于作者原始正文。
`名`叙述中的参数或变量;默认值跟在名称之后。
**…**执行语句:赋值、调用或计算;不是打印,也不是返回。
*…*返回表达式;句中以返回、Return 等明确引出。
*None* / ****显式返回空值或结束当前函数。
[键](集合)正文显示描述,侧注按函数与参数、可跳转链接、结构化内容展示括号内的细节;空括号表示待补充实际逻辑。阅读不会执行调用。classic 模式保留旧链接取元。
修饰… [函数] …兼容的带修饰调用;不能把任意普通链接当作执行授权。
集合[^键]兼容的脚注取元;当前库优先用 access 读取集合。
*仅* / **说明**普通强调仍属于文字;界面按真实解析结果区分强调、语句与返回。
quantum:ext/quantum/circuit/index.mq.mdgate:ext/quantum/gate/index.mq.md

main

说明
返回类型说明
resultanyNone; execute this page's documented steps in order and observe their output or stated effects

Optional package (not stdlib). Install: marqdo ext add quantum (or build marqdo_plugin_quantum).

GHZ (3 qubits): H on q0, then CX 0→1 and 0→2. Ideal |000⟩ / |111⟩ each ≈ 1/2.

Q7: Bell density, partial trace, Schmidt, draw kind=hinton / qsphere — examples/quantum-entanglement/.

Q8: draw theme="dark"|"light"|"bw" (default dark lab look) on circuit / probs / bloch. Rebuild plugin then ext add so view loads the new native lib.

steps =
stepgatequbits
1H0
2CX0,1
3CX0,2
We first qc = for the next step.
函数调用Compute qc
quantum.circuit
qubits
3
steps
`steps`
原始写法
quantum.circuit(qubits=3, steps=`steps`)
源码说明 · 不是运行结果
We first p = for the next step.
函数调用Compute p
qc.probabilities

无需传入参数

原始写法
> `qc`.probabilities
源码说明 · 不是运行结果
We first _ = for the next step.
函数调用Compute _
qc.draw
kind
probs
theme
dark
原始写法
> `qc`.draw kind="probs" theme="dark"
源码说明 · 不是运行结果
We first H = for the next step.
函数调用Compute H
gate.gate
name
H
原始写法
gate.gate(name="H")
源码说明 · 不是运行结果
We first __ = for the next step.
函数调用Compute __
H.draw
kind
matrix
原始写法
> `H`.draw kind="matrix"
源码说明 · 不是运行结果
We now .
函数调用Display this step's result
print
text
`p`
原始写法
> print text=`p`
源码说明 · 不是运行结果
We now .
函数调用Display this step's result
print
text
quantum-feature-ok
原始写法
> print text="quantum-feature-ok"
源码说明 · 不是运行结果
Functions
Variables
  • H gate
    _typegate
    _type_moduleList(1)
    nameH
  • _ quantum_svg
    _typequantum_svg
    kindprobs
    ops…
    qubits3
    svg<svg xmlns="http://www.w3.org/2000/s…
  • __ quantum_svg
    _typequantum_svg
    kindmatrix
    svg<svg xmlns="http://www.w3.org/2000/s…
  • description text
    Official quantum simulator — tables, gates, Q7 density, Q8 themed SVG
  • markup text
    occlusion
  • p map · 2
    0000.5
    1110.5
  • qc circuit
    _typecircuit
    _type_moduleList(1)
    ops…
    qubits3
  • steps map · 3
    stepList(3)
    gateList(3)
    qubitsList(3)
  • title text
    Quantum circuits (ext/quantum)
可执行知识 · 输入、返回与依据

这份文档怎样成为可调用的知识

1 个知识单元 · 14 个结构步骤。先读输入、返回与调用边界,再按需查看依赖和依据。

以下来自静态分析,不代表程序已经运行、测试通过或内容已获领域确认。实际运行见正文标注与“运行与结果”。

main程序入口
回到正文 · 第 10 行

这是程序入口或对象声明。成员函数的输入输出在各自说明中列出。

源码中的返回契约

any · None; execute this page's documented steps in order and observe their output or stated effects

调用边界

输出文本、plugin.call、process.control。权限由实际运行入口授予;静态副作用信息不等于运行许可。

当前有哪些依据

语法与引用
检查通过;检查通过
契约检查
尚未检查
测试记录
没有可用记录
内容来源
尚无已核验证据
领域审阅
尚未进行领域审阅
查看本单元的结构步骤

这是源码结构,不是实际执行时序;正文引用不会因阅读而执行。

  1. 调用Compute qc
  2. 正文引用Compute _
  3. 正文引用Compute H
  4. 正文引用Compute __
  5. 正文引用Display this step's result
  6. 正文引用Display this step's result
  7. 调用Compute p
  8. 调用Compute _
  9. 调用Compute H
  10. 调用Compute __
  11. 调用Display this step's result
  12. 调用Display this step's result
  13. 正文引用Compute qc
  14. 正文引用Compute p
技术详情:身份、摘要与原始状态
目标标识
mq://public/features%2F06-quantum/type/main
制品摘要(未检查锁定状态)
sha256:31b4c3e099fffb0a35f22f46dddc23eb7ebcd925c6d6e2e7b17727f6fed43064
依赖标识
原始验证状态
parse: passed; resolve: passed; contract: unchecked; execution: not_run; tests: unknown; evidence: unverified; domain: unreviewed

运行与结果

{000: 0.5, 111: 0.5} quantum-feature-ok
100000.501110.50
H matrix000.7070.707110.707-0.707
完整源码
---
markup: occlusion
title: Quantum circuits (ext/quantum)
description: Official quantum simulator — tables, gates, Q7 density, Q8 themed SVG
import:
  quantum: ext/quantum/circuit/index.mq.md
  gate: ext/quantum/gate/index.mq.md
---

# main

| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | None; execute this page's documented steps in order and observe their output or stated effects |

Optional package (not stdlib). Install: `marqdo ext add quantum` (or build `marqdo_plugin_quantum`).

GHZ (3 qubits): H on q0, then CX 0→1 and 0→2. Ideal |000⟩ / |111⟩ each ≈ 1/2.

Q7: Bell density, partial trace, Schmidt, `draw kind=hinton` / qsphere — `examples/quantum-entanglement/`.

Q8: `draw theme="dark"|"light"|"bw"` (default dark lab look) on circuit / probs / bloch. Rebuild plugin then `ext add` so view loads the new native lib.

`steps` =

| step | gate | qubits |
|------|------|--------|
| 1 | H | 0 |
| 2 | CX | 0,1 |
| 3 | CX | 0,2 |

We first **qc = [Compute qc](quantum.circuit(qubits=3, steps=`steps`))** for the next step.
We first **p = [Compute p](> `qc`.probabilities)** for the next step.
We first **_ = [Compute _](> `qc`.draw kind="probs" theme="dark")** for the next step.
We first **H = [Compute H](gate.gate(name="H"))** for the next step.
We first **__ = [Compute __](> `H`.draw kind="matrix")** for the next step.

We now **[Display this step's result](> print text=`p`)**.
We now **[Display this step's result](> print text="quantum-feature-ok")**.

Variable