qalgora-QX · Solvers Library
○ 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.The Solvers library packages ready-made hybrid algorithms — VQE, ADAPT-VQE, QAOA, and gradient routines — so you call a high-level solver instead of wiring the loop by hand.
Planned extension library
qalgora-QX is a planned extension library; qalgora-solvers is not yet published to PyPI and cannot be installed today; the APIs below are planned interfaces.Installation
# python3 -m pip install qalgora-solvers # planned — not yet installable
Ground-state energy with ADAPT-VQE
import qalgora
import qalgora_solvers as solvers
from qalgora import spin
# molecular Hamiltonian (e.g. from a chemistry frontend)
hamiltonian = spin.z(0) + spin.z(1) - 0.5 * spin.x(0) * spin.x(1)
# operator pool the solver draws from to grow the ansatz
pool = solvers.get_operator_pool("spin_complement", num_qubits=2)
energy, params, ops = solvers.adapt_vqe(
hamiltonian, pool,
optimizer=solvers.optimizers.LBFGS(),
gradient="parameter_shift",
)
print("ground-state energy:", energy)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.Fixed-ansatz VQE
import qalgora_solvers as solvers
# molecule -> spin Hamiltonian + a UCCSD ansatz, in one call
h, data = solvers.create_molecule(geometry, basis="sto-3g")
energy, params = solvers.vqe(h, solvers.uccsd, data.num_qubits,
optimizer=solvers.optimizers.LBFGS())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.Generative eigensolver (GQE)
Instead of optimising parameters of a fixed ansatz, the Generative Quantum Eigensolver trains a transformer to generate low-energy circuits from an operator pool — a gradient-free, sampling-based alternative to VQE for hard energy landscapes.
Experimental
GQE is an experimental research interface; its performance depends on the training data, operator pool, model size, and sampling budget, and it is not guaranteed to beat VQE.import qalgora_solvers as solvers
energy, circuit = solvers.gqe(
hamiltonian, pool,
model=solvers.gqe.Transformer(layers=4),
iterations=200,
)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.Operator pools
ADAPT-VQE grows its ansatz from a pool. Choose a pool that matches your problem's symmetry.
| Pool | For |
|---|---|
"uccsd" | Molecular chemistry (single + double excitations) |
"spin_complement" | Spin-symmetric systems |
"qaoa" | Combinatorial / Max-Cut style problems |
What's included
| Solver | Use case |
|---|---|
vqe | Fixed-ansatz variational eigensolver |
adapt_vqe | Adaptively grows the ansatz from an operator pool |
gqe | Transformer-based generative eigensolver |
qaoa | Combinatorial optimization layers |
get_operator_pool | Build a pool for ADAPT methods |
create_molecule | Geometry → qubit Hamiltonian + metadata |
optimizers / gradients | COBYLA, L-BFGS, Adam, parameter-shift… |
High level
Solvers wraps the optimizer loop and
operator construction so you express the science, not the plumbing.
qalgora-QX · 求解器库
○ 规划中
本页所述能力属于规划功能,当前尚未发布或尚未实现。相关内容仅用于说明未来设计方向,不应理解为已交付能力。求解器库把一批混合算法——VQE、ADAPT-VQE、QAOA 以及梯度计算例程——打包成开箱即用的高层接口,直接调用即可,不必自己手搭迭代循环。
规划中的扩展库
qalgora-QX 属于规划中的扩展库;qalgora-solvers 尚未发布到 PyPI,当前不可安装;以下 API 为规划接口。安装
# python3 -m pip install qalgora-solvers # 规划中,暂不可安装
使用 ADAPT-VQE 求基态能量
import qalgora
import qalgora_solvers as solvers
from qalgora import spin
# molecular Hamiltonian (e.g. from a chemistry frontend)
hamiltonian = spin.z(0) + spin.z(1) - 0.5 * spin.x(0) * spin.x(1)
# operator pool the solver draws from to grow the ansatz
pool = solvers.get_operator_pool("spin_complement", num_qubits=2)
energy, params, ops = solvers.adapt_vqe(
hamiltonian, pool,
optimizer=solvers.optimizers.LBFGS(),
gradient="parameter_shift",
)
print("ground-state energy:", energy)规范接口 · 参考实现暂未包含
此示例展示的是 qalgora-Q 规范中的接口(或第三方库),开放参考实现目前尚未内置,仅用于说明预期用法;如需立即运行,请使用参考实现已支持的核心 API。固定拟设 VQE
import qalgora_solvers as solvers
# molecule -> spin Hamiltonian + a UCCSD ansatz, in one call
h, data = solvers.create_molecule(geometry, basis="sto-3g")
energy, params = solvers.vqe(h, solvers.uccsd, data.num_qubits,
optimizer=solvers.optimizers.LBFGS())规范接口 · 参考实现暂未包含
此示例展示的是 qalgora-Q 规范中的接口(或第三方库),开放参考实现目前尚未内置,仅用于说明预期用法;如需立即运行,请使用参考实现已支持的核心 API。生成式本征求解器 GQE
它不去优化固定拟设里的参数,而是训练一个 transformer 直接从算符池生成低能线路。生成式量子本征求解器无需梯度、基于采样,是 VQE 在崎岖能量面上的一条替代路线。
实验性
GQE 属于实验性研究接口,性能依赖训练数据、算符池、模型大小和采样预算,不保证优于 VQE。import qalgora_solvers as solvers
energy, circuit = solvers.gqe(
hamiltonian, pool,
model=solvers.gqe.Transformer(layers=4),
iterations=200,
)规范接口 · 参考实现暂未包含
此示例展示的是 qalgora-Q 规范中的接口(或第三方库),开放参考实现目前尚未内置,仅用于说明预期用法;如需立即运行,请使用参考实现已支持的核心 API。算符池
ADAPT-VQE 会从算符池里逐步扩展线路拟设,请按问题本身的对称性挑选合适的算符池。
| 算符池 | 适用场景 |
|---|---|
"uccsd" | 分子化学(单激发与双激发) |
"spin_complement" | 自旋对称系统 |
"qaoa" | 组合优化 / Max-Cut 类问题 |
内置组件
| 求解器 | 适用场景 |
|---|---|
vqe | 固定线路拟设的变分本征求解器 |
adapt_vqe | 从算符池中自适应扩展线路拟设 |
gqe | 基于 transformer 的生成式本征求解器 |
qaoa | 组合优化分层电路 |
get_operator_pool | 为 ADAPT 方法构建算符池 |
create_molecule | 分子几何结构 → 量子比特哈密顿量及元数据 |
optimizers / gradients | COBYLA、L-BFGS、Adam、参数移位…… |