engine::course reads the course from wai-quantum/course/: 21 lessons from a first circuit through superposition, entanglement, interference, the standard algorithms, noise and mitigation, error correction and fault tolerance to resource estimates, each a Markdown text in English and Simplified Chinese and an exercise.json with a schema. A check runs each case of an exercise (a generator's inputs) with its intent and the verdict, measures its constraints (the gates allowed, counts, the T count, the critique's smells, the resource estimate's counts), and says what went wrong from the diagnostics, the verdict and the critique, never from the solution. The tests hold every solution to pass by proof, every known wrong answer to fail for its stated reason, and every locale to every text and message. wai-quantum learn shows, starts, checks, hints and explains a lesson, keeps progress only on this machine, and speaks the language --lang or LANG names; the command summaries and docs topics have Chinese translations held to the English they came from. The verdict gains of_diagnostic for a generator's refusal. llms.txt names the course. Co-Authored-By: Claude Opus 5.5 <[email protected]>
18 lines
740 B
Markdown
18 lines
740 B
Markdown
<!-- 机器辅助翻译(machine-assisted translation):在对外推广之前,须由熟练的读者审校。 -->
|
||
|
||
一组比特寄存器按二进制数来读,**最高位在前**。对于 `bit[2] c;`,结果 `01` 表示 `c[1] = 0`、`c[0] = 1`。
|
||
|
||
`c = measure q;` 把 `q` 中的每个量子比特测量到 `c` 中下标相同的比特:`q[0]` 到 `c[0]`,`q[1]` 到 `c[1]`。也可以一次测量一个量子比特:
|
||
|
||
```qasm
|
||
OPENQASM 3.0;
|
||
include "stdgates.inc";
|
||
qubit[3] q;
|
||
bit[3] c;
|
||
x q[0];
|
||
c[0] = measure q[0];
|
||
c[1] = measure q[1];
|
||
c[2] = measure q[2];
|
||
```
|
||
|
||
这个程序翻转了 `q[0]`,所以它的结果是 `001`。引擎给出的每个结果,无论是计数还是分布,都使用这个顺序,练习也是如此。
|