QVecOpt Provider 是一个用于集成 Qiskit 与 QVecOpt 后端的 Python 包
Project description
QVecOpt Provider
QVecOpt Provider 是一个用于集成 Qiskit 与 QVecOpt 后端的 Python 包。它允许用户通过 Qiskit 风格的接口,将量子电路提交到 QVecOpt 后端进行编译与仿真。
主要特性
- 提供 Qiskit 兼容的 Provider/Backend 接口
- 支持量子电路的编译(transpile)与运行(run)
- 支持获取量子电路的计数结果和状态向量
目录结构
qvecopt_provider/
__init__.py
backend.py
job.py
provider.py
result.py
LICENSE
README.md
requirements.txt
安装依赖
pip install -r requirements.txt
使用方法
以下为典型用法:
from qiskit import QuantumCircuit
from qvecopt_provider import QVecOptProvider
num_qubits = 29
provider = QVecOptProvider(url="http://<your-qvecopt-server>:8080", max_qubits=27)
backend = provider.get_backend("QVecOpt")
qc = QuantumCircuit(num_qubits, num_qubits)
qc.h(0)
qc.cx(0, 1)
qc.cx(1, 2)
compiled_circuit = backend.transpile(qc)
# 运行电路,initial_state为初始态,wipedisk为是否在计算前清空存储量子态的所有存储器
job = backend.run(compiled_circuit, initial_state=8192, wipedisk=True)
result = job.result()
# 获取计数结果
print(result.get_counts())
# 获取状态向量
statevector = result.get_statevector()
主要模块说明
provider.py:实现 Qiskit Provider 接口,负责后端管理backend.py:实现 Qiskit Backend 接口,负责电路编译与运行job.py:实现 Job 对象,负责任务提交与结果获取result.py:实现 Result 对象,负责封装计算结果
依赖
- qiskit
- requests
备注
- 请确保 QVecOpt 服务端已启动并可访问。
initial_state参数和wipedisk参数请根据实际需求调整。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qvecopt_provider-0.2.2.tar.gz.
File metadata
- Download URL: qvecopt_provider-0.2.2.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e760b9c124c8e1e988cb590bfc50631bbd1134f603f8fa80464741e4967cb377
|
|
| MD5 |
2f3144a6f4606d680c9893d952ae3971
|
|
| BLAKE2b-256 |
5901a4e6cb502e13d4560db4d51d83d25bb5cb76a1d1558af306d3e30f27ae5f
|
File details
Details for the file qvecopt_provider-0.2.2-py3-none-any.whl.
File metadata
- Download URL: qvecopt_provider-0.2.2-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97bda5ff7acc7eb4f7c1913900bf2479989000816d19e55291f2c82b734fd225
|
|
| MD5 |
226e4a6b661a72dcad6c25f7b27cbaa6
|
|
| BLAKE2b-256 |
e62713d5819e73735b44538191f4464139f8ba077fcd76ebeb85d3a70b7e24e7
|