Kahsolt / Adiabatic-Linear-Solver-QPanda

Block Encodings & Quantum Discrete Adiabatic Linear-systems Solver implemented in QPanda (C++)

Repository from Github https://github.comKahsolt/Adiabatic-Linear-Solver-QPandaRepository from Github https://github.comKahsolt/Adiabatic-Linear-Solver-QPanda

Adiabatic-Linear-Solver-QPanda

Block Encodings & Quantum Discrete Adiabatic Linear-systems Solver implemented in QPanda (C++)
第三届CCF“司南杯”量子计算编程挑战赛-通用赛道 决赛

比赛页面: 第三届CCF“司南杯”量子计算编程挑战赛通用赛道 队名: 我吃两个
得分: 85.67 (复赛) / 81.67 (答辩)
获奖: 三等奖 (wtf???

👉 初赛的 repo 在这里:CCF-3rd-Pilot-Cup-first-stage

Quickstart

  • git clone https://github.com/Kahsolt/QLSDA-QPanda
    • add --recursive if you want QPanda as well
  • install the C++ version QPanda, building from source... 😈
    • modify QPANDA_INSTALL_DIR in CMakeLists.txt according to your installation
  • just run make or bash ./run.sh 😀🎉

This is the demo run for final linear solver solution:

demo

ℹ Note that there are two folders containing source files:

  • /playground: pennylane tutorials, pure numerical simulations for quick idea verification, debugging scipts
  • /src: the real quantum logical circuit implementation in QPanda (C++) and PyQPanda (python)

Implementation

⚪ block encoding

👉 详细文档参见 BlockEncoding.md
😈 BlockEncoding 可能是一个非常危险的突破性技术:以后人们只是基于线性代数去设计算法,然后调用 block_encode + matrix_decompose 来在量子计算机上运行一切程序

Method restriction gate implementation sub-normalizer ancilla qubits complex-value support
QSVT-like $ σ_{max} = ||A||_2 \leq 1 $ use matrix_decompose methods (cannot generally implement with $ \mathcal{O}(poly(n)) $ gates) - 1
LCU $ A = \sum\limits_{k=0}^{N-1} \alpha_k U_k $ $ U_A = \mathrm{PREP}^\dagger \cdot \mathrm{SEL} \cdot \mathrm{PREP} $ $ 1 / \sum_k |\alpha_k| $ $ \lceil log_2(k) \rceil $
ARCSIN $ d $-sparse $, |a_{ij}| \le 1 $ $ U_A = (I_1 \otimes H^{\otimes n} \otimes I_n) (I_1 \otimes \mathrm{SWAP}) O_A (X \otimes H^{\otimes n} \otimes I_n) $ $ 1 / 2^n $ $ n + 1 $
FABLE $ d $-sparse $, |a_{ij}| \le 1 $ $ U_A = (I_1 \otimes H^{\otimes n} \otimes I_n) (I_1 \otimes \mathrm{SWAP}) O_A (I_1 \otimes H^{\otimes n} \otimes I_n) $ $ 1 / 2^n $ $ n + 1 $
Precision Check Generated Circuit
demo demo

⚪ adiabatic-inspired linear system solver

👉 详细文档参见 LinearSolver.md

Method year sched func $ f(s) $ time complexity query complexity (EF paper listed) query complexity (QDA paper listed)
RM (algo-1) 2018 $ \text{v-func} $ $ \mathcal{O}(\kappa^2 \mathrm{log}(\kappa) / \epsilon) $ $ \mathcal{O}(\kappa / \epsilon) $
RM (algo-2) 2018 $ \text{v-func} $ $ \mathcal{O}(\kappa \mathrm{log}(\kappa) / \epsilon) $ $ \mathcal{O}(\kappa / \epsilon) $ $ \mathcal{O}(\kappa \mathrm{log}(\kappa) / \epsilon) $
vanilla AQC 2019 $ \text{linear} $ $ \mathcal{O}(\kappa^3 / \epsilon) $ $ \mathcal{O}(\kappa^2 / \epsilon) $
AQC(P) 2019 $ \text{poly} $ $ \mathcal{O}(\kappa / \epsilon) \sim \mathcal{O}(\kappa \mathrm{log}(\kappa) / \epsilon) $ $ \mathcal{O}(\kappa \mathrm{log}(\kappa) \mathrm{loglog}(\kappa)) $ for $ \mathcal{O}(1) $ precision
AQC(EXP) 2019 $ \text{exp} $ $ \mathcal{O}(\kappa \mathrm{log}^2(\kappa) \mathrm{log}^4(\mathrm{log}(\kappa)/\epsilon)) $ $ \mathcal{O}(\kappa \mathrm{polylog}(1 / \epsilon)) $ $ \mathcal{O}(\kappa \mathrm{polylog}(\kappa / \epsilon)) $
EF (partial) 2019 $ \text{poly} $ $ \mathcal{O}(\kappa \mathrm{log}(1 / \epsilon)) $ $ \mathcal{O}(\kappa \mathrm{log}(\kappa / \epsilon)) $
QDA (partial) 2021 $ \text{poly} $ $ \mathcal{O}(\kappa \mathrm{log}(1 / \epsilon)) $
EQLS (partial) 2023 $ \text{v-func} $ $ \mathcal{O}(\kappa \mathrm{log}(\kappa / \epsilon)) $

ℹ Note that $ \mathcal{\Omega}(\kappa \mathrm{log}(1 / \epsilon)) $ is the theoretical lower bound for sparse QLSP

Obviously there is an argument between QDA and EF, that EF overlooked a factor by $ \mathrm{log}(k) $? 🤔

  • EF := AQC(P) + EF = $ \mathcal{O}(\kappa \mathrm{log}(\kappa) \mathrm{loglog}(\kappa)) + \mathcal{O}(\kappa \mathrm{log}(1 / \epsilon)) $
  • QDA := QWalk + EF = $ \mathcal{O}(\kappa) + \mathcal{O}(\kappa \mathrm{log}(1 / \epsilon)) $
  • EQLS: = RM + EF OK then, QDA might be right: EF forgot to count for its AQC(p) part

references


by Armit 2024/05/13

About

Block Encodings & Quantum Discrete Adiabatic Linear-systems Solver implemented in QPanda (C++)

License:MIT License


Languages

Language:Python 73.6%Language:C++ 22.9%Language:CMake 3.2%Language:Shell 0.3%Language:Makefile 0.0%