Skip to content
DocumentationPartial

Conventions, supported syntax and limits

What the Studio accepts, how states are ordered, and what the simulator does and does not model.

Qubit ordering

QSynthorium uses Qiskit's little-endian convention. Qubit 0 is the least-significant bit of a basis index, and basis kets are written |q{n−1}…q1 q0⟩. For example, applying X to qubit 0 of a 2-qubit register gives |01⟩, amplitude index 1.

Rotations and phases

RX(θ)=e−iθX/2,RY(θ)=e−iθY/2,RZ(θ)=e−iθZ/2,P(λ)=diag(1,eiλ)R_X(\theta)=e^{-i\theta X/2},\quad R_Y(\theta)=e^{-i\theta Y/2},\quad R_Z(\theta)=e^{-i\theta Z/2},\quad P(\lambda)=\mathrm{diag}(1,e^{i\lambda})

R_Z(θ) and P(θ) differ only by the global phase e^{−iθ/2}. Global phase never changes probabilities or Bloch vectors; the Studio shows amplitudes exactly as simulated, including global phase.

Supported code subset

Code is parsed, never executed. One statement per line:

  • from qiskit import QuantumCircuit, from math import pi, import numpy as np, import math
  • qc = QuantumCircuit(n) or QuantumCircuit(n, m) with 1 ≤ n ≤ 4 qubits and m ≤ 8 classical bits
  • qc.measure(qubit, clbit), qc.reset(qubit), qc.barrier() / qc.barrier(q, …)
  • qc.<gate>(params…, qubits…) for every gate in the reference, positional arguments only
  • Numeric parameter expressions with pi, np.pi, math.pi, sqrt, cos, sin, exp, + − * / **

Loops, functions, conditionals, keyword arguments, measure_all() and classically controlled gates produce an explicit, located error. The other views keep the last valid circuit until the code parses again.

Measurement and reset

Measurement is projective in the Z basis. The simulator keeps an exact ensemble of branches: each measurement splits every branch into the outcomes with non-zero probability, stores the result in the classical bit, and renormalizes the collapsed state. Reset is an unrecorded measurement followed by X on outcome 1. Unwritten classical bits read 0. Records are labelled c{m−1}…c0 like Qiskit counts.

After a measurement or reset the system can be a statistical mixture: the Math view shows the branches and the density matrix ρ = Σ pᵢ|ψᵢ⟩⟨ψᵢ|, the Bloch view shows the branch-averaged reduced state, and shot sampling follows the branches with their exact probabilities. Semantics are cross-checked against Qiskit (exact) and Qiskit Aer (sampled).

Math input

  • Catalog operator + angle + target qubit(s), inserted after the current timeline step.
  • A 2×2 complex matrix: validated for unitarity (max |U†U − I| ≤ 10⁻⁹). Catalog gates are recognized up to global phase; other unitaries are decomposed as R_Z(φ) R_Y(θ) R_Z(λ) and the decomposition is verified before insertion.
  • Non-unitary matrices are rejected; nothing is silently approximated.

Simulation model and limits

  • Ideal, noiseless, dense statevector simulation in the browser (TypeScript, double precision).
  • Studio: 1–4 qubits, up to 256 operations. Engine limit: 12 qubits (memory grows as 2ⁿ).
  • Finite-shot sampling uses a seeded PRNG (Mulberry32) and is reproducible for a given seed. Without measurements it samples the current state; with measurements it samples complete runs (classical records).
  • At most 1024 simultaneous measurement branches are tracked exactly; larger circuits are rejected with a message.
  • For multi-qubit states, each Bloch sphere shows that qubit's reduced density matrix. Entangled qubits have Bloch vectors shorter than 1.
  • Every amplitude is cross-checked against Qiskit's Statevector on a fixed set of random circuits in the automated test suite.

Files

  • Export .py — Qiskit-compatible Python generated from the circuit model.
  • Export QCIR — versioned JSON (qsynthorium.qcir, v0.1.0), validated on import.
  • Share link — the QCIR document encoded in the URL; validated when opened.