Qiskit Interop
◐ 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.Run IBM Qiskit circuits and algorithms on qalgora-Q backends, and export qalgora-Q kernels back to Qiskit primitives.
Importing a Qiskit circuit
import qalgora
from qiskit import QuantumCircuit
qc = QuantumCircuit(2)
qc.h(0); qc.cx(0, 1); qc.measure_all()
qalgora.set_target("qpp-cpu")
# Planned adapter:
# kernel = qalgora.from_qiskit(qc) # -> a qalgora-Q kernel
# print(qalgora.sample(kernel, shots_count=1000))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.Adapting Qiskit primitives
Qiskit algorithms are built on the Sampler and Estimator primitives.
qalgora-Q adapters plan to provide Sampler / Estimator interfaces compatible with Qiskit primitives;
the exact class names and signatures depend on the supported Qiskit version (for example, primitives
V2 may need different wrappers). These are planned interfaces, not part of the current core API:
# Planned adapter (not in the open reference implementation yet):
# from qalgora.qiskit import QalgoraSampler, QalgoraEstimator
#
# sampler = QalgoraSampler(target="qpp-cpu") # swap in for qiskit's Sampler
# estimator = QalgoraEstimator(target="qpp-cpu")
# # optional: requires the qalgora-gpu plugin (planned)
# # sampler = QalgoraSampler(target="gpu")
# # feed these to qiskit_algorithms.VQE / QAOASpecification 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.VQE / QAOA
Where the primitive interface is compatible, existing qiskit_algorithms workflows can
be wired in with small changes; zero-change reuse is not guaranteed. Check observable types,
parameter binding, shots, gradients, and callbacks, and budget for translation to the target gate
set and coupling map before running on hardware.
Qiskit 互操作
◐ 设计接口
本页描述的是 qalgora-Q 的接口设计、架构设计或适配工作流。相关代码用于说明预期用法,当前参考实现不保证可以直接运行。在 qalgora-Q 后端运行 IBM Qiskit 电路与算法,并将 qalgora-Q 内核导出为 Qiskit 原语。
导入 Qiskit 电路
import qalgora
from qiskit import QuantumCircuit
qc = QuantumCircuit(2)
qc.h(0); qc.cx(0, 1); qc.measure_all()
qalgora.set_target("qpp-cpu")
# 规划中的适配器:
# kernel = qalgora.from_qiskit(qc) # -> a qalgora-Q kernel
# print(qalgora.sample(kernel, shots_count=1000))规范接口 · 参考实现暂未包含
此示例展示的是 qalgora-Q 规范中的接口(或第三方库),开放参考实现目前尚未内置,仅用于说明预期用法;如需立即运行,请使用参考实现已支持的核心 API。适配 Qiskit 原语
Qiskit 算法基于 Sampler 和 Estimator 原语构建。
qalgora-Q 适配器计划提供与 Qiskit primitives 兼容的 Sampler / Estimator 接口;具体类名和签名随支持的 Qiskit 版本而定(如 primitives V2 可能需要不同封装)。以下为规划接口,并非当前核心 API:
# 规划中的适配器(开放参考实现暂未内置):
# from qalgora.qiskit import QalgoraSampler, QalgoraEstimator
#
# sampler = QalgoraSampler(target="qpp-cpu") # swap in for qiskit's Sampler
# estimator = QalgoraEstimator(target="qpp-cpu")
# # 可选:需安装 qalgora-gpu 插件(规划中)
# # sampler = QalgoraSampler(target="gpu")
# # feed these to qiskit_algorithms.VQE / QAOA规范接口 · 参考实现暂未包含
此示例展示的是 qalgora-Q 规范中的接口(或第三方库),开放参考实现目前尚未内置,仅用于说明预期用法;如需立即运行,请使用参考实现已支持的核心 API。VQE / QAOA
在 primitive 接口兼容的前提下,现有 qiskit_algorithms 工作流可少量改动后接入;不保证零改动,需检查 observable 类型、参数绑定、shots、gradient、callback,上硬件前还要经过目标门集和耦合图转译。