Recent Releases of stim
stim - v1.15.0 - Terror of the Tag
Flagship changes:
- Circuit and detector error model instructions can now be tagged with free-form text.
- Example use: note the desired hardware implementation of a two qubit gate (
CX[adiabatic] 0 1) - Example use: note the subgraph of a detector (
DETECTOR[subgraph=X,color=red] rec[-1] rec[-2])
- Example use: note the desired hardware implementation of a two qubit gate (
OBSERVABLE_INCLUDEcan now be given Pauli targets, to artificially start/end correlation sheets.- Example use: describe an experiment verifying RX-then-MZ produces unbiased random results
- Example use: keep observables away from the arbitrary rotation in a magic state injection circuit
Notable changes:
- Added method
stim.Circuit.reference_detector_and_observable_signs - Added method
stim.Circuit.solve_flow_measurements - Added method
stim.Circuit.without_tags - Added method
stim.CircuitErrorLocation.noise_tagproperty - Added method
stim.DetectorErrorModel.without_tags - Added method
stim.FlipSimulator.generate_bernoulli_samples - Added method
stim.FlipSimulator.to_numpy - Added method
stim.Flow.__mul__ - Added property
stim.CircuitInstruction.tag - Added property
stim.CircuitRepeatBlock.tag - Added property
stim.CircuitTargetsInsideInstruction.tag - Added property
stim.CircuitRepeatBlock.tag - Added property
stim.DemInstruction.tag - Added property
stim.Flow.included_observables - Added argument
stim.Flow.__init__(..., included_observables=None) - Added argument
stim.Circuit.append(..., tag: str = "") - Added argument
stim.DetectorErrorModel.append(..., tag: str = "") stim.Circuit.appendnow allows targets of typestim.PauliString(for gates likeMPP)stim.Circuit.appendcan now be given astim.Circuit- The stim circuit file format now allows specifying tags (e.g.
CX[custom_tag] 0 1) - The stim detector error model format now allows specifying tags (e.g.
error[custom_tag](0.1) D0 L0) -
stim.Tableau.from_state_vectorno longer requires its input to be normalized stim.DetectorErrorModel.appendcan now be given astim.DetectorErrorModel- Added wheel packages for sinter and stimcirq
- Added python 3.13 builds for linux and osx
- The
sinter.Decoderbase class now auto-implementsdecode_via_filesif a child implementscompile_decoder_for_dem - Gates documentation now includes MBQC decompositions
New gates:
- Added
C_NXYZgate - Added
C_XNYZgate - Added
C_XYNZgate - Added
C_NZYXgate - Added
C_ZNYXgate - Added
C_ZYNXgate - Added
H_NXYgate - Added
H_NXZgate - Added
H_NYZgate (the final single qubit Clifford needed to have all 24!) - Added
IIgate - Added
I_ERRORgate - Added
II_ERRORgate
Bug fixes:
- Fixed
stim.Circuit.to_tableauignoringSPPandSPP_DAG - Fixed stimcirq failing to round trip circuits using MR (such as stim's example circuits)
- Fixed
stim.Circuit.detecting_regionsnot raising an exception for anticommutations at the start of the circuit - Fixed
stim.Circuit.diagram("detslice")not showing anticommutations at the start of the circuit - Fixed various
stim.FlipSimulatorquery methods refusing to accept negative indices - Fixed
stim.Tableau.iter_all(0)segfaulting - Fixed
stim.Flow.__init__not xor-sorting its measurements to make them unique - Fixed sinter's
max_batch_sizeconfiguration option being ignored
Special thanks to this release's contributors:
@mhucka @caryan @m-mcewen @yuewuo @drqec
- C++
Published by Strilanc about 1 year ago
stim - v1.14.0 - More Flows
Flagship changes:
- Added
stim.Circuit.flow_generatorsfor finding the stabilizer flows of a circuit. - Added
stim.Circuit.time_reversed_for_flowsfor reversing circuits containing resets and measurements. - Added
sinter.Samplerfor customizing sinter to more general Monte Carlo sampling tasks.
Notable changes:
- Added
stim.Circuit.flow_generators - Added
stim.Circuit.insert - Added
stim.Circuit.pop - Added
stim.Circuit.time_reversed_for_flows - Added
stim.Circuit.to_crumble_url - Added
stim.Circuit.to_quirk_url - Added
stim.CircuitInstruction.num_measurements - Added
stim.CircuitInstruction.target_groups - Added
stim.CircuitRepeatBlock.num_measurements - Added
stim.DemInstruction.target_groups - Added
stim.FlipSimulator.clear - Added
stim.FlipSimulator.copy - Added
stim.GateData.hadamard_conjugated - Added
stim.GateData.is_symmetric_gate stim.CompiledDetectorSampler.samplegainedobs_out=Noneanddets_out=Noneargumentsstim.Circuit.to_crumble_urlgainedskip_detectors=Falseandmark=Noneargumentsstim.CircuitInstruction.__init__gained the ability to parse single lines from a stim circuit filestim.DemInstruction.__init__gained the ability to parse single lines from a detector error model filestim.DemTarget.__init__gained the ability to parse targets from detector error mode files (e.g.stim.DemTarget("D2"))- In stim's gate data, the generalized inverse of
R{X,Y,Z}is nowM{X,Y,Z}instead ofMR{X,Y,Z} - Added support for viewing and editing detectors and observables in crumble
- Reduced the amount of copying during sampling, speeding up detector sampling by around 25%
- Began collecting papers with available stim circuits at doc/circuitdatareferences.md
Notable changes to diagrams:
stim.Circuit.diagramgained arows=Noneargument, for controlling layout- Added "tick #" labels to timeslice diagrams
- Improved
stim.Circuit.detector_error_modelerror messages to suggest code for drawing a diagram of the problem - Match graph diagrams now highlight observable-flipping hyper errors (purple instead of blue)
- In match graph diagrams, nodes with observable-crossing boundary edges are now colored red instead of black
- The detector indicator in 3d match graph diagrams is not flat anymore, so it's easier to see from all angles
stim.Circuit.diagram("detslice")now draws a pink circle where bad detectors anticommute with dissipative operations, instead of raising an exception- Added
-htmlvariants of svg diagrams (e.g.circuit.diagram("detslice-html")- Outputs a little HTML viewer of the svg diagram, with a resizing tab, which works better in notebooks than a raw SVG
- detslice diagrams no longer raise an exception for circuits with anticommuting detectors. Instead, a diagram highlighting the anticommutation is returned.
- Improved the heuristics for using Bezier curves instead of straight lines
Notable changes to sinter:
- Added
sinter.Sampler - Added
sinter.CompiledSampler - Added named sinter sampler
perfectionist - Any sinter decoder can now indicate shots to discard, by adding an extra byte column to the returned observable data (0=keep, else=discard)
sinter collectnow distributes workers evenly over tasks, instead of focusing on one task at a timesinter collectnow never switches a worker to a new task until their current task is done- Added
sinter plot --point_label_funccommand line argument - Added
sinter plot --dpifor increasing resolution of plots - Expanded
sinter plot --group_functo take dictionary arguments- The
"color"key of the dictionary controls color groups - The
"linestyle"key of the dictionary controls linestyle groups - The
"marker"key of the dictionary controls marker groups - The
"label"key of the dictionary controls labels of curves in the legend - The
"sort"key of the dictionary controls order of curves in the legend
- The
sinter collect --processesnow defaults to"auto"(number of CPUs) if not specifiedsinter plot --showis now implied when--outisn't specified- Added
sinter plot --preprocess_stats_funcfor specifying a python expression to process stats before plotting - Added
sinter.TaskStats.with_edits - Added a safety check to
sinter.TaskStats.__add__, raising an exception if decoder/json_metadata disagree despite strong ids agreeing - Added supported decoder
"hypergraph_union_find" - Added supported decoder
"mw_parity_factor"
Notable bug fixes:
- Fixed
HERALDED_PAULI_CHANNEL_1permuting X/Y/Z/ error channels 😱😱😱 - Fixed various internal methods not correctly propagating Pauli terms through
MXX,MYY, andMZZinstructions that operated on the same qubit more than once 😱 - Fixed
stim.Circuit.with_inlined_feedbackincorrectly ordering operations fused by the removal of a feedback operation - Fixed
stimcirq.cirq_circuit_to_stim_circuitnot addingTICKs from multi-momentCircuitOperationblocks - Fixed
MPADtargets counting towardsstim.Circuit.num_qubits - Fixed
stim.PauliString.{before,after}not supportingSPPandSPP_DAG - Fixed
stim.PauliString.beforerefusing to cross reset gates - Fixed sinter failing to create plots for data points with extremely large shot counts
- Fixed
stim.Tableau.from_stabilizerserror messages claiming stabilizers were redundant when they actually anticommuted - Fixed incompatibility with numpy v2
- Fixed incompatibility with new version of scipy (the linear regression type moved)
- C++
Published by Strilanc over 1 year ago
stim - v1.13.0 - Freed Flows
Flagship changes:
- Added support for representing and verifying stabilizer flows (
stim.Flow,stim.Circuit.has_flow,stim.Circuit.detecting_regions)
Notable changes:
- New top-level methods/types:
- Added
stim.Flowclass for representing stabilizer flows - Added
stim.target_pauli - Added
stim.target_combined_paulis - Added
stim.PauliStringIterator
- Added
- New
stim.Circuitmethods:- Added
stim.Circuit.decomposed - Added
stim.Circuit.detecting_regions - Added
stim.Circuit.to_qasm - Added
stim.Circuit.has_flow - Added
stim.Circuit.has_all_flows - Added
stim.Circuit.shortest_error_sat_problem - Added
stim.Circuit.likeliest_error_sat_problem
- Added
- New
stim.GateDatamethods:- Added
stim.GateData.{__eq__,__ne__,__repr__,__init__,__str__} - Added
stim.GateData.flows - Added
stim.GateData.generalized_inverse - Added
stim.GateData.inverse
- Added
- New
stim.PauliStringmethods:stim.PauliString.__init__now allows sparse syntax (likestim.PauliString("-X50*Z99"))- Added
stim.PauliString.iter_all - Added
stim.PauliString.pauli_indices - Added
stim.PauliString.weight - Sped up
stim.PauliString.{after,before}by over 10x
- New
stim.Tableaumethods:- Added
stim.Tableau.to_circuit("graph_state") - Added
stim.Tableau.to_circuit("mpp_state") - Added
stim.Tableau.to_circuit("mpp_state_unsigned") - Added
stim.Tableau.to_stabilizers - Sped up
stim.Tableau.from_stabilizersby over 200x
- Added
- New
stim.FlipSimulatormethods:- Added
stim.FlipSimulator.broadcast_pauli_errors
- Added
- New gates:
- Added
CZSWAPgate (with aliasSWAPCZ) - Added
SPPgate (generalized S gate that applies to Pauli products) - Added
SPP_DAG(inverse ofSPP)
- Added
- Added
sinter.FusionBlossomCompiledDecoder, speeding up decoding with fusion blossom - Added
sinter plot --ymaxcommand line argument - stimcirq now converts
PAULI_CHANNEL_2into cirq's native asymmetric channel - Added
Bloch Rotation (Euler angles)to gate documentation - Added prebuilt wheels for python 3.12
- Tweaked
sinter plot's marker/color ordering to increase how many curves are needed to get two curves that look similar
Notable bug fixes:
- Fixed
sinter plot --xaxisonly applying to one subplot, instead of all subplots - Fixed build-from-source not working on IBM PowerPC
- Fixed
HERALDED_PAULI_CHANNEL_1targeting the wrong qubits (this fix was also backported to 1.12.1) - Fixed
stim.Circuit.explain_dem_errorsnot supporting all gates - Fixed crumble not allowing
eandqto repeatedly move between layers when held down - Fixed crumble not falling back to an emulated clipboard when clipboard permissions weren't granted
Special thanks to this release's contributors:
@fdmalone @markturner289 @mmcewen-g @nickdgardner @noajshu @tomirendo
- C++
Published by Strilanc about 2 years ago
stim - v1.12.1 - Fix HERALDED_PAULI_CHANNEL_1
Notable changes:
- Add python 3.12 to the versions with prebuilt wheels
Bug fixes:
- Fixed
HERALDED_PAULI_CHANNEL_1targeting fixed indices instead of the given qubits- For example,
HERALDED_PAULI_CHANNEL_1(0.1) 2 5 3was behaving likeHERALDED_PAULI_CHANNEL_1(0.1) 0 1 2
- For example,
- C++
Published by Strilanc over 2 years ago
stim - v1.12.0 - Foreseen Flips
Flagship changes:
- Added support for heralded erasures
- Added
stim.FlipSimulatorfor tracking batches of Pauli flips through circuits - Doubled sinter's sample throughput on high core count machines
Notable changes to stim:
- Added gates:
HERALDED_ERASE,HERALDED_PAULI_CHANNEL_1,MXX,MYY,MZZ,MPAD - Added top-level method
stim.gate_data - Added class
stim.GateData- Properties:
aliases,is_noisy_gate,is_reset,is_single_qubit_gate,is_two_qubit_gate,is_unitary,name,num_parens_arguments_range,produces_measurements,tableau,takes_measurement_record_targets,takes_pauli_targets,unitary_matrix
- Properties:
- Added class
stim.FlipSimulator- Methods:
__init__,do,get_detector_flips,get_measurement_flips,get_observable_flips,peek_pauli_flips,set_pauli_flip - Properties:
batch_size,num_detectors,num_measurements,num_observables,num_qubits
- Methods:
- Added
stim.Circuit.count_determined_measurements - Added
stim.Circuit.num_ticks - Added
stim.Circuit.reference_sample - Added
stim.CircuitRepeatBlock.name(for duck typing vsstim.CircuitInstruction) - Added
stim.DemRepeatBlock.type(for duck typing vsstim.DemInstruction) - Added
stim.GateTarget.pauli_type - Added
stim.GateTarget.qubit_value - Added
stim.TableauSimulator.postselect_observable - Added optional
reference_sampleargument tostim.Circuit.compile_sampler - Made
stim.PauliString.{after,before}much less picky - Improved performance of
stim.CompiledDetectorSamplerby ~30% under repetitive usage by caching more internal objects - Circuit-to-dem conversion now adds the probabilities of indistinguishable cases within a disjoint error channel, instead of Bernoulli-adding them
- Added the
stim convertcommand for converting between shot file formats
Notable changes to sinter:
- sinter now has an API reference
- sinter now has a command line reference
- Added
sinter.Decoder.compile_decoder_for_demmethod for custom decoders to implement- Improves performance ~2x on high core count machines by avoiding disk usage
- Added a shorthand to
sinter plot: usem.keyinstead ofmetadata.get("key", None)in*_funcarguments - Added square root scales to
sinter plot(example:--xaxis "[sqrt]qubit count") - Added an optional
custom_countscolumn to sinter's CSV format - Added
autooption to use all processes (sinter collect --processes=auto) - Added
sinter plot --line_fits - Added
sinter plot --xmax - Added
sinter plot --xmin - Added
sinter plot --failure_values_func - Added
sinter plot --subtitlewith{common}macro - Added
sinter collect --count_detection_events - Added
sinter collect --count_observable_error_combos - Added
sinter collect --allowed_cpu_affinity_ids - Added
sinter combine --strip_custom_counts - Added
sinter plot --custom_error_count_keys - Added
sinter.log_binomial - Added
sinter.log_factorial - Added
sinter.read_stats_from_csv_files - Added
sinter.{AnonTaskStats,TaskStats}.custom_counts - Added
sinter.Task.circuit_pathfield for specifying circuits by filepath - Added arguments
count_observable_error_combos=Falseandcount_detection_events=Falsetosinter.{iter_collect,collect}
Notable changes to crumble:
- Added support for MPP operations
- Added example circuits
Notable bug fixes
- Fixed
stimcirq.__version__andsinter.__version__not existing - Fixed
stimcirq.cirq_circuit_to_stim_circuitchoking on tagged operations - Fixed
stimcirq.cirq_circuit_to_stim_circuitnot putting repeat blocks in their own moment - Fixed triggering numpy
bool8deprecation warnings - Fixed documentation not mentioning how to do pauli feedback
- Fixed a failure in
stim m2drelated to appending observables crossing a simd boundary when--obs_outwas used - Fixed some corner cases where
sinter.better_sorted_str_termsproduced incomparable values - Fixed
cmake installdoing nothing - Fixed some
sinter plotcrashes on degenerate data - Fixed several sinter classes not having evaluatable reprs
- Fixed
stim.Tableau.inversereturning invalid results when the tableau's representation included size padding - Fixed HTML diagrams not being isolated from each other in notebooks (wrapped them all in iframes)
- Fixed
stimzxexample project discarding sign information of external stabilizers - Fixed
stim.Circuit.shortest_graphlike_errorand friends not working if there were more than 64 observables
Special thanks to this release's contributors:
@AlexBourassa @fdmalone @markturner289 @oon3m0oo @viathor @justinledford
- C++
Published by Strilanc almost 3 years ago
stim - v1.11.0 - Dancing Diagrams
Major changes:
- Added prototype
interactivatediagrams for circuits. See the crumble README.
Breaking changes:
stim.DetectorErrorModel.shortest_graphlike_errornow defaultsignore_ungraphlike_errorsto True instead of False. Also, it now actually ignores all ungraphlike errors when set to True.
General additions and improvements:
- Added a new gate:
CXSWAP(andSWAPCX). This gate is KAK-equivalent to the ISWAP, but avoids mixing X and Z terms, which is useful when creating/debugging circuits intended to use ISWAP-like interactions. - Added a new diagram type
"interactive". Interactive diagrams are a HTML pages containing "crumble". - Added
stim.Circuit.inverse - Added
stim.Circuit.with_inlined_feedback - Added
stim.TableauSimulator.measure_pauli_string - Gave the project a logo
- Simplified the names of diagram types (the old names still work but are no longer listed in documentation)
- Added
separate_observables=Falseargument tostim.read_shot_data_file - Added
unsigned=Falseargument tostim.PauliString.from_unitary_matrix - Added
stim.Tableau.x_sign,stim.Tableau.y_sign,stim.Tableau.z_signhelper methods - Added
stim.TableauSimulator.depolarize1,stim.TableauSimulator.depolarize2,stim.TableauSimulator.x_error,stim.TableauSimulator.y_error,stim.TableauSimulator.z_error - Added a
--ran_without_feedbackcommand line option tostim m2d - Added
stim.PauliString.before,stim.PauliString.after
Diagram improvements:
- Detector slice diagrams now use colors that are more color-blind friendly
- Added new diagram type
detslice-with-ops-svgwhich overlays operations over the detector slice diagram - The
typeargument for.diagrammethods is no longer keyword-only - The
tickargument for.diagrammethods can now be set to arange(start, end), producing a diagram containing each tick in the range as a sub-diagram - Detector slice diagrams now prefer shapes that have mirror symmetry, when choosing how to draw a stabilizer
- Detector slice diagrams now switch to using bezier curves when stroking between colinear points, to disambiguate which points are vertices and which points are skipped
- Increased the initial size used for the 3d model viewer and the svg viewer
- Improved the initial camera position used by the 3d model viewer to better frame the model
- Increased the font sizes used for gates in SVG diagrams, so they better fill their boxes
- Detector slice diagrams can now be filtered by
stim.DemTarget(to slice observables in addition to detectors, include observable targets in the filter) - SVG diagrams now group elements, making them easier to touch up afterwards in image editors
Sinter improvements:
- Added
--postselected_detectors_predicatetosinter collect, generalizing--postselect_detectors_with_non_zero_4th_coord - It's now possible to specify custom decoders
- Added
sinter.Decoderclass - Added a
custom_decodersarg tosinter.collect,sinter.iter_ollect,sinter.predict_on_disk,sinter.predict_observables_bit_packed - Added a
--customer_decoders_module_functioncommand line argument tosinter collect
- Added
sinter predictcan now be given--metadata_func autoinstead of--metadata_func "sinter.comma_separated_key_values(path)"- Added command line arguments to
sinter plot:--y_func--y_axis- The expression given to
--plot_args_funcnow has access to several more values:stat,stats,decoder, metadata, andstrong_id`. - The
plot_args_funcargument ofsinter.plotmethods can now take a third argument,stats, the list of stats in the curve
- Discard rate diagrams now include more Y axis indicators
sinter combinenow sorts its output- Added
--order preserve|metadata|erroroption tosinter combine
Bug fixes:
- Due to a mysterious crash in collab, the AVX build has been temporarily disabled.
- Fixed generating degenerate diagrams when circuits had no coordinate data
- Fixed
stimcirq.StimSamplernot working on cirq circuits containing repeated keys - Fixed
stimcirq.SweepPauli._resolve_parameters_failing to resolve strings, and not specifying_parameter_names_ - Fixed a typo in
stim.PauliString's documentation. The allowable signs are [1, -1, 1j, -1j]. - Fixed a quadratic overhead caused by iteratively growing the tableau simulator's state
- Fixed sinter crashing on shutdown on windows, due to not waiting for workers to die before deleting their files
- Fixed sinter ignoring error codes returned from pymatching.
- Fixed
stim.Tableau.from_stabilizersnot verifying that the given stabilizers actually commute - Related: pymatching fixed a bug where it was linking an older version of stim that opened binary files in text mode, causing sinter to fail when using pymatching on windows.
- C++
Published by Strilanc over 3 years ago
stim - v1.10.0 - Inviting Interop
Flagship changes:
- Use open source decoders that are 100x to 1000x faster than before! (pymatching v2 and fusion_blossom)
- Produce 2d and 3d diagrams of circuits and detector error models, with built-in viewers for Jupyter notebooks!
- Sample directly from detector error models. Record the errors that occurred, edit them, and play them back!
Notable changes:
- Added
stim.Circuit.diagram- Added diagram type
"detector-slice-text" - Added diagram type
"detector-slice-svg" - Added diagram type
"match-graph-svg" - Added diagram type
"match-graph-3d" - Added diagram type
"match-graph-3d-html" - Added diagram type
"timeline-text" - Added diagram type
"timeline-svg" - Added diagram type
"timeline-3d" - Added diagram type
"timeline-3d-html"
- Added diagram type
- Added
stim.DetectorErrorModel.diagram- Added diagram type
"match-graph-svg" - Added diagram type
"match-graph-3d" - Added diagram type
"match-graph-3d-html"
- Added diagram type
- Added methods to
stim.PauliString:stim.PauliString.from_numpystim.PauliString.from_unitary_matrixstim.PauliString.to_numpystim.PauliString.to_tableaustim.PauliString.to_unitary_matrix
- Added methods to
stim.TableauSimulator:stim.TableauSimulator.__init__now has an optionalseedargumentstim.TableauSimulator.set_state_from_stabilizersstim.TableauSimulator.set_state_from_state_vectorstim.TableauSimulator.donow acceptsstim.CircuitInstructionandstim.CircuitRepeatBlock
- Added methods to
stim.Tableau:stim.Tableau.iter_allstim.Tableau.from_circuitstim.Tableau.from_numpystim.Tableau.from_stabilizersstim.Tableau.from_state_vectorstim.Tableau.from_unitary_matrixstim.Tableau.to_circuitstim.Tableau.to_numpystim.Tableau.to_pauli_stringstim.Tableau.to_state_vector
- Added methods to
stim.DetectorErrorModel:stim.DetectorErrorModel.flattenedstim.DetectorErrorModel.roundedstim.DetectorErrorModel.compile_sampler
- Added
stim.CompiledDemSamplerclass with methods:stim.CompiledDemSampler.samplestim.CompiledDemSampler.sample_write
- Improvements to
sinter- Added support for pymatching v2
- Added support for fusion_blossom decoder
- Added flag
--titletosinter plot - Added flag
--minytosinter plot - Added flag
--plot_args_functosinter plot - Added flag
--failure_units_per_shot_functosinter plot - Added flag
--failure_unit_nameargument tosinter plot - Added grid lines to the plots made by
sinter plot - Added
filter_func,failure_units_per_shot_func, andfailure_unit_namearguments tosinter.plot_error_rateandsinter.plot_discard_rate - Added
sinter.predict_observablesmethod - Added ability to discard shots based on observables being mispredicted
- Added
--postselected_observables_predicateflag tosinter collect - Added
sinter.Task.postselected_observables_maskfield - Added
postselected_observable_maskargument tosinter.sample_decode
- Added
- Added
stim diagramcommand for producing diagrams, with flags--in,--type,--out,--tick,--remove_noise,--filter_coords. - Added
stim sample_demcommand for directly sampling from detector error model files, with flags--err_out,--err_out_format,--in,--obs_out,--obs_out_format,--out,--out_format,--replay_err_in,--replay_err_in_format,--seed,--shots,--err_out,--err_out_format,--replay_err_in,--replay_err_in_format. - Added
separate_observables=Falseargument tostim.CompiledDetectorSampler.sample - Added
bit_packed=Falseargument tostim.CompiledDetectorSampler.sample - Added
bit_packed=Falseargument tostim.CompiledMeasurementSampler.sample - Deprecated
stim.CompiledDetectorSampler.sample_bit_packed - Deprecated
stim.CompiledMeasurementSampler.sample_bit_packed
Notable bug fixes:
- Fixed
stim.Circuit.flattenednot fusing all operations - Fixed
stim.Circuit.without_noisenot fusing all operations - Fixed
PAULI_CHANNEL_2not being marked as targeting pairs of qubits - Fixed sinter's internal python files not being marked as private, so they don't appear as autocomplete suggestions
- Fixed
stim.Circuit.detector_error_modelfailing when errors affected more than 15 detectors (unless decompose_errors=True) - Fixed
stim.Circuit.without_noisenot making independent copies of the operations (!) - Fixed sinter only sampling using the first decoder given to it, instead of all decoders, when given multiple decoders
- Fixed not redirecting stdout and stderr to python's when calling
stim.main - Fixed unnecessary overhead in the conversion to/from numpy arrays (10x faster for small arrays)
- Fixed a segfault and bad parsing logic in
stim.read_shot_data_file(!). Fuzz tested the read/write methods against the python reference methods to avoid this happening again.
Notable dev changes:
- Fixed files being opened in text mode instead of binary mode, resulting in bad parsing/serialization on Windows due to \n bytes being turned into \r\n and vice versa.
- Templatized classes like
simd_wordso AVX and SSE code can coexist in the same binary - Added
stim_python_bindingscmake target - The cmake build now uses file lists which can be regenerated using a script
- Added
dev/directory for scripts - File lists used by cmake are now generated automatically instead of maintained manually
- The polyfill simd_word that uses 64 bit words now only uses one word instead of two (reducing padding overhead)
- To allow supporting a larger variety of decoders, sinter no longer includes each decoder in its requirements. Decoders need to be installed separately to use them.
- Added
-fPICtolibstimcmake target - Sinter now passes most information via the disk instead of through the multiprocessing API. This reduced the workload on the manager and the startup costs of batches, but made it much more disk limited on high core count machines.
- The API reference no longer shows deprecated methods (these methods are still listed in the .pyi stubs file)
- All doc strings now wrap at 80 characters, and this is enforced by continuous integration.
- The command line reference documentation has been substantially improved (e.g. flag information now grouped with the command instead of separate)
- Added python 3.11 support and OSX ARM support to the set of prebuilt wheels
- C++
Published by Strilanc over 3 years ago
stim - v1.9.0 - Sintered Samples
Flagship changes:
- Released
sinter, which uses stim and pymatching to perform multicore Monte Carlo sampling of error correction circuits. - Added a python stub file (
stim/__init__.pyi) to improve autocompletion in IDEs.
Breaking changes:
- The
"ptb64"format now requires the shot count to be a multiple of 64, both when reading and when writing. (Previously, missing shots resulted in padding with zero'd data, which created a very easy way to get bad data when reading if the number of shots was not known.) - The default value of
stim.Circuit.shortest_graphlike_error's argumentignore_ungraphlike_errorshas changed from fromFalsetoTrue. (Setting it toFalsecan use "remnant edges" that only appear as components of decomposed errors, and so do not correspond to a single physical error mechanism.)
Notable changes:
- New global methods:
stim.mainstim.read_shot_data_filestim.write_shot_data_file
- New
stim.DetectorErrorModelmethods:stim.DetectorErrorModel.to_filestim.DetectorErrorModel.from_file
- New
stim.Circuitmethods:stim.Circuit.without_noisestim.Circuit.flattenedstim.Circuit.search_for_undetectable_logical_errorsstim.Circuit.to_filestim.Circuit.from_file
- New
stim.TableauSimulatormethods:stim.TableauSimulator.c_xyzstim.TableauSimulator.c_zyxstim.TableauSimulator.cxstim.TableauSimulator.do_circuitstim.TableauSimulator.do_pauli_stringstim.TableauSimulator.do_tableaustim.TableauSimulator.h_xzstim.TableauSimulator.num_qubitsstim.TableauSimulator.peek_xstim.TableauSimulator.peek_ystim.TableauSimulator.peek_zstim.TableauSimulator.postselect_xstim.TableauSimulator.postselect_ystim.TableauSimulator.postselect_zstim.TableauSimulator.reset_xstim.TableauSimulator.reset_ystim.TableauSimulator.reset_zstim.TableauSimulator.zcxstim.TableauSimulator.zcystim.TableauSimulator.zcz
- New
stim.Tableaumethods:stim.Tableau.to_unitary_matrix
- New method options:
obs_path=Noneandobs_formatforstim.CompiledDetectorSampler.sample_fileobs_path=Noneandobs_formatforstim.CompiledMeasurementsToDetectionEventsConverter.convert_fileignore_decomposition_failures=Falseforstim.Circuit.detector_error_modelblock_decompose_from_introducing_remnant_edges=Falseoption for thestim.Circuit.detector_error_modelbit_pack_result=Falseforstim.CompiledMeasurementsToDetectionEventsConverter.convert
- Functional changes:
- Error analysis now attempts to avoid introducing remnant edges unless absolutely necessary (improves detector error models)
- Error analysis now supports
ELSE_CORRELATED_ERRORinstructions as long they occur in contiguous blocks started by aCORRELATED_ERROR - The stim python package now includes the stim command line tool. Much easier than building it for yourself.
- The floating point accuracy of
stim.TableauSimulator.state_vectorhas been substantially improved (e.g. all zeros are now exact) - The method signatures shown in the API reference are now more accurate, matching the ones in
__init__.pyi
Bug fixes:
- Worked around the pseudo random number generator state being duplicated when using multiprocessing with start method
"fork". Samplers now seed from external entropy when constructed, instead of using entropy acquired at startup. - Fixed various reported build failures related to MacOS and Apple M chips.
- Fixed
setup.pynot forcing UTF8 encoding when loadingREADME.md, causing crashes on systems configured to use other encodings by default. - Fixed
stimcirqnot understanding probabilisticcirq.DensePauliStringgates. - Worked around an issue where pytest gives useless failure messages for asserts involving stim objects.
- Fixed an infinite loop in
stim.Circuit.get_detector_coords. - Fixed complex indices like
stim.Circuit()[1j]crashing the python interpreter (by switching to latest version of pybind11). - Fix loop folding during error analysis incorrectly folding loops with observables including measurements from only the last few iterations
- Fixed a segfault in measurement-to-detection-event conversion related to failing to ignore noise channels
- Fixed a bug in measurement-to-detection-event conversion where some OBSERVABLE_INCLUDE instructions were being forgotten
- C++
Published by Strilanc almost 4 years ago
stim - v1.8.0 - Explorable Errors
Flagship changes:
- Search for smallest logical errors directly from a circuit
- Find circuit errors that explain detector error model symptoms
- Helpful error messages when detector error model extraction fails
- Better compatibility with cirq
Notable changes:
- Added
stim.Circuit.shortest_graphlike_errorfor finding the smallest set of physical errors that can cause an undetected logical error (as long as they each have at most two detection events) - Added
stim.Circuit.explain_detector_error_model_errorsfor listing how detector error model symptoms match up with physical circuit error mechanisms - When
stim.Circuit.detector_error_modelfails due to an anti-commuting detector or observable, the error message now describes in great detail the involved detectors, qubits, and error sensitivities - Added several dataclasses for representing results from
stim.Circuit.explain_detector_error_model_errors - Added
stim.Circuit.get_detector_coordinates - Added
stim.Circuit.get_final_qubit_coordinates - Added
stim.DetectorErrorModel.get_detecetor_coordinates - Added
stim.Circuit.appendas a shorter more pythonic alias forappend_operation stim.Circuit.appendnow allows the targets argument to be a single target, instead a list of targetsstim.Circuit.appendverifies that a probability argument is given when appending noisy gatesstimcirqnow convertsDETECTORannotations (viastimcirq.DetAnnotation)stimcirqnow convertsOBSERVABLE_INCLUDEannotations (viastimcirq.CumulativeObservableAnnotation)stimcirqnow convertsSHIFT_COORDSannotations (viastimcirq.ShiftCoordsAnnotation)stimcirqnow convertsREPEATblocks (viacirq.CircuitOperation)stimcirqnow convertsMPPmeasurements (viacirq.PauliMeasurementGate) (inverted results not yet supported due to https://github.com/quantumlib/Cirq/issues/4814)stimcirqnow converts operations controlled by sweep targets (viastimcirq.SweepPauli)stimcirqnow supports cirq json serialization (viastimcirq.JSON_RESOLVERandstimcirq.JSON_RESOLVERS_DICT)- Fixed
stim.CircuitInstruction,stim.GateTarget,stim.DemTarget,stim.DemInstructionnot being hashable - Improved documentation of the file formats for sample results
- Fixed measurement-to-detection conversion going into an infinite loop for circuits with no measurements when using file format
b8 - Development versions of stim are now automatically uploaded to pypi when changes are merged into
main
- C++
Published by Strilanc over 4 years ago
stim - v1.7.1 - Installation Iteration
- Fix using AVX instructions as part of checking if AVX instructions can be used (see https://github.com/quantumlib/Stim/issues/179)
- Fix the source distribution (sdist) not including header files
- C++
Published by Strilanc over 4 years ago
stim - v1.7.0 - Immediate Installation
Flagship changes:
- Stim's python package is now pre-built, reducing install time from >5 minutes to a few seconds
- Fixed error analysis evaluating overlapping
MPPtargets in the wrong order, creating bad detector error models
Notable changes:
- Added pickling support to
stim.Tableau,stim.Circuit,stim.PauliString, andstim.DetectorErrorModel - Added
stim.DetectorErrorModel.shortest_graphlike_errorfor quickly finding simple low weight errors and upper bounding code distance - Added several small handy
stim.DetectorErrorModelmethods:appendapprox_equalsnum_errors+and+=(concatenation)*and*=(repetition)
- Added
stim.Circuit.approx_equals - Fixed
circuit.append_operationallowing NaN probabilities which could then cause crashes
- C++
Published by Strilanc over 4 years ago
stim - v1.6.0 - Conversion Consistency
Flagship Changes:
- Tools for converting measurement data into detection event data (
stim.Circuit.compile_m2d_converter) - Initial support for "sweep bit targets", which can be used to define families of circuits that differ by Paulis (
CNOT sweep[2] 3) - Seeding simulators to get consistent results (on the same machine, using the same version)
Notable Python Changes:
- Added
stim.Circuit.compile_m2d_converterfor converting measurements into detection events. stim.Circuit.compiled_[detector_]samplernow takes aseed=Noneargument.stim.Circuit.compiled_samplernow takes askip_reference_sample=Falseargument.- Added
stim.TableauSimulator.peek_observable_expectation. stim.Circuit.append_operationnow acceptsstim.CircuitInstructionandstim.RepeatBlockvalues- Added
stim.Compiled[Detector]Sampler.sample_writefor putting results directly onto disk without paying python conversion costs - stimcirq now depends on
cirq-coreinstead of all ofcirq - There is now autogenerated documenting stim's various output formats (e.g.
b8) - Gate documentation now includes
Targets:,Parens arguments:, andDecomposition:sections - Added a getting started notebook
- Fixed generated rep code circuits having 1 too many data qubits for the desired code distance.
Notable C++ Changes:
- Modes are now invoked like
stim sample --shots 100instead ofstim --sample 100. The old style still works but is deprecated. - Renamed
--frame0flag to--skip_reference_sample.--frame0still works but is deprecated. stim help [term]now includes data format help, mode help, and command line flag help.- Added
stim m2dmode for converting measurement data into detection event data. - Added
--seedoption tostim sampleandstim detect - There is now an
iodirectory with writers and readers for the various sample data formats - Flattened
stim_internal::intostim::(the distinction wasn't sufficiently curated to be useful) #include "stim.h"now includes all header files in stim- Changed
simd_wordinto a#definewith different values for each width, so incompatible builds fail at link time instead of triggering undefined behavior at runtime
- C++
Published by Strilanc over 4 years ago
stim - v1.5.0 - Noisy Measurements
Flagship Changes:
- Measurements can now be noisy (
M(0.001) 1 2 3flips each result with 0.1% chance) - Added Pauli product measurement (
MPP X0*X1 Z8*Z9measuresX0*X1thenZ8*Z9) - Fixed a bug in the frame simulator where
MY(Y basis measurement) acted likeMRY(Y basis demolition measurement)
Other Changes:
stimcirqnow addsQUBIT_COORDSannotations- Arbitrary
cirq.GridQubit/cirq.LineQubitqubits can now survive round trip conversion from cirq to stim back to cirq
- Arbitrary
stim.Circuitandstim.DetectorErrorModelnow support slicing (e.g.circuit[:4]is a circuit with the first 4 operations fromcircuit)- Giving
decompose_errors=Truetostim.Circuit.detector_error_modelnow guarantees the resulting error model is decomposed into graphlike errors (or else will raise an exception) - Increased the flexibility of error decomposition. It now considers all errors, instead of only other errors coming from the same Pauli channel, when the latter fails.
- Fixed
stim.Circuit.append_operationonly accepting raw integers as targets (it now also acceptsstim.GateTargetvalues).
C++ Library Changes:
- Fixed some bugs related to statically linking C++ programs to stim
- Fixed "stim.h" breaking if included twice
- Documented how to link to stim using Bazel
- Fixed Bazel BUILD file not including the include directory
- Fixed an incompatibility with GTest v1.11
- Added
DetectorErrorModel::from_fileconvenience methods - Fixed
FixedCapVector::operator<not being a consistent ordering. - Gate targets are now internally stored as
GateTargetstructs instead of rawuint32_tvalues
- C++
Published by Strilanc almost 5 years ago
stim - v1.4.0 - Error Analysis and Circuit Generation
Flagship features:
- Convert circuits into detector error models, suitable for configuring decoders with.
- Generate annotated error correction circuits using the repetition code, surface code, or color code.
Notable changes:
- Added
stim.Circuit.generated(...)to generate common error corrected circuits. - Added
stim.Circuit.detector_error_model(...)to simplify circuits into detector error models. - Added
stim.DetectorErrorModeland related classes such asstim.DemTarget. - Made inspecting
stim.Circuiteasier. You can now index into and iterate over its instructions and blocks. - Made inspecting
stim.Tableaueasier. Added efficient methods for getting single Pauli terms or inverse terms. - New supported circuit instructions:
- XYZ measurement/reset gates:
MX,MY,MZ,RX,RY,RZ,MRX,MRY,MRZ - Period 3 rotations around X+Y+Z:
C_XYZandC_ZYX. - Ion trap gates:
SQRT_XX,SQRT_XX_DAG,SQRT_YY,SQRT_YY_DAG,SQRT_ZZ,SQRT_ZZ_DAG - Coordinate annotations:
QUBIT_COORDSandSHIFT_COORDS(andDETECTORnow takes optional coordinate arguments). - Custom pauli error channels:
PAULI_CHANNEL_1(x, y, z)andPAULI_CHANNEL_2(ix, iy, iz, xi, xx, xy, xz, yi, yx, yy, yz, zi, zx, zy, zz)
- XYZ measurement/reset gates:
- Increased various repetition limits from tens of millions of iterations to quintillions of iterations.
- Added
stim.TableauSimulator.state_vectorfor converting the stabilizer state into a state vector. - Created better documentation of the circuit format, the detector error model format, and supported gates in the
doc/directory of the github repo. - In addition to being exposed to python, error analysis now supports folding loops, decomposing errors, allowing gauge detectors, and optionally approximating disjoint error mechanisms as independent error mechanisms.
Deprecations since v1.3:
- Command line
--detector_hypergraphflag now complains that you should use--analyze_errors
Bug fixes:
- Fixed error analysis incorrectly handling MR gates operating on the same qubit multiple times.
- Fixed
stim.TableauSimulator.cnotand other two qubit methods not enforcing that the two qubits must be different. - Fixed
OBSERVABLE_INCLUDEindices being summed instead of maxed when estimating memory usage. - Fixed way-too-large command line integer arguments silently overflowing to smaller values and being accepted.
- Fixed some cases where gates with incompatible targets could be added to a circuit.
- Fixed exceeding the linux file handle limit when taking thousands of shots from a circuit with billions of measurements with both
--inand--outfiles specified.
Notable internal changes:
- The supported gates documentation is now autogenerated from the internal gate data.
- Gates now take a variable number of arguments instead of only one.
- Documented on how to statically link to stim in cmake projects
- Initial work on possible
stimzxpackage. - Initial work on possible
stimjspackage.
- C++
Published by Strilanc almost 5 years ago
stim - v1.3.0 - Control, Closure, and Concatenation
User improvements:
stimcirqcan now convert in both directions, and preserves circuit moment structure when convertingstim.TableauSimulatoris easier to control and inspect- Truncate the state using
stim.TableauSimulator.set_num_qubits - Replace the state using
stim.TableauSimulator.set_inverse_tableau - Recognize single qubit stabilizer states non-destructively using
stim.TableauSimulator.peek_bloch - Get state stabilizers in a standard form using
stim.TableauSimulator.canonical_stabilizers - Guide measurement results after the fact using
stim.TableauSimulator.measure_kickback
- Truncate the state using
stim.PauliStringis now closed under multiplicationstim.PauliString.signis now allowed to be1jor-1j- Added
allow_imaginary=Falseparameter tostim.PauliString.random - Multiplying anti-commuting Pauli strings now produces a result instead of an error
stim.PauliStringandstim.Tableaunow support concatenation via+and/or*- Adding
stim.PauliStrings concatenates them (computes their tensor product) - Adding
stim.Tableaus concatenates them (computes their direct sum) - Multiplying
stim.PauliStringself-concatenates a variable number of times
- Adding
- Mutable semantics have been improved
stim.PauliStringnow has a*=operator that works inline- Added
copymethods tostim.{Circuit,Tableau,PauliString,TableauSimulator}
- Bug fixes
- Fixed
stim.TableauSimulator.measurereading invalid memory when applied to a qubit that hadn't been touched yet - Fixed
import stimfailing in some environments due to a unicode docstring not being marked as UTF8 (https://github.com/quantumlib/Stim/issues/20) - Fixed
stim.TableauSimulator.cnotand other controlled operation methods failing when given a classical control - Worked around a bug in
std::random_devicein some environments (https://github.com/quantumlib/Stim/issues/26)
- Fixed
Dev improvements:
- Added a test command to
cibuildwheel, so continuous integration now confirms tests pass on multiple platforms - Fixed stimcirq doctests being skipped
- C++
Published by Strilanc about 5 years ago
stim - v1.2.1 - X Z error swap fix
Major improvements:
- Fixed the effects of XERROR and ZERROR being swapped in TableauSimulator
Dev improvements:
- Fixed noisy operations of TableauSimulator not being verified against known-good operations from cirq using black box sample statistics
- C++
Published by Strilanc about 5 years ago
stim - v1.2.0 - Rolled Repetition
Major improvements:
- Worked around a PyCharm autocomplete bug triggered by having
"""in__doc__strings. stim.Circuitno longer unrollsREPEATblocks.stim.Circuit.__mul__now wraps the circuit into aREPEATblock.
Minor improvements:
- Shorter
stim.Circuit.__repr__ - Compiled samplers now have an eval-able
__repr__. - stimcirq no longer forces a specific version of cirq as a requirement.
Dev improvements:
- Split python and dev documentation into a separate README.
- Refactored underlying code to support streaming circuits with results too large to store in memory (not yet exposed as python bindings).
- C++
Published by Strilanc about 5 years ago
stim - v1.1.0 - Abstract Algebra
Major improvements:
- Added
stim.PauliString, a datatype for representing and manipulating Pauli products - Added
stim.Tableau, a datatype for representing and manipulating stabilizer tableaus - Added
stim.TableauSimulator.current_inverse_tableaufor introspecting the simulator state - Added examples to most docstrings
- There is now an API reference at the github wiki https://github.com/quantumlib/Stim/wiki
Minor improvements:
- Fixed
stim.__version__returning the string"VERSION_INFO"instead of something useful stim.Circuit.__init__now takes an optional stim program string- New methods on existing types:
stim.Circuit.__eq__(other)stim.Circuit.__ne__(other)stim.Circuit.__repr__()stim.Circuit.clear()stim.TableauSimulator.current_measurement_record()stim.TableauSimulator.do(stim.Circuit)stim.TableauSimulator.h_xy(...)stim.TableauSimulator.h_yz(...)stim.TableauSimulator.swap(...)stim.TableauSimulator.iswap(...)stim.TableauSimulator.iswap_dag(...)stim.TableauSimulator.xcx(...)stim.TableauSimulator.xcy(...)stim.TableauSimulator.xcz(...)stim.TableauSimulator.ycx(...)stim.TableauSimulator.ycy(...)stim.TableauSimulator.ycz(...)
Dev improvements:
- Docstring examples are now verified by a doctest step during continuous integration
- Added
glue/python/generate_api_reference.pyfor generating the API reference
- C++
Published by Strilanc about 5 years ago