nexqus-sdk 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nexqus_sdk-1.0.0/.github/ISSUE_TEMPLATE/bug_report.yml +21 -0
- nexqus_sdk-1.0.0/.github/workflows/ci.yml +130 -0
- nexqus_sdk-1.0.0/.github/workflows/publish.yml +77 -0
- nexqus_sdk-1.0.0/CHANGELOG.md +53 -0
- nexqus_sdk-1.0.0/CONTRIBUTING.md +32 -0
- nexqus_sdk-1.0.0/LICENSE +21 -0
- nexqus_sdk-1.0.0/MANIFEST.in +15 -0
- nexqus_sdk-1.0.0/PKG-INFO +225 -0
- nexqus_sdk-1.0.0/README.md +189 -0
- nexqus_sdk-1.0.0/SECURITY.md +25 -0
- nexqus_sdk-1.0.0/docs/API.md +216 -0
- nexqus_sdk-1.0.0/docs/API_STABILITY.md +56 -0
- nexqus_sdk-1.0.0/docs/BURMESE_QUICKSTART.md +146 -0
- nexqus_sdk-1.0.0/docs/DYNAMIC_CIRCUITS.md +176 -0
- nexqus_sdk-1.0.0/docs/LEARNING.md +179 -0
- nexqus_sdk-1.0.0/docs/PERFORMANCE.md +123 -0
- nexqus_sdk-1.0.0/docs/RELEASE_NOTES.md +33 -0
- nexqus_sdk-1.0.0/docs/RELEASING.md +72 -0
- nexqus_sdk-1.0.0/examples/batched_noise.py +15 -0
- nexqus_sdk-1.0.0/examples/benchmark.py +27 -0
- nexqus_sdk-1.0.0/examples/benchmark_v2.py +145 -0
- nexqus_sdk-1.0.0/examples/benchmark_v3.py +4 -0
- nexqus_sdk-1.0.0/examples/compiled_circuit.py +9 -0
- nexqus_sdk-1.0.0/examples/custom_function.py +14 -0
- nexqus_sdk-1.0.0/examples/dynamic_trajectories.py +14 -0
- nexqus_sdk-1.0.0/examples/gpu.py +10 -0
- nexqus_sdk-1.0.0/examples/gradients.py +10 -0
- nexqus_sdk-1.0.0/examples/measurement_reset.py +12 -0
- nexqus_sdk-1.0.0/examples/noise_comparison.py +10 -0
- nexqus_sdk-1.0.0/examples/parameter_sweep.py +15 -0
- nexqus_sdk-1.0.0/examples/qft.py +10 -0
- nexqus_sdk-1.0.0/examples/quickstart.py +20 -0
- nexqus_sdk-1.0.0/examples/teleportation.py +22 -0
- nexqus_sdk-1.0.0/examples/train_classifier.py +16 -0
- nexqus_sdk-1.0.0/examples/train_sine.py +35 -0
- nexqus_sdk-1.0.0/examples/validate_gpu.py +35 -0
- nexqus_sdk-1.0.0/examples/validate_noise.py +25 -0
- nexqus_sdk-1.0.0/examples/vqe_two_qubits.py +22 -0
- nexqus_sdk-1.0.0/notebooks/00_start_here.ipynb +76 -0
- nexqus_sdk-1.0.0/notebooks/01_qubits_and_gates.ipynb +84 -0
- nexqus_sdk-1.0.0/notebooks/02_noise_and_methods.ipynb +78 -0
- nexqus_sdk-1.0.0/notebooks/03_functions_sweeps_and_devices.ipynb +78 -0
- nexqus_sdk-1.0.0/notebooks/04_gradients_and_learning.ipynb +78 -0
- nexqus_sdk-1.0.0/notebooks/05_measurement_reset_teleportation.ipynb +86 -0
- nexqus_sdk-1.0.0/notebooks/06_your_first_experiment.ipynb +78 -0
- nexqus_sdk-1.0.0/notebooks/README.md +97 -0
- nexqus_sdk-1.0.0/pyproject.toml +41 -0
- nexqus_sdk-1.0.0/scripts/build_notebooks.py +502 -0
- nexqus_sdk-1.0.0/scripts/check_distribution.py +116 -0
- nexqus_sdk-1.0.0/scripts/check_release.py +94 -0
- nexqus_sdk-1.0.0/scripts/run_notebooks.py +184 -0
- nexqus_sdk-1.0.0/scripts/validate_cuda_release.sh +9 -0
- nexqus_sdk-1.0.0/setup.cfg +4 -0
- nexqus_sdk-1.0.0/src/nexqus/__init__.py +12 -0
- nexqus_sdk-1.0.0/src/nexqus/algorithms.py +137 -0
- nexqus_sdk-1.0.0/src/nexqus/backend.py +133 -0
- nexqus_sdk-1.0.0/src/nexqus/circuit.py +237 -0
- nexqus_sdk-1.0.0/src/nexqus/dynamic.py +204 -0
- nexqus_sdk-1.0.0/src/nexqus/gradients.py +83 -0
- nexqus_sdk-1.0.0/src/nexqus/learning.py +90 -0
- nexqus_sdk-1.0.0/src/nexqus/noise.py +106 -0
- nexqus_sdk-1.0.0/src/nexqus/optimizers.py +49 -0
- nexqus_sdk-1.0.0/src/nexqus/parameters.py +77 -0
- nexqus_sdk-1.0.0/src/nexqus/random.py +42 -0
- nexqus_sdk-1.0.0/src/nexqus/simulator.py +420 -0
- nexqus_sdk-1.0.0/src/nexqus/validation.py +105 -0
- nexqus_sdk-1.0.0/src/nexqus_sdk.egg-info/PKG-INFO +225 -0
- nexqus_sdk-1.0.0/src/nexqus_sdk.egg-info/SOURCES.txt +75 -0
- nexqus_sdk-1.0.0/src/nexqus_sdk.egg-info/dependency_links.txt +1 -0
- nexqus_sdk-1.0.0/src/nexqus_sdk.egg-info/requires.txt +18 -0
- nexqus_sdk-1.0.0/src/nexqus_sdk.egg-info/top_level.txt +1 -0
- nexqus_sdk-1.0.0/tests/test_release.py +294 -0
- nexqus_sdk-1.0.0/tests/test_sdk.py +221 -0
- nexqus_sdk-1.0.0/tests/test_v02.py +200 -0
- nexqus_sdk-1.0.0/tests/test_v03.py +210 -0
- nexqus_sdk-1.0.0/tests/test_v04.py +193 -0
- nexqus_sdk-1.0.0/tests/test_v05.py +201 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Report a reproducible SDK problem
|
|
3
|
+
body:
|
|
4
|
+
- type: textarea
|
|
5
|
+
id: environment
|
|
6
|
+
attributes:
|
|
7
|
+
label: Environment
|
|
8
|
+
description: SDK, Python, NumPy, Torch/CUDA versions, OS and GPU (if used)
|
|
9
|
+
validations:
|
|
10
|
+
required: true
|
|
11
|
+
- type: textarea
|
|
12
|
+
id: reproduction
|
|
13
|
+
attributes:
|
|
14
|
+
label: Minimal reproduction
|
|
15
|
+
description: Small complete circuit, simulator options, random seed, expected and actual results. Remove credentials and private data.
|
|
16
|
+
validations:
|
|
17
|
+
required: true
|
|
18
|
+
- type: textarea
|
|
19
|
+
id: output
|
|
20
|
+
attributes:
|
|
21
|
+
label: Error or validation output
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
name: SDK validation
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request, workflow_dispatch, workflow_call]
|
|
4
|
+
|
|
5
|
+
concurrency:
|
|
6
|
+
group: ci-${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
|
|
7
|
+
cancel-in-progress: true
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
PYTHONUTF8: '1'
|
|
14
|
+
OMP_NUM_THREADS: '1'
|
|
15
|
+
OPENBLAS_NUM_THREADS: '1'
|
|
16
|
+
MKL_NUM_THREADS: '1'
|
|
17
|
+
MPLBACKEND: Agg
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
core:
|
|
21
|
+
name: NumPy ${{ matrix.os }} Python ${{ matrix.python }}
|
|
22
|
+
runs-on: ${{ matrix.os }}
|
|
23
|
+
strategy:
|
|
24
|
+
fail-fast: false
|
|
25
|
+
matrix:
|
|
26
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
27
|
+
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v7.0.1
|
|
30
|
+
with:
|
|
31
|
+
persist-credentials: false
|
|
32
|
+
- uses: actions/setup-python@v7.0.0
|
|
33
|
+
with:
|
|
34
|
+
python-version: ${{ matrix.python }}
|
|
35
|
+
- run: python -m pip install .
|
|
36
|
+
- run: python scripts/check_release.py --public
|
|
37
|
+
|
|
38
|
+
minimum-numpy:
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v7.0.1
|
|
42
|
+
with:
|
|
43
|
+
persist-credentials: false
|
|
44
|
+
- uses: actions/setup-python@v7.0.0
|
|
45
|
+
with:
|
|
46
|
+
python-version: '3.10'
|
|
47
|
+
- run: python -m pip install numpy==1.24.4 .
|
|
48
|
+
- run: python scripts/check_release.py --public
|
|
49
|
+
|
|
50
|
+
torch-cpu:
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/checkout@v7.0.1
|
|
54
|
+
with:
|
|
55
|
+
persist-credentials: false
|
|
56
|
+
- uses: actions/setup-python@v7.0.0
|
|
57
|
+
with:
|
|
58
|
+
python-version: '3.12'
|
|
59
|
+
- run: python -m pip install "torch>=2.2,<3" --index-url https://download.pytorch.org/whl/cpu
|
|
60
|
+
- run: python -m pip install .
|
|
61
|
+
- run: python scripts/check_release.py --public --require-torch
|
|
62
|
+
- uses: actions/upload-artifact@v7.0.2
|
|
63
|
+
if: always()
|
|
64
|
+
with:
|
|
65
|
+
include-hidden-files: true
|
|
66
|
+
name: torch-cpu-validation
|
|
67
|
+
path: .release-artifacts/release_validation.json
|
|
68
|
+
|
|
69
|
+
notebooks:
|
|
70
|
+
runs-on: ubuntu-latest
|
|
71
|
+
steps:
|
|
72
|
+
- uses: actions/checkout@v7.0.1
|
|
73
|
+
with:
|
|
74
|
+
persist-credentials: false
|
|
75
|
+
- uses: actions/setup-python@v7.0.0
|
|
76
|
+
with:
|
|
77
|
+
python-version: '3.12'
|
|
78
|
+
- run: python -m pip install ".[tutorial]"
|
|
79
|
+
- run: python -m ipykernel install --user --name nexqus --display-name "Python (NexQus)"
|
|
80
|
+
- run: python scripts/run_notebooks.py --engine jupyter --kernel nexqus
|
|
81
|
+
- uses: actions/upload-artifact@v7.0.2
|
|
82
|
+
if: always()
|
|
83
|
+
with:
|
|
84
|
+
include-hidden-files: true
|
|
85
|
+
name: jupyter-validation
|
|
86
|
+
path: |
|
|
87
|
+
.release-artifacts/notebook_execution.json
|
|
88
|
+
notebooks/*.ipynb
|
|
89
|
+
|
|
90
|
+
distribution:
|
|
91
|
+
runs-on: ubuntu-latest
|
|
92
|
+
steps:
|
|
93
|
+
- uses: actions/checkout@v7.0.1
|
|
94
|
+
with:
|
|
95
|
+
persist-credentials: false
|
|
96
|
+
- uses: actions/setup-python@v7.0.0
|
|
97
|
+
with:
|
|
98
|
+
python-version: '3.12'
|
|
99
|
+
- run: python -m pip install ".[release]"
|
|
100
|
+
- run: python -m build
|
|
101
|
+
- run: python -m twine check --strict dist/*
|
|
102
|
+
- run: python scripts/check_distribution.py
|
|
103
|
+
- uses: actions/upload-artifact@v7.0.2
|
|
104
|
+
if: always()
|
|
105
|
+
with:
|
|
106
|
+
include-hidden-files: true
|
|
107
|
+
name: candidate-distributions
|
|
108
|
+
path: |
|
|
109
|
+
dist/*
|
|
110
|
+
.release-artifacts/distribution_validation.json
|
|
111
|
+
|
|
112
|
+
core-dependency-audit:
|
|
113
|
+
runs-on: ubuntu-latest
|
|
114
|
+
steps:
|
|
115
|
+
- uses: actions/checkout@v7.0.1
|
|
116
|
+
with:
|
|
117
|
+
persist-credentials: false
|
|
118
|
+
- uses: actions/setup-python@v7.0.0
|
|
119
|
+
with:
|
|
120
|
+
python-version: '3.12'
|
|
121
|
+
- run: python -m pip install . pip-audit
|
|
122
|
+
- run: python -c "import numpy; print('numpy==' + numpy.__version__)" > core-audit-requirements.txt
|
|
123
|
+
- run: python -c "from pathlib import Path; Path('.release-artifacts').mkdir(exist_ok=True)"
|
|
124
|
+
- run: python -m pip_audit --strict --disable-pip --no-deps -r core-audit-requirements.txt -f json -o .release-artifacts/dependency_audit_core.json
|
|
125
|
+
- uses: actions/upload-artifact@v7.0.2
|
|
126
|
+
if: always()
|
|
127
|
+
with:
|
|
128
|
+
include-hidden-files: true
|
|
129
|
+
name: core-dependency-audit
|
|
130
|
+
path: .release-artifacts/dependency_audit_core.json
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: Publish reviewed distribution
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
repository:
|
|
7
|
+
description: Package index
|
|
8
|
+
type: choice
|
|
9
|
+
options: [testpypi, pypi]
|
|
10
|
+
default: testpypi
|
|
11
|
+
required: true
|
|
12
|
+
version:
|
|
13
|
+
description: Exact source version, for example 1.0.0
|
|
14
|
+
type: string
|
|
15
|
+
required: true
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
verify:
|
|
22
|
+
uses: ./.github/workflows/ci.yml
|
|
23
|
+
|
|
24
|
+
build:
|
|
25
|
+
needs: verify
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
env:
|
|
28
|
+
REQUESTED_VERSION: ${{ inputs.version }}
|
|
29
|
+
TARGET_INDEX: ${{ inputs.repository }}
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v7.0.1
|
|
32
|
+
with:
|
|
33
|
+
persist-credentials: false
|
|
34
|
+
- uses: actions/setup-python@v7.0.0
|
|
35
|
+
with:
|
|
36
|
+
python-version: '3.12'
|
|
37
|
+
- run: python -m pip install ".[release]"
|
|
38
|
+
- name: Check version and production status
|
|
39
|
+
run: |
|
|
40
|
+
python - <<'PY'
|
|
41
|
+
import os
|
|
42
|
+
from packaging.version import Version
|
|
43
|
+
from nexqus import __version__
|
|
44
|
+
assert os.environ['REQUESTED_VERSION'] == __version__, 'Requested version differs from source'
|
|
45
|
+
if os.environ['TARGET_INDEX'] == 'pypi':
|
|
46
|
+
assert not Version(__version__).is_prerelease, 'Use TestPyPI for this release candidate'
|
|
47
|
+
PY
|
|
48
|
+
- run: python scripts/check_release.py --public
|
|
49
|
+
- run: python -m build
|
|
50
|
+
- run: python -m twine check --strict dist/*
|
|
51
|
+
- run: python scripts/check_distribution.py
|
|
52
|
+
- uses: actions/upload-artifact@v7.0.2
|
|
53
|
+
with:
|
|
54
|
+
name: release-dist
|
|
55
|
+
path: dist/*
|
|
56
|
+
if-no-files-found: error
|
|
57
|
+
|
|
58
|
+
publish:
|
|
59
|
+
needs: build
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
environment:
|
|
62
|
+
name: ${{ inputs.repository }}
|
|
63
|
+
permissions:
|
|
64
|
+
id-token: write
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/download-artifact@v8
|
|
67
|
+
with:
|
|
68
|
+
name: release-dist
|
|
69
|
+
path: dist
|
|
70
|
+
- name: Publish to TestPyPI
|
|
71
|
+
if: inputs.repository == 'testpypi'
|
|
72
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
73
|
+
with:
|
|
74
|
+
repository-url: https://test.pypi.org/legacy/
|
|
75
|
+
- name: Publish stable version to PyPI
|
|
76
|
+
if: inputs.repository == 'pypi'
|
|
77
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0 — 2026-10-16
|
|
4
|
+
|
|
5
|
+
First stable public release under the MIT license.
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- NumPy CPU and optional PyTorch CPU/NVIDIA CUDA simulation.
|
|
10
|
+
- Noiseless statevectors, exact density matrices and batched noisy trajectories.
|
|
11
|
+
- Circuit functions, symbolic parameters, sweeps, prepared execution and built-in algorithms.
|
|
12
|
+
- Parameter-shift gradients, Adam/SGD, small learning models and VQE examples.
|
|
13
|
+
- Mid-circuit measurement, reset, classical feed-forward and teleportation.
|
|
14
|
+
- Seven English/Burmese notebooks, current feature guides and the public 1.x API policy.
|
|
15
|
+
|
|
16
|
+
### Correctness and packaging
|
|
17
|
+
|
|
18
|
+
- Reject non-finite or malformed validation results and invalid state/diagonal inputs.
|
|
19
|
+
- Preserve single precision in NumPy damping and bound dynamic shot scheduling memory.
|
|
20
|
+
- Reject complex learning data; isolate training callbacks and keep Adam failures atomic.
|
|
21
|
+
- Keep validation reports and internal audit notes out of public guides and package archives.
|
|
22
|
+
- Validate wheel/source contents, clean installations and notebook execution in CI.
|
|
23
|
+
|
|
24
|
+
## Development history
|
|
25
|
+
|
|
26
|
+
## 0.6.0
|
|
27
|
+
|
|
28
|
+
Seven tested English/Burmese notebooks and a notebook execution runner. Runtime
|
|
29
|
+
features unchanged from v0.5 except version identifier.
|
|
30
|
+
|
|
31
|
+
## 0.5.0
|
|
32
|
+
|
|
33
|
+
Mid-circuit measurement, reset, single-bit feed-forward, exact classical/density
|
|
34
|
+
branching, sampled dynamic histories, joint counts and teleportation.
|
|
35
|
+
|
|
36
|
+
## 0.4.0
|
|
37
|
+
|
|
38
|
+
Parameters, gate-local analytic gradients, Adam/SGD, regression, binary
|
|
39
|
+
classification and VQE demonstrations.
|
|
40
|
+
|
|
41
|
+
## 0.3.0
|
|
42
|
+
|
|
43
|
+
Device-local RNG and noise branch sampling, Pauli/damping specializations, local
|
|
44
|
+
gate kernels, CPU threading controls and stricter numerical parity checks.
|
|
45
|
+
|
|
46
|
+
## 0.2.0
|
|
47
|
+
|
|
48
|
+
Parameters/sweeps, prepared execution, bounded gate cache and batched trajectories.
|
|
49
|
+
|
|
50
|
+
## 0.1.0
|
|
51
|
+
|
|
52
|
+
Own circuit engine, NumPy/optional Torch backends, statevector/density/trajectory
|
|
53
|
+
simulation, single-qubit channels, reusable algorithms and examples.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Contributing to NexQus
|
|
2
|
+
|
|
3
|
+
NexQus SDK is released under the MIT License. Report reproducible bugs and propose
|
|
4
|
+
changes through https://github.com/Inn0m1n4te030/NexQus-SDK. By contributing code,
|
|
5
|
+
you agree that your contribution is provided under the project's MIT License.
|
|
6
|
+
|
|
7
|
+
Install in a fresh environment with `python -m pip install -e .`. Run
|
|
8
|
+
`python scripts/check_release.py`. CPU-only installations may skip optional
|
|
9
|
+
Torch/CUDA tests, and reports must retain those skips. If Torch CPU is available,
|
|
10
|
+
run `python scripts/check_release.py --require-torch`. CUDA maintainers use
|
|
11
|
+
`--require-gpu`, which requires zero skips.
|
|
12
|
+
|
|
13
|
+
Changes to evolution, tensor ordering, stochastic sampling, precision, memory
|
|
14
|
+
guards or gradients need a regression based on a known answer or independent
|
|
15
|
+
reference. Include seeds, precision, method and batch size. An agreement between
|
|
16
|
+
two implementations sharing a kernel is not sufficient evidence on its own.
|
|
17
|
+
|
|
18
|
+
Update the API documentation and changelog when observable behavior changes.
|
|
19
|
+
Write clear English docstrings and preserve Burmese explanations. New notebooks
|
|
20
|
+
should be generated from scripts/build_notebooks.py and executed using a real
|
|
21
|
+
Jupyter kernel before release. Keep optional-device skips explicit.
|
|
22
|
+
|
|
23
|
+
The source distribution includes tests and teaching material. Before proposing a
|
|
24
|
+
release, run `python -m build`, `python -m twine check --strict dist/*`, and
|
|
25
|
+
`python scripts/check_distribution.py` from a clean dist directory.
|
|
26
|
+
|
|
27
|
+
For bug reports include a minimal complete circuit, Python/NumPy/Torch versions,
|
|
28
|
+
OS/device, expected result, actual result and simulator metadata. Remove private
|
|
29
|
+
data and credentials. Use https://github.com/Inn0m1n4te030/NexQus-SDK/issues.
|
|
30
|
+
|
|
31
|
+
The public API policy is in docs/API_STABILITY.md. Avoid depending on
|
|
32
|
+
private helpers, direct Operation construction or mutable implementation internals.
|
nexqus_sdk-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NexQus
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
include README.md LICENSE CHANGELOG.md CONTRIBUTING.md SECURITY.md
|
|
2
|
+
recursive-include src *.py
|
|
3
|
+
recursive-include tests *.py
|
|
4
|
+
recursive-include examples *.py
|
|
5
|
+
recursive-include scripts *.py *.sh
|
|
6
|
+
recursive-include docs *.md
|
|
7
|
+
recursive-include notebooks *.md *.ipynb
|
|
8
|
+
recursive-include .github *.yml *.yaml
|
|
9
|
+
prune .release-artifacts
|
|
10
|
+
global-exclude *.py[cod]
|
|
11
|
+
global-exclude .DS_Store
|
|
12
|
+
prune build
|
|
13
|
+
prune dist
|
|
14
|
+
prune .venv
|
|
15
|
+
prune .ipynb_checkpoints
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nexqus-sdk
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Quantum circuit, noise, dynamic protocol and learning simulation on NumPy or PyTorch
|
|
5
|
+
Author: NexQus
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://nexqus.com
|
|
8
|
+
Project-URL: Source, https://github.com/Inn0m1n4te030/NexQus-SDK
|
|
9
|
+
Project-URL: Issues, https://github.com/Inn0m1n4te030/NexQus-SDK/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/Inn0m1n4te030/NexQus-SDK#readme
|
|
11
|
+
Keywords: quantum,simulator,statevector,noise,qml,cuda,burmese
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Intended Audience :: Education
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: numpy<3,>=1.24
|
|
22
|
+
Provides-Extra: gpu
|
|
23
|
+
Requires-Dist: torch<3,>=2.2; extra == "gpu"
|
|
24
|
+
Provides-Extra: benchmark
|
|
25
|
+
Requires-Dist: threadpoolctl>=3.1; extra == "benchmark"
|
|
26
|
+
Provides-Extra: tutorial
|
|
27
|
+
Requires-Dist: matplotlib>=3.7; extra == "tutorial"
|
|
28
|
+
Requires-Dist: nbformat>=5.9; extra == "tutorial"
|
|
29
|
+
Requires-Dist: nbclient>=0.10; extra == "tutorial"
|
|
30
|
+
Requires-Dist: ipykernel>=6; extra == "tutorial"
|
|
31
|
+
Requires-Dist: jupyterlab>=4; extra == "tutorial"
|
|
32
|
+
Provides-Extra: release
|
|
33
|
+
Requires-Dist: build>=1.2.2; extra == "release"
|
|
34
|
+
Requires-Dist: twine>=6.1; extra == "release"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# NexQus SDK
|
|
38
|
+
|
|
39
|
+
Quantum circuit simulation on NumPy CPU and optional PyTorch CPU/NVIDIA CUDA,
|
|
40
|
+
with noise channels, reusable algorithms, analytic gradients and Burmese/English
|
|
41
|
+
tutorials. NexQus implements its own circuit representation and evolution kernels;
|
|
42
|
+
other quantum SDKs are not execution dependencies.
|
|
43
|
+
|
|
44
|
+
**Version 1.0.0 · MIT license.**
|
|
45
|
+
[Source and issue tracking](https://github.com/Inn0m1n4te030/NexQus-SDK).
|
|
46
|
+
|
|
47
|
+
## Install
|
|
48
|
+
|
|
49
|
+
In an activated Python 3.10+ virtual environment:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
python -m pip install nexqus-sdk==1.0.0
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The distribution name is **nexqus-sdk**; the Python import is **nexqus**.
|
|
56
|
+
For editable development from a source checkout, use `python -m pip install -e .`.
|
|
57
|
+
Examples and notebooks are available in the source repository and source archive.
|
|
58
|
+
|
|
59
|
+
## Your first circuit
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from nexqus import Circuit, Simulator
|
|
63
|
+
|
|
64
|
+
q = Circuit(2).h(0).cx(0, 1)
|
|
65
|
+
result = Simulator().run(q, shots=1000, seed=42)
|
|
66
|
+
print(result.probabilities) # [0.5, 0, 0, 0.5], up to roundoff
|
|
67
|
+
print(result.counts) # samples of 00 and 11
|
|
68
|
+
print(result.expectation('ZZ')) # approximately 1
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Bit order:** q0 is the leftmost, most significant bit. `Circuit(2).x(0)` prepares
|
|
72
|
+
`10`. Angles use radians. `shots=0` returns probabilities without sampling counts.
|
|
73
|
+
|
|
74
|
+
## Functions, parameters and learning
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from nexqus import circuit, Parameter, QuantumFunction, Simulator
|
|
78
|
+
|
|
79
|
+
@circuit(2)
|
|
80
|
+
def block(q, theta):
|
|
81
|
+
# ပထမ qubit ကို rotate လုပ်ပြီး ဒုတိယ qubit နှင့် ချိတ်ဆက်ပါ။
|
|
82
|
+
q.ry(theta, 0).cx(0, 1)
|
|
83
|
+
|
|
84
|
+
theta = Parameter('theta')
|
|
85
|
+
template = block(theta)
|
|
86
|
+
function = QuantumFunction(template, 'ZI')
|
|
87
|
+
value, gradient = function.value_and_grad({'theta': 0.4})
|
|
88
|
+
|
|
89
|
+
sim = Simulator()
|
|
90
|
+
results = sim.run_sweep(template, [{'theta': 0.0}, {'theta': 1.0}], shots=0, seed=42)
|
|
91
|
+
prepared = sim.compile(template.bind({'theta': 0.4}))
|
|
92
|
+
result = prepared.run(shots=1000, seed=42)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Parameter-shift differentiation supports RX, RY, RZ, P and CP with shared
|
|
96
|
+
parameters and arithmetic chain rules. `QuantumRegressor`,
|
|
97
|
+
`QuantumBinaryClassifier`, Adam and SGD support small explicit learning loops.
|
|
98
|
+
Gradients require static noiseless or exact-density circuits. They do not expose
|
|
99
|
+
Torch autograd, sampled trajectory gradients or dynamic-circuit gradients.
|
|
100
|
+
|
|
101
|
+
## Noisy simulation
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from nexqus import Noise, NoiseModel, Simulator, algorithms
|
|
105
|
+
|
|
106
|
+
noise = NoiseModel(Noise.depolarizing(0.02), Noise.amplitude_damping(0.01))
|
|
107
|
+
exact = Simulator().run(algorithms.bell(), noise=noise, shots=0)
|
|
108
|
+
sampled = Simulator(method='trajectory').run(
|
|
109
|
+
algorithms.ghz(10), noise=noise, trajectories=1000,
|
|
110
|
+
batch_size=32, shots=1000, seed=7,
|
|
111
|
+
)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
| Method | Behavior | Main state storage |
|
|
115
|
+
|---|---|---|
|
|
116
|
+
| `auto` | Static statevector without noise; density with noise; exact density branches for dynamic circuits | Depends on selected mode |
|
|
117
|
+
| `statevector` | Pure static circuits; rejects quantum noise and dynamic controls | O(2^n) |
|
|
118
|
+
| `density_matrix` | Exact channels, or classical/density branching for dynamic circuits | O(4^n) per branch |
|
|
119
|
+
| `trajectory` | A finite ensemble of sampled pure-state histories | O(B × 2^n), batch size B |
|
|
120
|
+
|
|
121
|
+
Built-in channels: bit flip, phase flip, depolarizing, amplitude damping and phase
|
|
122
|
+
damping; custom one-qubit CPTP Kraus channels are validated. Global noise is
|
|
123
|
+
applied after each gate to each touched wire, in channel insertion order.
|
|
124
|
+
Depolarizing means `(1-p)rho + p I/2`; phase damping multiplies coherences by
|
|
125
|
+
`sqrt(1-gamma)`. Output `readout_error` affects reported quantum bit probabilities
|
|
126
|
+
and counts, not the retained quantum state or intermediate classical control.
|
|
127
|
+
|
|
128
|
+
Trajectory probabilities remain Monte Carlo estimates even at `shots=0`.
|
|
129
|
+
Increasing shots does not increase the number of simulated histories.
|
|
130
|
+
|
|
131
|
+
## Measurement, reset and feed-forward
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from nexqus import Circuit, Simulator
|
|
135
|
+
|
|
136
|
+
q = Circuit(1).h(0).measure(0, 'm').x(0).c_if('m', 1)
|
|
137
|
+
result = Simulator().run(q, shots=1000, seed=42)
|
|
138
|
+
print(result.counts) # {'0': 1000}
|
|
139
|
+
print(result.classical_counts) # intermediate measurement results
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Single-bit conditions, overwritable classical keys, reset, joint
|
|
143
|
+
classical/quantum counts and reduced density matrices are supported.
|
|
144
|
+
`algorithms.teleportation()` supplies a complete feed-forward protocol.
|
|
145
|
+
Exact branching is limited by `max_branches` and estimated memory.
|
|
146
|
+
|
|
147
|
+
## CPU and CUDA
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from nexqus import Simulator
|
|
151
|
+
|
|
152
|
+
cpu = Simulator()
|
|
153
|
+
torch_cpu = Simulator(backend='torch')
|
|
154
|
+
gpu = Simulator(backend='torch', device='cuda:0', precision='single')
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Install a compatible PyTorch build using the official
|
|
158
|
+
[PyTorch installation guide](https://pytorch.org/get-started/locally/).
|
|
159
|
+
The `gpu` extra declares optional PyTorch; it cannot guarantee a CUDA-enabled
|
|
160
|
+
build for your machine. Unsupported CUDA execution raises an error.
|
|
161
|
+
There is no silent CPU fallback. Results use NumPy arrays on the host.
|
|
162
|
+
Only CPU and NVIDIA CUDA are supported; CPU can be faster for small circuits.
|
|
163
|
+
|
|
164
|
+
## Qubit and memory limits
|
|
165
|
+
|
|
166
|
+
There is no universal fixed qubit capacity. Statevector storage doubles per
|
|
167
|
+
added qubit; density storage quadruples. A double-precision 20-qubit vector uses
|
|
168
|
+
16 MiB for the main state. One double-precision 12-qubit density uses 256 MiB.
|
|
169
|
+
|
|
170
|
+
`max_memory_mb=1024` checks an estimated six-state workspace, multiplied by
|
|
171
|
+
effective trajectory batch size; exact dynamic branches add further storage.
|
|
172
|
+
This estimate is not an allocator cap. Circuit data, cached gates, retained host
|
|
173
|
+
states and output-shot storage need additional memory. With the default estimate,
|
|
174
|
+
a static complex128 vector can reach 23 qubits and a density 11 qubits; these are
|
|
175
|
+
guard thresholds, not measured performance or hardware guarantees.
|
|
176
|
+
|
|
177
|
+
Benchmark your intended circuit, method and device to determine practical limits.
|
|
178
|
+
See the [performance guide](https://github.com/Inn0m1n4te030/NexQus-SDK/blob/main/docs/PERFORMANCE.md)
|
|
179
|
+
for memory, batching and CPU/GPU comparison commands.
|
|
180
|
+
|
|
181
|
+
## Learn and validate
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
python -m pip install '.[tutorial]'
|
|
185
|
+
python -m ipykernel install --user --name nexqus --display-name "Python (NexQus)"
|
|
186
|
+
jupyter lab notebooks
|
|
187
|
+
python scripts/run_notebooks.py --engine jupyter --kernel nexqus
|
|
188
|
+
python scripts/check_release.py
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Seven bilingual notebooks cover circuits, algorithms, noise, devices, gradients,
|
|
192
|
+
learning, measurement/reset and an end-to-end experiment. Start with
|
|
193
|
+
`notebooks/00_start_here.ipynb`; the learning map is in `notebooks/README.md`.
|
|
194
|
+
The source distribution includes tutorials, tests, examples and documentation;
|
|
195
|
+
the small runtime wheel contains the importable SDK and package metadata.
|
|
196
|
+
|
|
197
|
+
CUDA release validation, on a compatible machine:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
python scripts/check_release.py --require-gpu
|
|
201
|
+
python scripts/run_notebooks.py --engine jupyter --kernel nexqus --require-gpu
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
`--require-gpu` fails on missing CUDA or skipped tests. Generated reports are
|
|
205
|
+
written to `.release-artifacts/` and excluded from distributed packages.
|
|
206
|
+
|
|
207
|
+
## Documentation and scope
|
|
208
|
+
|
|
209
|
+
- [API reference](https://github.com/Inn0m1n4te030/NexQus-SDK/blob/main/docs/API.md)
|
|
210
|
+
and [1.x compatibility policy](https://github.com/Inn0m1n4te030/NexQus-SDK/blob/main/docs/API_STABILITY.md).
|
|
211
|
+
- [Burmese quick start](https://github.com/Inn0m1n4te030/NexQus-SDK/blob/main/docs/BURMESE_QUICKSTART.md).
|
|
212
|
+
- [Performance](https://github.com/Inn0m1n4te030/NexQus-SDK/blob/main/docs/PERFORMANCE.md),
|
|
213
|
+
[learning](https://github.com/Inn0m1n4te030/NexQus-SDK/blob/main/docs/LEARNING.md)
|
|
214
|
+
and [dynamic circuits](https://github.com/Inn0m1n4te030/NexQus-SDK/blob/main/docs/DYNAMIC_CIRCUITS.md).
|
|
215
|
+
- [Release notes](https://github.com/Inn0m1n4te030/NexQus-SDK/blob/main/docs/RELEASE_NOTES.md),
|
|
216
|
+
[contributing](https://github.com/Inn0m1n4te030/NexQus-SDK/blob/main/CONTRIBUTING.md)
|
|
217
|
+
and [security](https://github.com/Inn0m1n4te030/NexQus-SDK/blob/main/SECURITY.md).
|
|
218
|
+
|
|
219
|
+
This SDK targets education and small research experiments. It does not include
|
|
220
|
+
distributed execution, fused CUDA kernels, hardware services, pulse simulation,
|
|
221
|
+
hardware-calibrated noise or a quantum advantage claim. Treat circuit and notebook
|
|
222
|
+
code like other Python code: run code from sources you trust.
|
|
223
|
+
|
|
224
|
+
Homepage: [nexqus.com](https://nexqus.com).
|
|
225
|
+
Licensed under the [MIT License](https://github.com/Inn0m1n4te030/NexQus-SDK/blob/main/LICENSE).
|