computingvista-qservice
Python SDK chính thức của Computing Vista — submit OpenQASM từ Jupyter/VS Code local, chạy trên Computing Vista Cloud.
Cài đặt
pip install computingvista-qservice
Hoặc từ local clone (dev):
pip install -e .
Sử dụng
Lấy API key tại computingvista.com/dashboard/developer.
from computingvista_qservice import QuantumClient
qc = QuantumClient(token="qkey_live_...") # hoặc set env QUANTUM_SERVICE_TOKEN
print(qc.get_usage())
# {'used_shots': 2000, 'max_shots': 100000, 'remaining_shots': 98000}
result = qc.run_qasm("""
OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];
h q[0];
cx q[0],q[1];
measure q -> c;
""", shots=1000)
print(result["counts"])
run_qasm raise QuotaExceededError khi vượt hạn mức trial, QuantumServiceError cho lỗi khác.
Tham số QAOA pretrained (v0.2.0)
get_qaoa_params trả về góc (γ, β) đã pretrain cho MaxCut — không cần chạy optimizer:
import networkx as nx
from computingvista_qservice import get_qaoa_params
G = nx.random_regular_graph(3, 12) # đồ thị MaxCut (hỗ trợ attribute "weight" trên cạnh)
gamma, beta, confidence = get_qaoa_params(G, p=3, family="maxcut")
Không có networkx thì truyền list cạnh [(i, j), ...] hoặc [(i, j, weight), ...] — networkx không phải dependency của SDK.
confidence="high"— dùng one-shot luôn (gap đo được ~0.1–2 điểm % so với góc tối ưu)"medium"— nên tinh chỉnh nhẹ (ví dụ quét 7 điểm hệ số nhân trên γ, ~vài trăm shots)"low"— chỉ là điểm khởi tạo, cần optimizer đầy đủ
Nguồn: bảng fixed-angle cho đồ thị d-regular (Wurtz-Lykov, arXiv:2107.00677), median 261k đồ thị 9 đỉnh (QAOAKit) + rescale theo bậc/trọng số (arXiv:2201.11785), nội suy schedule cho p>3. Convention ghi trong docstring của module — kiểm tra bằng tests/test_qaoa.py (cần numpy, networkx).
Mã lỗi
QuantumServiceError mang theo error từ response:
error |
HTTP | Ý nghĩa |
|---|---|---|
invalid_or_missing_token |
401 | Thiếu hoặc sai API token |
invalid_request |
400 | Body thiếu qasm hoặc shots không hợp lệ |
invalid_qasm |
400 | Không phải OpenQASM 2.x hợp lệ (cần header OPENQASM 2.x; và ít nhất 1 qreg) |
too_many_qubits |
400 | Vượt giới hạn qubit của free tier |
too_many_gates |
400 | Vượt giới hạn số cổng của free tier |
quota_exceeded |
429 | Vượt hạn mức shot của trial (QuotaExceededError) |
execution_error |
502 | Backend chạy circuit thất bại |
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 computingvista_qservice-0.2.0.tar.gz.
File metadata
- Download URL: computingvista_qservice-0.2.0.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2160b86805049bfa3542d7d2f1c9db780c7e3000dcaf691ae85d025e2071ae6
|
|
| MD5 |
9247f0075448791ee88f0beb69c7fce1
|
|
| BLAKE2b-256 |
42dbbe35d5d19e3f15b7a5eb1513d59f7e848b8a985c79fb6f0be72d712234a2
|
File details
Details for the file computingvista_qservice-0.2.0-py3-none-any.whl.
File metadata
- Download URL: computingvista_qservice-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab10874d36673d0a43ea37adb6997de8aff84da538f03ead64fb81f0ba226a5b
|
|
| MD5 |
5fcf54d0ed1adcfe60041eb0c9393903
|
|
| BLAKE2b-256 |
284680971a03687baedf70e44ee137b3a664c84b70acd65ea8be6ebeb6aa5caf
|