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]>
1.3 KiB
1.3 KiB
真实的设备会把每个门都做得略有偏差。一种常用的模型是去极化(depolarizing)噪声:门以概率 p 跟随一个随机错误(在它作用的每个量子比特上作用 X、Y 或 Z),以概率 1 − p 精确执行。双比特门通常比单比特门差好几倍,测量也有它自己的读出(readout)错误。
有了噪声,程序的状态就不再是一个向量,而是一个密度矩阵,即每种错误模式所留下状态的混合。引擎精确地演化它:噪声下的分布意图仍然由证明判定,比较的对象是噪声真实给出的分布。这道练习的作业(job)带有噪声,所以检查会像设备那样运行你的程序。
用数字说话:门越少,尤其是双比特门越少,有噪声的运行就越接近理想情形。评析的数字(wai-quantum critique)会统计这两种门,它的模型化保真度是每个门的存活率的乘积。
cat > pair.qasm <<'QASM'
OPENQASM 3.0;
include "stdgates.inc";
qubit[2] q;
bit[2] c;
h q[0];
cx q[0], q[1];
c = measure q;
QASM
wai-quantum run pair.qasm --noise depolarizing_2q=0.03 --noise readout=0.02 --shots 2000 --seed 3