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

API Reference

◐ Design-level API
This page documents qalgora-Q API design, architecture, or adaptation workflows. Code examples illustrate intended usage and are not guaranteed to run in the current reference implementation.

Core entry points of the qalgora-Q Python API. C++ mirrors these in the qalgora:: namespace.

This page is the at-a-glance index. For depth, see Python API, C++ API, and the Quantum Operations Reference.

Reference-build status
The Status column reflects the open reference build: Supported = runs today on the local CPU NumPy simulator; Spec API = documented specification interface, not implemented in the open build yet; Planned = a distribution or hardware path not released yet. The gpu and tensornet targets are Planned. See Capability Coverage for the full matrix.

Execution

FunctionPurposeStatus
qalgora.sample(kernel, *args, shots_count=1000)Sample measurement bitstringsSupported
qalgora.run(kernel, *args)List of typed kernel return valuesSpec API
qalgora.observe(kernel, spin_op, *args)Compute expectation valuesSupported
qalgora.get_state(kernel, *args)Return the full statevectorSupported
*_async(...)Non-blocking variant of each primitive, returns a futureSupported (sample/observe/evolve)
qalgora.vqe(...)Run a variational eigensolver loopSpec API
qalgora.evolve(...)Time-evolve a system (dynamics)Supported
qalgora.draw / get_ir / estimate_resourcesVisualize / inspect / cost a kernelSpec API

Targets & configuration

FunctionPurposeStatus
qalgora.set_target(name, **opts)Choose the execution backendSupported
qalgora.get_target() / get_targets()Query the active / available targetsSupported
qalgora.reset_target()Restore the default targetSupported
qalgora.set_noise() / unset_noise()Attach / clear a global noise modelSupported
qalgora.set_random_seed(n)Make sampling reproducibleSupported
qalgora.num_available_gpus()Count usable GPUsPlanned

Submodules

ModuleContentsStatus
qalgora.optimizers / qalgora.gradientsVariational optimizationSpec API
qalgora.spin / qalgora.operatorsBuild Hamiltonians and observablesSupported
qalgora.mpiDistributed execution primitivesSpec API
qalgora.dynamicsTime-evolution integratorsSupported

Operators

from qalgora import spin
op = spin.x(0) * spin.z(1) + 0.5 * spin.y(0)
print(op)               # human-readable Pauli sum
print(op.get_qubit_count())

API 参考

◐ 设计接口
本页描述的是 qalgora-Q 的接口设计、架构设计或适配工作流。相关代码用于说明预期用法,当前参考实现不保证可以直接运行。

qalgora-Q Python API 的核心入口。C++ 侧的对应接口位于 qalgora:: 命名空间下。

本页为速查索引。如需详细说明,请参阅Python APIC++ API量子操作参考

参考实现状态
状态列反映开放参考实现的现状:参考实现已支持表示当前可在本地 CPU NumPy 模拟器上运行;规范接口·暂未实现表示已写入规范、开放实现暂未提供;规划中·尚未发布表示分发或硬件路径尚未发布。其中 gputensornet 目标后端属于规划中·尚未发布。完整对照见能力覆盖

执行

函数用途状态
qalgora.sample(kernel, *args, shots_count=1000)对测量比特串进行采样参考实现已支持
qalgora.run(kernel, *args)返回内核带类型的返回值列表规范接口·暂未实现
qalgora.observe(kernel, spin_op, *args)计算期望值参考实现已支持
qalgora.get_state(kernel, *args)返回完整态矢量参考实现已支持
*_async(...)各原语的非阻塞变体,返回 future(异步句柄)参考实现已支持(sample/observe/evolve)
qalgora.vqe(...)运行变分本征求解器循环规范接口·暂未实现
qalgora.evolve(...)对系统进行时间演化(动力学模拟)参考实现已支持
qalgora.draw / get_ir / estimate_resources可视化 / 检查 / 估算内核资源开销规范接口·暂未实现

目标后端与配置

函数用途状态
qalgora.set_target(name, **opts)选择执行后端参考实现已支持
qalgora.get_target() / get_targets()查询当前激活的后端 / 所有可用后端参考实现已支持
qalgora.reset_target()恢复默认目标后端参考实现已支持
qalgora.set_noise() / unset_noise()挂载 / 清除全局噪声模型参考实现已支持
qalgora.set_random_seed(n)固定随机种子以使采样可复现参考实现已支持
qalgora.num_available_gpus()统计可用 GPU 数量规划中·尚未发布

子模块

模块内容状态
qalgora.optimizers / qalgora.gradients变分优化规范接口·暂未实现
qalgora.spin / qalgora.operators构建哈密顿量与可观测量参考实现已支持
qalgora.mpi分布式执行原语规范接口·暂未实现
qalgora.dynamics时间演化积分器参考实现已支持

算符

from qalgora import spin
op = spin.x(0) * spin.z(1) + 0.5 * spin.y(0)
print(op)               # human-readable Pauli sum
print(op.get_qubit_count())