qalgora-Q Docs Hub量子文档 ✦ Ask AI✦ 问问文档

Pre-Trajectory Sampling with Batch Execution (规划中 · 暂不可运行)

○ Planned · Not yet implemented
The capabilities described on this page are planned and not yet implemented or released. They explain future design directions and should not be interpreted as delivered features.

PTSBE is a planned acceleration interface for noisy simulation: it pre-selects which noise trajectories to run and batches them, instead of sampling noise independently for every shot. The open reference implementation does not bundle it yet.

When to use PTSBE

  • Many shots through the same noisy circuit.
  • Noise dominated by a few likely error trajectories.
  • GPU targets where batching amortizes kernel launches.
规划中 · 暂不可运行 — planned, not runnable yet
qalgora.ptsbe is a planned interface; the open reference build does not ship it, so the snippet below documents the intended call and its outputs only — it will not run today.

Running PTSBE sampling

import qalgora
import qalgora.ptsbe as ptsbe

result = ptsbe.sample(
    noisy_kernel,
    noise_model=noise,
    shots_count=100000,
    num_trajectories=256,            # pre-selected trajectories
    strategy="weighted",            # sample trajectories by probability
)
print(result)                        # planned SampleResult summary
print(result.execution_data())       # per-trajectory diagnostics
Specification API — not in the open reference build yet
This example shows a qalgora-Q specification API (or a third-party library) that the open reference build does not bundle today. It documents the intended interface; to run code now, use the reference build’s supported core API.
Trajectory budget
Truncating trajectories by probability without re-weighting them correctly biases the estimate systematically; under unbiased importance sampling, too few trajectories show up mainly as excess variance, not bias. Inspect the execution data to confirm the chosen trajectories cover the bulk of the probability mass.

预选轨迹批量执行采样 (规划中 · 暂不可运行)

○ 规划中
本页所述能力属于规划功能,当前尚未发布或尚未实现。相关内容仅用于说明未来设计方向,不应理解为已交付能力。

PTSBE 是一套规划中的含噪模拟加速接口:通过预选噪声轨迹并成批执行来给含噪模拟提速,而不是每采一次样都单独抽一遍噪声。开放参考实现暂未内置该能力。

何时使用 PTSBE

  • 同一含噪电路需要大量采样次数。
  • 噪声主要由少数高概率误差轨迹主导。
  • 在 GPU 后端上,成批执行能摊薄内核启动开销。
规划中 · 暂不可运行
qalgora.ptsbe 属于规划中的接口,开放参考实现尚未内置;下面的片段仅用于说明预期的调用方式与输出,当前无法运行。

运行 PTSBE 采样

import qalgora
import qalgora.ptsbe as ptsbe

result = ptsbe.sample(
    noisy_kernel,
    noise_model=noise,
    shots_count=100000,
    num_trajectories=256,            # pre-selected trajectories
    strategy="weighted",            # sample trajectories by probability
)
print(result)                        # 规划中的 SampleResult 摘要
print(result.execution_data())       # per-trajectory diagnostics
规范接口 · 参考实现暂未包含
此示例展示的是 qalgora-Q 规范中的接口(或第三方库),开放参考实现目前尚未内置,仅用于说明预期用法;如需立即运行,请使用参考实现已支持的核心 API。
轨迹预算
若轨迹按概率截断且未正确重加权会产生系统偏差;在无偏重要性采样下,轨迹太少主要表现为方差过大,而非偏差。可查看执行数据,确认选出的轨迹覆盖了大部分概率质量。