All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
MR,MRX, andMRYno longer double-count their measurement flip probability as both a pre-measurement Pauli error and a measurement-result flip.- Fixed a bug where
M(p)instructions incorrectly flipped the qubit, not just the measurement record. This would affect circuits where qubits were measured and not immediately reset. - Fixed a bug where
MR !qinstructions (with measurement record inversion) produced wrong measurement results. - Out-of-order
OBSERVABLE_INCLUDEindices now produce the correct sampler column order and output shape. Missing indices below the maximum mentioned id appear as deterministic-zero columns, and columns are emitted in sorted logical-index order. matmul_gf2no longer silently corrupts parity for inner products with more than 255 set bits. The float32→uint8 cast in JAX saturates at 255, which previously made% 2always return 1 once a row-sum reached 256. The modulo is now applied on float32 before the uint8 cast.CompiledDetectorSampler.samplenow raisesValueErrorwhenseparate_observables=Trueis combined withprepend_observables=Trueorappend_observables=True(matching Stim). Previously these combinations silently dropped observable columns. Theprepend_observables=True+append_observables=Truecombination is now supported and returns columns in[obs, det, obs]order, matching Stim.OBSERVABLE_INCLUDEwith Pauli targets (e.g.OBSERVABLE_INCLUDE(0) X1) now raisesValueErrorinstead of silently producing wrong observable bits or crashing withIndexError. tsim only supports measurement-record targets (rec[-k]).- Empty
DETECTORandOBSERVABLE_INCLUDEannotations (without targets) no longer crash the parser; they now produce zero detector/observable bits, matching Stim semantics. CompiledDetectorSampler.samplewithuse_detector_reference_sample=Trueoruse_observable_reference_sample=Trueno longer returns fewer rows thanshotswhen called with an explicitbatch_sizethat exactly dividesshots.- Incorrect visualization of
CORRELATED_ERRORandELSE_CORRELATED_ERRORinstructions in thepyzxdiagram renderer. Previously, error vertices were rendered as classical spiders instead of bold quantum spiders. - Sweep-bit targets (e.g.
CX sweep[0] 1) were silently parsed as unconditional gates. The parser now raisesNotImplementedError, since sweep parameters are not supported by Tsim.
TPPandTPP_DAGinstructions — applies exp(-i pi/8 P) or exp(+i pi/8 P) (up to global phase) for a Pauli product P, i.e., phases the -1 eigenspace of P by exp(i pi/4) or exp(-i pi/4).Circuit.is_cliffordnow supportsREPEATblocks.
DEPOLARIZE2channel was missing thep_ZZprobability term, which was always set to 0. This lead to incorrect noise models that were missing ZZ errors. (#103)- Samplers now gracefully handle circuits with no measurements or no detectors, returning empty
(shots, 0)arrays matching stim's behavior instead of raising an error (#106) MPP, MXX, MYY, MZZinstructions now support a bit flip probability argument (#118)
- Zoomable timeline and timeslice diagrams.
Circuit.diagramnow accepts azoomableoption, enabled by default, to support pan and zoom in notebooks for thetimeline-svgandtimeslice-svgdiagram types (#116) HERALDED_PAULI_CHANNEL_1andHERALDED_ERASEnoise channel instructions with herald bit indicating whether the noise event occurred (#107)CXSWAP,CZSWAP,SWAPCX,SWAPCZtwo-qubit gate instructions (#105)C_NXYZ,C_XNYZ,C_XYNZ,C_NZYX,C_ZNYX,C_ZYNXaxis-cycling gate variants with negated axes (#105)H_NXY,H_NXZ,H_NYZHadamard-like gate variants with negated axes (#105)IItwo-qubit identity instruction that acts trivially (#105)
I_ERROR,II_ERROR, andQUBIT_COORDSinstructions now allocate qubit lanes instead of being silently skipped (#105)
- Exact scalar reduction during sum/product operations to prevent underflows/overflows of int32 on large diagrams. Unfortunately, this change comes with a 2x performance overhead, but results in more stable numerical results (#93)
- Normalization issues for circuits with arbitrary rotation gates now raise a warning instead of an error (#91)
- Parsing errors for invalid Stim circuits now raise useful exceptions (#91)
SPPandSPP_DAGinstructions — generalized S gate that phases the -1 eigenspace of Pauli product observables by i or -i. Supports multi-qubit Pauli products and inverted targets (#97)MXX,MYY,MZZtwo-qubit parity measurement instructions, delegating to existing MPP infrastructure. Also addsII_ERRORsupport (#96)MPADinstruction for padding the measurement record with fixed bit values (#95)
- Improved stabilizer decomposition strategies. When compiling a sampler, you can now choose between three different strategies:
"cat5","bss", and"cutting". The default is"cat5"and applies to T and arbitrary rotations; see arxiv.org/abs/2106.07740 (#77) - Sparse geometric channel sampler for noise modeling based on this repo. This significantly improves performance when the stabilizer rank is low. (#64)
Circuit.appendmethod for programmatic circuit construction (#65)Circuit.is_cliffordproperty and automatic replacement of U3 gates with Clifford equivalents for pi/2 rotations (#69)- Improved
pyzxvisualization. Now doubled ZX notation is used when using the"pyzx"argument inCircuit.diagram, which is a technically accurate depiction of the quantum circuit (#86) - Automatic batch size selection based on available memory (#84)
- Tsim now uses
pyzx-param==0.9.3which fixes a bug where diagrams were not fully reduced in the absence of noise - Tsim will now make sure that marginal probabilities are normalized and raise an error if they are not. Wrong normalization can be the result of rare underflow errors that will be addressed in a future release (#87)
- Use BLAS matmul kernel for tensor contractions (#63)
- Circuit flattening deferred to ZX graph construction time (#71)
- White background for SVG plots, which are now readable in dark mode (#85)
- Initial release
- Clifford+T circuit simulation via stabilizer rank decomposition
- Stabilizer decomposition backend based on pyzx and the paramzx-extension by (2025) M Sutcliffe and A Kissinger
- Support for most Stim instructions
T,T_DAG,R_Z,R_X,R_Y, andU3instructions- Arbitrary rotations gates via magic cat state decomposition from Eq. 10 of (2021) Qassim et al.
- GPU acceleration via jax
- Documentation and tutorials