sia-script 1.3.0__tar.gz → 1.5.2__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.
@@ -0,0 +1,128 @@
1
+ # sia-script License
2
+
3
+ Copyright © 2026 Sia Software Innovations Private Limited. All rights reserved.
4
+
5
+ sia-script is distributed under two licenses:
6
+
7
+ | Component | Files | License |
8
+ |---|---|---|
9
+ | HDQS Engine (offline quantum simulator) | `sia/hdqs_engine.py` | MIT License (Part B) |
10
+ | All other components, including the HDQS server client, SiaNTT and SIA Enterprise Logic Studio | All other files in the package | Proprietary License (Part A) |
11
+
12
+ The SPDX expression for the package is `LicenseRef-SIA-Proprietary AND MIT`.
13
+
14
+ ---
15
+
16
+ ## Part A — Proprietary License
17
+
18
+ ### A1. Licensor
19
+
20
+ Sia Software Innovations Private Limited, a company incorporated in India
21
+ (CIN U62013AP2025PTC122642), with its registered office at 3-159/1,
22
+ V. Narayana Theater Road, Malikipuram, East Godavari (Konaseema) District,
23
+ Andhra Pradesh – 533253, India ("the Licensor").
24
+
25
+ ### A2. Scope
26
+
27
+ This Part applies to every file in the sia-script package except
28
+ `sia/hdqs_engine.py` (together, "the Software"). The Software is licensed,
29
+ not sold.
30
+
31
+ ### A3. License grant
32
+
33
+ Subject to the terms of this Part, the Licensor grants you a limited,
34
+ non-exclusive, non-transferable, revocable license to install and use the
35
+ Software for evaluation purposes only.
36
+
37
+ ### A4. Commercial use
38
+
39
+ Commercial use of the Software, including production deployment, requires a
40
+ separate written commercial license agreement with the Licensor.
41
+
42
+ ### A5. Restrictions
43
+
44
+ Except as expressly permitted in writing by the Licensor, you may not:
45
+
46
+ 1. copy, redistribute, sublicense, sell, rent or lease the Software, in
47
+ source or binary form;
48
+ 2. modify, adapt or translate the Software, or create derivative works
49
+ based on it;
50
+ 3. reverse engineer, decompile or disassemble the Software, except to the
51
+ extent applicable law expressly permits it despite this restriction;
52
+ 4. publicly display or publicly perform the Software; or
53
+ 5. remove or alter any copyright, license or proprietary notice in the
54
+ Software.
55
+
56
+ ### A6. HDQS server access
57
+
58
+ The HDQS server client included in the Software connects to services operated
59
+ by the Licensor. Access to those services requires an API token issued by the
60
+ Licensor. This Part does not grant any right to use the services without a
61
+ valid token.
62
+
63
+ ### A7. Intellectual property
64
+
65
+ All intellectual property rights in the Software remain the exclusive property
66
+ of the Licensor. No rights are granted other than those expressly stated in
67
+ this Part.
68
+
69
+ ### A8. Third-party software
70
+
71
+ The Software depends on third-party packages (such as NumPy and Requests) that
72
+ are licensed by their respective owners under their own terms. Nothing in this
73
+ Part limits your rights under those licenses.
74
+
75
+ ### A9. Termination
76
+
77
+ This license terminates automatically if you fail to comply with any of its
78
+ terms. On termination you must stop using the Software and destroy all copies
79
+ in your possession.
80
+
81
+ ### A10. Disclaimer of warranty
82
+
83
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
84
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
85
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
86
+
87
+ ### A11. Limitation of liability
88
+
89
+ IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
90
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
91
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER DEALINGS IN
92
+ THE SOFTWARE.
93
+
94
+ ### A12. Commercial licensing and contact
95
+
96
+ For commercial licensing, enterprise support and production deployment:
97
+
98
+ - Email: info@siasoftwareinnovations.com
99
+ - Website: https://www.siasoftwareinnovations.com
100
+
101
+ ---
102
+
103
+ ## Part B — MIT License (HDQS Engine)
104
+
105
+ This Part applies only to `sia/hdqs_engine.py`. The restrictions in Part A do
106
+ not apply to that file.
107
+
108
+ MIT License
109
+
110
+ Copyright (c) 2026 Sia Software Innovations Private Limited
111
+
112
+ Permission is hereby granted, free of charge, to any person obtaining a copy
113
+ of this software and associated documentation files (the "Software"), to deal
114
+ in the Software without restriction, including without limitation the rights
115
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
116
+ copies of the Software, and to permit persons to whom the Software is
117
+ furnished to do so, subject to the following conditions:
118
+
119
+ The above copyright notice and this permission notice shall be included in all
120
+ copies or substantial portions of the Software.
121
+
122
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
123
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
124
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
125
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
126
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
127
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
128
+ SOFTWARE.
@@ -0,0 +1,338 @@
1
+ Metadata-Version: 2.4
2
+ Name: sia-script
3
+ Version: 1.5.2
4
+ Summary: SIA: offline quantum simulator (hdqs_engine), HDQS server client, SiaNTT and SIA-ELS. One import: from sia import hdqs
5
+ Author-email: Sia Software Innovations Private Limited <info@siasoftwareinnovations.com>
6
+ License-Expression: LicenseRef-SIA-Proprietary AND MIT
7
+ Project-URL: Homepage, https://www.siasoftwareinnovations.com
8
+ Project-URL: Documentation, https://www.siasoftwareinnovations.com
9
+ Keywords: SIA,HDQS,hdqs-engine,quantum computing,quantum simulator,statevector,density matrix,stabilizer,matrix product state,quantum machine learning,OpenQASM,QKD,Grover,VQE,QAOA,ABAP,Enterprise Logic Studio,SiaNTT
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Intended Audience :: Science/Research
20
+ Classifier: Intended Audience :: Education
21
+ Classifier: Topic :: Scientific/Engineering :: Physics
22
+ Classifier: Topic :: Scientific/Engineering :: Quantum Computing
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Topic :: Software Development :: Interpreters
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Classifier: Topic :: System :: Distributed Computing
27
+ Requires-Python: >=3.9
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE.md
30
+ Requires-Dist: numpy>=1.24.0
31
+ Requires-Dist: requests>=2.31.0
32
+ Provides-Extra: torch
33
+ Requires-Dist: torch>=2.0; extra == "torch"
34
+ Provides-Extra: qasm
35
+ Requires-Dist: openqasm3[parser]>=1.0; extra == "qasm"
36
+ Provides-Extra: plot
37
+ Requires-Dist: matplotlib>=3.6; extra == "plot"
38
+ Provides-Extra: scipy
39
+ Requires-Dist: scipy>=1.10; extra == "scipy"
40
+ Provides-Extra: interop
41
+ Requires-Dist: qiskit>=1.0; extra == "interop"
42
+ Requires-Dist: qiskit-aer>=0.14; extra == "interop"
43
+ Requires-Dist: pennylane>=0.35; extra == "interop"
44
+ Provides-Extra: full
45
+ Requires-Dist: torch>=2.0; extra == "full"
46
+ Requires-Dist: openqasm3[parser]>=1.0; extra == "full"
47
+ Requires-Dist: matplotlib>=3.6; extra == "full"
48
+ Requires-Dist: scipy>=1.10; extra == "full"
49
+ Provides-Extra: all
50
+ Requires-Dist: torch>=2.0; extra == "all"
51
+ Requires-Dist: openqasm3[parser]>=1.0; extra == "all"
52
+ Requires-Dist: matplotlib>=3.6; extra == "all"
53
+ Requires-Dist: scipy>=1.10; extra == "all"
54
+ Requires-Dist: qiskit>=1.0; extra == "all"
55
+ Requires-Dist: qiskit-aer>=0.14; extra == "all"
56
+ Requires-Dist: pennylane>=0.35; extra == "all"
57
+ Provides-Extra: client
58
+ Provides-Extra: engine
59
+ Dynamic: license-file
60
+
61
+ # SIA — Simplified Integrated Architecture
62
+
63
+ [![PyPI](https://img.shields.io/pypi/v/sia-script.svg)](https://pypi.org/project/sia-script/)
64
+ [![Python](https://img.shields.io/pypi/pyversions/sia-script.svg)](https://pypi.org/project/sia-script/)
65
+ [![License](https://img.shields.io/badge/license-Proprietary%20%2B%20MIT%20engine-blue.svg)](LICENSE.md)
66
+
67
+ **sia-script** is the Python library of Sia Software Innovations Private Limited.
68
+ It provides an offline quantum simulator, a client for the HDQS quantum server,
69
+ a declarative entity module, and an ABAP-style enterprise logic interpreter,
70
+ all behind short, chainable APIs.
71
+
72
+ ```python
73
+ from sia import hdqs
74
+
75
+ q = hdqs(2).h(0).cnot(0, 1)
76
+ print(q.sample(1000)) # {'00': ~500, '11': ~500}
77
+ ```
78
+
79
+ One import is all a program needs.
80
+
81
+ ---
82
+
83
+ ## Contents
84
+
85
+ - [Installation](#installation)
86
+ - [Components](#components)
87
+ - [Quantum simulation: `hdqs`](#quantum-simulation-hdqs)
88
+ - [HDQS server client](#hdqs-server-client)
89
+ - [Entities: `ntt`](#entities-ntt)
90
+ - [Enterprise logic: `els`](#enterprise-logic-els)
91
+ - [Optional dependencies](#optional-dependencies)
92
+ - [Conventions](#conventions)
93
+ - [Licensing](#licensing)
94
+ - [Citation](#citation)
95
+ - [Support](#support)
96
+
97
+ ---
98
+
99
+ ## Installation
100
+
101
+ ```bash
102
+ pip install sia-script
103
+ ```
104
+
105
+ Requires Python 3.9 or newer. The base install needs only NumPy and Requests.
106
+ Optional features are installed as extras:
107
+
108
+ ```bash
109
+ pip install "sia-script[torch]" # trainable quantum layers, CUDA acceleration
110
+ pip install "sia-script[qasm]" # OpenQASM 3 import and export
111
+ pip install "sia-script[plot]" # circuit diagrams and state plots
112
+ pip install "sia-script[full]" # all of the above, plus SciPy
113
+ pip install "sia-script[all]" # everything, including Qiskit/Aer/PennyLane adapters
114
+ ```
115
+
116
+ ## Components
117
+
118
+ | Import | What it is | Needs network |
119
+ |---|---|---|
120
+ | `from sia import hdqs` | Offline quantum simulator (`hdqs(n)`), plus the server client through the same name | No (simulator) |
121
+ | `from sia import ntt` | SiaNTT declarative entities with safe, AST-checked expressions | No |
122
+ | `from sia import els` | SIA Enterprise Logic Studio, an ABAP-style interpreter | No |
123
+
124
+ The simulator runs entirely on your machine. Importing `sia` makes no network
125
+ call; only the server client contacts the HDQS server, and only when you create
126
+ a client.
127
+
128
+ ## Quantum simulation: `hdqs`
129
+
130
+ ### Chainable circuits
131
+
132
+ Every gate returns the register, so programs stay short:
133
+
134
+ ```python
135
+ from sia import hdqs
136
+
137
+ q = hdqs(3).h(0).cnot(0, 1).cnot(1, 2) # GHZ state
138
+ q.show_state() # amplitude table
139
+ print(q.sample(1000)) # measurement counts
140
+ print(q.estimator("ZZI")["value"]) # <ZZI> = 1.0
141
+ print(q.resources()["depth"]) # 3
142
+ ```
143
+
144
+ Gates: `h x y z s sdg t tdg rx ry rz p u3 cnot/cx cy cz cp crx cry crz swap
145
+ ccx cswap mcx`, plus `barrier`, `reset_qubit`, `measure` and custom `unitary`.
146
+
147
+ ### Noise
148
+
149
+ Density-matrix mode supports CPTP-verified channels:
150
+
151
+ ```python
152
+ from sia import hdqs
153
+
154
+ q = hdqs.dm(2).h(0).cnot(0, 1).depolarizing(0, 0.05).amplitude_damping(1, 0.1)
155
+ print(q.purity(), q.concurrence())
156
+
157
+ noisy = hdqs(2).h(0).cnot(0, 1).with_noise("depolarizing", 0.01) # replay with noise
158
+ ```
159
+
160
+ Channels: bit flip, phase flip, depolarizing, amplitude damping, phase damping,
161
+ generalized amplitude damping, thermal relaxation, coherent over-rotation,
162
+ amplitude–phase coupling, correlated two-qubit noise, and classical readout error.
163
+
164
+ ### Reusable circuits and simulation modes
165
+
166
+ ```python
167
+ from sia import hdqs
168
+
169
+ theta = hdqs.Parameter("theta")
170
+ c = hdqs.Circuit(3).ry(0, theta).cx(0, 1).measure(0, "m").if_x("m", 2)
171
+ result = c.run(shots=500, bindings={"theta": 0.7}, seed=1)
172
+ print(result.counts)
173
+
174
+ big = hdqs.Circuit(100).h(0)
175
+ for i in range(99):
176
+ big.cx(i, i + 1)
177
+ print(big.simulate(mode="stabilizer").sample(5)) # 100-qubit Clifford circuit
178
+ ```
179
+
180
+ | Mode | Use for |
181
+ |---|---|
182
+ | `statevector` | Exact pure-state simulation (default) |
183
+ | `density_matrix` | Exact mixed states and noise |
184
+ | `trajectory` | Sampled noise with statevector memory cost |
185
+ | `stabilizer` | Large Clifford-only circuits |
186
+ | `mps` | Low-entanglement circuits, with optional bond-dimension truncation |
187
+
188
+ ### Algorithms and protocols
189
+
190
+ ```python
191
+ from sia import hdqs
192
+
193
+ print(hdqs.grover(3, ["101"])["best"]) # '101'
194
+ print(hdqs.simon("110")["recovered"]) # '110'
195
+ print(sorted(hdqs.shor_demo(15)["factors"])) # [3, 5]
196
+ print(hdqs.teleport()["fidelity"]) # 1.0
197
+ print(hdqs.bb84(256, eavesdrop=True)["eavesdropping_suspected"]) # True
198
+ ```
199
+
200
+ Included: Deutsch, Deutsch–Jozsa, Bernstein–Vazirani, Grover, Simon, QFT,
201
+ phase estimation, order finding and a small Shor demonstration, teleportation,
202
+ superdense coding, VQE, QAOA, a repetition code, and the BB84, E91 and QSS
203
+ protocols (educational simulations, not production key distribution).
204
+
205
+ ### Analysis and mitigation
206
+
207
+ Observables and Pauli sums, sampled estimates with standard errors, Trotter
208
+ evolution, entropy, concurrence, negativity, mutual information, state
209
+ tomography, readout-error mitigation, zero-noise extrapolation, and CRIA
210
+ interference accessibility (`interference_report`, `interference_profile`,
211
+ `recover_interference`).
212
+
213
+ ### Machine learning (requires `[torch]`)
214
+
215
+ ```python
216
+ import torch
217
+ from sia import hdqs
218
+
219
+ layer = hdqs.BackpropQuantumLayer(num_qubits=4, layers=2)
220
+ out = layer(torch.rand(8, 4, dtype=torch.float64)) # (8, 4) Pauli-Z expectations
221
+ ```
222
+
223
+ Layers: `QuantumLayer` (parameter-shift gradients), `BackpropQuantumLayer`
224
+ (autograd), `MidCircuitQuantumLayer`, `QASMQuantumLayer`, and
225
+ `CircuitQuantumLayer` (any `Circuit`, including exact gradients through
226
+ mid-circuit measurement).
227
+
228
+ ### Circuit diagrams (requires `[plot]`)
229
+
230
+ ```python
231
+ from sia import hdqs
232
+
233
+ hdqs(3).h(0).cnot(0, 1).cnot(1, 2).draw("ghz.png", title="GHZ State")
234
+ hdqs.Circuit(2).h(0).measure(0, "m").if_x("m", 1).draw("feedforward.svg", theme="dark")
235
+ ```
236
+
237
+ Diagrams export to PNG, SVG or PDF, in light or dark theme, and show controls,
238
+ targets, angles, measurements, resets, barriers and classical conditions.
239
+
240
+ ### Interoperability
241
+
242
+ OpenQASM 3 via `hdqs.from_qasm3(source)` and `q.to_qasm3()` (requires `[qasm]`).
243
+ Optional adapters: `hdqs.to_qiskit`, `hdqs.run_aer`, `hdqs.to_pennylane`.
244
+
245
+ ## HDQS server client
246
+
247
+ The same `hdqs` name reaches the HDQS quantum server. A whole number builds the
248
+ local simulator; any other call connects to the server:
249
+
250
+ ```python
251
+ from sia import hdqs
252
+
253
+ client = hdqs(api_key="YOUR_TOKEN")
254
+ client.qbt_create(num_qubits=2)
255
+ client.qbt_run(["h 0", "cnot 0 1"])
256
+ print(client.qbt_measure([0, 1]))
257
+ ```
258
+
259
+ An API token is issued by Sia Software Innovations. The server address can be
260
+ changed without reinstalling, using the `SIA_HDQS_HOST` and `SIA_HDQS_PORT`
261
+ environment variables. If the server is unreachable, client calls raise
262
+ `hdqs.HDQSError`; the offline simulator is unaffected.
263
+
264
+ ## Entities: `ntt`
265
+
266
+ ```python
267
+ from sia import ntt
268
+
269
+ Person = ntt("name", "age").computed("group", "if (1) > 17: adult | else: minor")
270
+ p = Person("Ravi", 20)
271
+ print(p.name, p.group) # Ravi adult
272
+ ```
273
+
274
+ Templates refer to attributes by position, `(0)`, `(1)`, and so on. Conditions
275
+ and validators are evaluated through a restricted expression checker, never
276
+ `eval`.
277
+
278
+ ## Enterprise logic: `els`
279
+
280
+ ```python
281
+ from sia import els
282
+
283
+ program = """
284
+ *sia
285
+ DATA total TYPE I.
286
+ total = 40 + 2.
287
+ WRITE total.
288
+ sia*
289
+ """
290
+ print(els(program)) # 42
291
+ ```
292
+
293
+ For multi-block programs, share state with `env = els.make_env()` and call
294
+ `els(block, env)`. An interactive prompt is available through `els.repl()`.
295
+
296
+ ## Optional dependencies
297
+
298
+ | Extra | Installs | Enables |
299
+ |---|---|---|
300
+ | `torch` | PyTorch | Trainable layers, CUDA acceleration |
301
+ | `qasm` | openqasm3[parser] | OpenQASM 3 import and export |
302
+ | `plot` | Matplotlib | `draw()` and `plot()` |
303
+ | `scipy` | SciPy | Sparse observable matrices |
304
+ | `interop` | Qiskit, Qiskit Aer, PennyLane | Adapters |
305
+ | `full` | torch, qasm, plot, scipy | Everything except the adapters |
306
+ | `all` | Everything above | Everything |
307
+
308
+ A feature whose dependency is missing raises an `ImportError` naming the
309
+ package to install. `hdqs.capabilities()` reports what is available.
310
+
311
+ ## Conventions
312
+
313
+ - Qubit 0 is the most significant bit: in `'01'`, qubit 0 is `0`.
314
+ Qiskit uses the opposite order; the adapters convert automatically.
315
+ - `measure()` collapses the state; `sample()` and `probabilities()` do not.
316
+ - Memory grows exponentially with qubit count in the statevector and
317
+ density-matrix modes. A default 1 GiB budget refuses allocations that would
318
+ exceed it.
319
+
320
+ ## Licensing
321
+
322
+ sia-script is proprietary software of Sia Software Innovations Private Limited,
323
+ with one exception: the quantum simulator, `sia/hdqs_engine.py`, is released
324
+ under the MIT License. See [LICENSE.md](LICENSE.md) for the full terms of both.
325
+
326
+ ## Citation
327
+
328
+ If you use the CRIA interference-accessibility tools in research, please cite:
329
+
330
+ > Seshabattara Venkata, N. S. D. N. *Cardinality-Resolved Interference
331
+ > Accessibility in Multipartite Quantum Systems.* Zenodo (2026).
332
+ > https://doi.org/10.5281/zenodo.23180889
333
+
334
+ ## Support
335
+
336
+ Sia Software Innovations Private Limited
337
+ Email: info@siasoftwareinnovations.com
338
+ Website: https://www.siasoftwareinnovations.com