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

Adapting Platform Algorithms

◐ 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.

qalgora-Q plans to provide interop adapters for Qiskit, Cirq, Braket, PennyLane, pyQPanda, OpenQASM, Stim, and OpenFermion. The current open reference implementation does not yet bundle these adapters; this section shows the expected interfaces and migration approach.

Adapter map

FromImportExport
IBM Qiskitfrom_qiskit()to_qiskit()
Google Cirqfrom_cirq()to_cirq()
Amazon Braketfrom_braket()to_braket()
PennyLaneqalgora.qnodeto_pennylane()
Origin pyQPandafrom_qpanda()to_qpanda()
OpenQASM 3from_qasm()to_qasm()

All adapters above are planned interfaces; the open reference implementation does not yet bundle them.

The common pattern

The from_*/to_* adapters below are planned interfaces; the open reference implementation does not yet include them. The part that runs today is selecting a local target and sampling native qalgora-Q kernels.

import qalgora

qalgora.set_target("qpp-cpu")
# optional: requires the qalgora-gpu plugin (planned)
# qalgora.set_target("gpu")

# Planned adapter workflow:
# kernel = qalgora.from_qiskit(qiskit_circuit)
# print(qalgora.sample(kernel, shots_count=1000))

# or hand a qalgora-Q kernel back to another framework (planned adapter):
# qiskit_circuit = qalgora.to_qiskit(my_kernel)
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.
Why adapt, not rewrite
Adapters aim to reduce the work of re-building circuits and operators, not to guarantee that every program migrates losslessly. Complex control flow, pulse-level control, noise models, dynamic circuits, vendor-proprietary gates, and photonic tasks usually need manual review or rewriting.

跨平台算法适配

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

qalgora-Q 规划提供与 Qiskit、Cirq、Braket、PennyLane、pyQPanda、OpenQASM、Stim、OpenFermion 等的互操作适配器。当前开放参考实现尚未内置这些适配器;本节展示的是预期接口和迁移思路。

适配器一览

来源导入导出
IBM Qiskitfrom_qiskit()to_qiskit()
Google Cirqfrom_cirq()to_cirq()
Amazon Braketfrom_braket()to_braket()
PennyLaneqalgora.qnodeto_pennylane()
Origin pyQPandafrom_qpanda()to_qpanda()
OpenQASM 3from_qasm()to_qasm()

上述适配器均为规划接口,开放参考实现暂未内置。

通用模式

下方的 from_*/to_* 适配器为规划接口,开放参考实现暂未内置。当前可运行的部分是选择本地目标并对原生 qalgora-Q 内核采样。

import qalgora

qalgora.set_target("qpp-cpu")
# 可选:需安装 qalgora-gpu 插件(规划中)
# qalgora.set_target("gpu")

# 规划中的适配器工作流:
# kernel = qalgora.from_qiskit(qiskit_circuit)
# print(qalgora.sample(kernel, shots_count=1000))

# 或将 qalgora-Q 内核交回其他框架(规划中的适配器):
# qiskit_circuit = qalgora.to_qiskit(my_kernel)
规范接口 · 参考实现暂未包含
此示例展示的是 qalgora-Q 规范中的接口(或第三方库),开放参考实现目前尚未内置,仅用于说明预期用法;如需立即运行,请使用参考实现已支持的核心 API。
为何适配而非重写
适配器的目标是减少重复搭建电路和算符的工作,而不是保证所有程序无损迁移。复杂控制流、脉冲级控制、噪声模型、动态线路、厂商专有门和光量子任务通常需要人工检查或重写。