Skip to main content

SIA — Simplified Integrated Architecture

PyPI Python License

sia-script is the Python library of Sia Software Innovations Private Limited. It provides an offline quantum simulator, a client for the HDQS quantum server, a declarative entity module, and an ABAP-style enterprise logic interpreter, all behind short, chainable APIs.

from sia import hdqs

q = hdqs(2).h(0).cnot(0, 1)
print(q.sample(1000))          # {'00': ~500, '11': ~500}

One import is all a program needs.


Contents


Installation

pip install sia-script

Requires Python 3.9 or newer. The base install needs only NumPy and Requests. Optional features are installed as extras:

pip install "sia-script[torch]"     # trainable quantum layers, CUDA acceleration
pip install "sia-script[qasm]"      # OpenQASM 3 import and export
pip install "sia-script[plot]"      # circuit diagrams and state plots
pip install "sia-script[full]"      # all of the above, plus SciPy
pip install "sia-script[all]"       # everything, including Qiskit/Aer/PennyLane adapters

Components

Import What it is Needs network
from sia import hdqs Offline quantum simulator (hdqs(n)), plus the server client through the same name No (simulator)
from sia import ntt SiaNTT declarative entities with safe, AST-checked expressions No
from sia import els SIA Enterprise Logic Studio, an ABAP-style interpreter No

The simulator runs entirely on your machine. Importing sia makes no network call; only the server client contacts the HDQS server, and only when you create a client.

Quantum simulation: hdqs

Chainable circuits

Every gate returns the register, so programs stay short:

from sia import hdqs

q = hdqs(3).h(0).cnot(0, 1).cnot(1, 2)          # GHZ state
q.show_state()                                    # amplitude table
print(q.sample(1000))                             # measurement counts
print(q.estimator("ZZI")["value"])                # <ZZI> = 1.0
print(q.resources()["depth"])                     # 3

Gates: h x y z s sdg t tdg rx ry rz p u3 cnot/cx cy cz cp crx cry crz swap ccx cswap mcx, plus barrier, reset_qubit, measure and custom unitary.

Noise

Density-matrix mode supports CPTP-verified channels:

from sia import hdqs

q = hdqs.dm(2).h(0).cnot(0, 1).depolarizing(0, 0.05).amplitude_damping(1, 0.1)
print(q.purity(), q.concurrence())

noisy = hdqs(2).h(0).cnot(0, 1).with_noise("depolarizing", 0.01)   # replay with noise

Channels: bit flip, phase flip, depolarizing, amplitude damping, phase damping, generalized amplitude damping, thermal relaxation, coherent over-rotation, amplitude–phase coupling, correlated two-qubit noise, and classical readout error.

Reusable circuits and simulation modes

from sia import hdqs

theta = hdqs.Parameter("theta")
c = hdqs.Circuit(3).ry(0, theta).cx(0, 1).measure(0, "m").if_x("m", 2)
result = c.run(shots=500, bindings={"theta": 0.7}, seed=1)
print(result.counts)

big = hdqs.Circuit(100).h(0)
for i in range(99):
    big.cx(i, i + 1)
print(big.simulate(mode="stabilizer").sample(5))     # 100-qubit Clifford circuit
Mode Use for
statevector Exact pure-state simulation (default)
density_matrix Exact mixed states and noise
trajectory Sampled noise with statevector memory cost
stabilizer Large Clifford-only circuits
mps Low-entanglement circuits, with optional bond-dimension truncation

Algorithms and protocols

from sia import hdqs

print(hdqs.grover(3, ["101"])["best"])          # '101'
print(hdqs.simon("110")["recovered"])           # '110'
print(sorted(hdqs.shor_demo(15)["factors"]))    # [3, 5]
print(hdqs.teleport()["fidelity"])              # 1.0
print(hdqs.bb84(256, eavesdrop=True)["eavesdropping_suspected"])   # True

Included: Deutsch, Deutsch–Jozsa, Bernstein–Vazirani, Grover, Simon, QFT, phase estimation, order finding and a small Shor demonstration, teleportation, superdense coding, VQE, QAOA, a repetition code, and the BB84, E91 and QSS protocols (educational simulations, not production key distribution).

Analysis and mitigation

Observables and Pauli sums, sampled estimates with standard errors, Trotter evolution, entropy, concurrence, negativity, mutual information, state tomography, readout-error mitigation, zero-noise extrapolation, and CRIA interference accessibility (interference_report, interference_profile, recover_interference).

Machine learning (requires [torch])

import torch
from sia import hdqs

layer = hdqs.BackpropQuantumLayer(num_qubits=4, layers=2)
out = layer(torch.rand(8, 4, dtype=torch.float64))     # (8, 4) Pauli-Z expectations

Layers: QuantumLayer (parameter-shift gradients), BackpropQuantumLayer (autograd), MidCircuitQuantumLayer, QASMQuantumLayer, and CircuitQuantumLayer (any Circuit, including exact gradients through mid-circuit measurement).

Circuit diagrams (requires [plot])

from sia import hdqs

hdqs(3).h(0).cnot(0, 1).cnot(1, 2).draw("ghz.png", title="GHZ State")
hdqs.Circuit(2).h(0).measure(0, "m").if_x("m", 1).draw("feedforward.svg", theme="dark")

Diagrams export to PNG, SVG or PDF, in light or dark theme, and show controls, targets, angles, measurements, resets, barriers and classical conditions.

Interoperability

OpenQASM 3 via hdqs.from_qasm3(source) and q.to_qasm3() (requires [qasm]). Optional adapters: hdqs.to_qiskit, hdqs.run_aer, hdqs.to_pennylane.

HDQS server client

The same hdqs name reaches the HDQS quantum server. A whole number builds the local simulator; any other call connects to the server:

from sia import hdqs

client = hdqs(api_key="YOUR_TOKEN")
client.qbt_create(num_qubits=2)
client.qbt_run(["h 0", "cnot 0 1"])
print(client.qbt_measure([0, 1]))

An API token is issued by Sia Software Innovations. The server address can be changed without reinstalling, using the SIA_HDQS_HOST and SIA_HDQS_PORT environment variables. If the server is unreachable, client calls raise hdqs.HDQSError; the offline simulator is unaffected.

Entities: ntt

from sia import ntt

Person = ntt("name", "age").computed("group", "if (1) > 17: adult | else: minor")
p = Person("Ravi", 20)
print(p.name, p.group)          # Ravi adult

Templates refer to attributes by position, (0), (1), and so on. Conditions and validators are evaluated through a restricted expression checker, never eval.

Enterprise logic: els

from sia import els

program = """
*sia
  DATA total TYPE I.
  total = 40 + 2.
  WRITE total.
sia*
"""
print(els(program))             # 42

For multi-block programs, share state with env = els.make_env() and call els(block, env). An interactive prompt is available through els.repl().

Optional dependencies

Extra Installs Enables
torch PyTorch Trainable layers, CUDA acceleration
qasm openqasm3[parser] OpenQASM 3 import and export
plot Matplotlib draw() and plot()
scipy SciPy Sparse observable matrices
interop Qiskit, Qiskit Aer, PennyLane Adapters
full torch, qasm, plot, scipy Everything except the adapters
all Everything above Everything

A feature whose dependency is missing raises an ImportError naming the package to install. hdqs.capabilities() reports what is available.

Conventions

  • Qubit 0 is the most significant bit: in '01', qubit 0 is 0. Qiskit uses the opposite order; the adapters convert automatically.
  • measure() collapses the state; sample() and probabilities() do not.
  • Memory grows exponentially with qubit count in the statevector and density-matrix modes. A default 1 GiB budget refuses allocations that would exceed it.

Licensing

sia-script is proprietary software of Sia Software Innovations Private Limited, with one exception: the quantum simulator, sia/hdqs_engine.py, is released under the MIT License. See LICENSE.md for the full terms of both.

Citation

If you use the CRIA interference-accessibility tools in research, please cite:

Seshabattara Venkata, N. S. D. N. Cardinality-Resolved Interference Accessibility in Multipartite Quantum Systems. Zenodo (2026). https://doi.org/10.5281/zenodo.23180889

Support

Sia Software Innovations Private Limited
Email: info@siasoftwareinnovations.com
Website: https://www.siasoftwareinnovations.com

Metadata

Release files for sia-script 1.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sia-script 1.5.2
File Size Uploaded
sia_script-1.5.2.tar.gz 131.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sia-script 1.5.2
File Interpreter ABI Platform
sia_script-1.5.2-py3-none-any.whl Python 3 none any Details

Total release size: 259.4 kB

Release files / sia_script-1.5.2.tar.gz

Download URL sia_script-1.5.2.tar.gz
Size 131.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b60beb81277e689cdaedb275ba47a652120851152a9ffcf826195a5db261e740
BLAKE2b-256 checksum
How to use checksums
65630a9441e35d0286a1aad5c84da05a0c06ae8b18356dd9fa35ddd8f30c9ba4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.4

Release files / sia_script-1.5.2-py3-none-any.whl

Download URL sia_script-1.5.2-py3-none-any.whl
Size 128.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58c5e0ab5ff5c50a8c1ee53076caf573f5b137306f3f01e7e6ba5818f6375aa1
BLAKE2b-256 checksum
How to use checksums
c94635c150bec786dd5370f735d3df1e392f58cfd4b2a1be23f8ca8d8e165148
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.4

Release history Release notifications | RSS feed

1.5.7

2 release files

1.5.6

2 release files

1.5.5

2 release files

1.5.4

2 release files

1.5.3

2 release files

This release

1.5.2 This release

2 release files

1.5.1

2 release files

1.3.0

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.0

2 release files

0.8.7

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.9

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page