Developing robust and high performance quantum software is challenging due to the dynamic nature of existing Python-based frameworks, which often suffer from runtime errors and scalability bottlenecks. In this work, we present LogosQ, a high performance backend agnostic quantum computing library implemented in Rust that enforces correctness through compile time type safety. Unlike existing tools, LogosQ leverages Rust static analysis to eliminate entire classes of runtime errors, particularly in parameter-shift rule gradient computations for variational algorithms. We introduce novel optimization techniques, including direct state-vector manipulation, adaptive parallel processing, and an FFT optimized Quantum Fourier Transform, which collectively deliver speedups of up to 900 times for state preparation (QFT) and 2 to 5 times for variational workloads over Python frameworks (PennyLane, Qiskit), 6 to 22 times over Julia implementations (Yao), and competitive performance with Q sharp. Beyond performance, we validate numerical stability through variational quantum eigensolver (VQE) experiments on molecular hydrogen and XYZ Heisenberg models, achieving chemical accuracy even in edge cases where other libraries fail. By combining the safety of systems programming with advanced circuit optimization, LogosQ establishes a new standard for reliable and efficient quantum simulation.
翻译:开发稳健且高性能的量子软件具有挑战性,这主要源于现有基于 Python 的框架的动态特性,这些框架常受运行时错误和可扩展性瓶颈的困扰。本文中,我们提出了 LogosQ,一个用 Rust 实现的高性能、后端无关的量子计算库,它通过编译时类型安全来强制保证正确性。与现有工具不同,LogosQ 利用 Rust 的静态分析来消除整类运行时错误,特别是在变分算法的参数平移规则梯度计算中。我们引入了新颖的优化技术,包括直接态矢操作、自适应并行处理以及 FFT 优化的量子傅里叶变换。这些技术共同实现了高达 900 倍的状态制备(QFT)加速,变分工作负载相比 Python 框架(PennyLane, Qiskit)快 2 至 5 倍,相比 Julia 实现(Yao)快 6 至 22 倍,并与 Q# 性能相当。除了性能之外,我们通过在氢分子和 XYZ 海森堡模型上的变分量子本征求解器实验验证了数值稳定性,即使在其它库会失效的边缘情况下也能达到化学精度。通过将系统编程的安全性与高级电路优化相结合,LogosQ 为可靠高效的量子模拟树立了新标准。