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])
  • OBSERVABLE_INCLUDE can 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_tag property
  • 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.append now allows targets of type stim.PauliString (for gates like MPP)
  • stim.Circuit.append can now be given a stim.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_vector no longer requires its input to be normalized
  • stim.DetectorErrorModel.append can now be given a stim.DetectorErrorModel
  • Added wheel packages for sinter and stimcirq
  • Added python 3.13 builds for linux and osx
  • The sinter.Decoder base class now auto-implements decode_via_files if a child implements compile_decoder_for_dem
  • Gates documentation now includes MBQC decompositions

New gates:

  • Added C_NXYZ gate
  • Added C_XNYZ gate
  • Added C_XYNZ gate
  • Added C_NZYX gate
  • Added C_ZNYX gate
  • Added C_ZYNX gate
  • Added H_NXY gate
  • Added H_NXZ gate
  • Added H_NYZ gate (the final single qubit Clifford needed to have all 24!)
  • Added II gate
  • Added I_ERROR gate
  • Added II_ERROR gate

Bug fixes:

  • Fixed stim.Circuit.to_tableau ignoring SPP and SPP_DAG
  • Fixed stimcirq failing to round trip circuits using MR (such as stim's example circuits)
  • Fixed stim.Circuit.detecting_regions not 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.FlipSimulator query 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_size configuration 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_generators for finding the stabilizer flows of a circuit.
  • Added stim.Circuit.time_reversed_for_flows for reversing circuits containing resets and measurements.
  • Added sinter.Sampler for 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.sample gained obs_out=None and dets_out=None arguments
  • stim.Circuit.to_crumble_url gained skip_detectors=False and mark=None arguments
  • stim.CircuitInstruction.__init__ gained the ability to parse single lines from a stim circuit file
  • stim.DemInstruction.__init__ gained the ability to parse single lines from a detector error model file
  • stim.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 now M{X,Y,Z} instead of MR{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.diagram gained a rows=None argument, for controlling layout
  • Added "tick #" labels to timeslice diagrams
  • Improved stim.Circuit.detector_error_model error 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 -html variants 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 collect now distributes workers evenly over tasks, instead of focusing on one task at a time
  • sinter collect now never switches a worker to a new task until their current task is done
  • Added sinter plot --point_label_func command line argument
  • Added sinter plot --dpi for increasing resolution of plots
  • Expanded sinter plot --group_func to 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
  • sinter collect --processes now defaults to "auto" (number of CPUs) if not specified
  • sinter plot --show is now implied when --out isn't specified
  • Added sinter plot --preprocess_stats_func for 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_1 permuting X/Y/Z/ error channels 😱😱😱
  • Fixed various internal methods not correctly propagating Pauli terms through MXX, MYY, and MZZ instructions that operated on the same qubit more than once 😱
  • Fixed stim.Circuit.with_inlined_feedback incorrectly ordering operations fused by the removal of a feedback operation
  • Fixed stimcirq.cirq_circuit_to_stim_circuit not adding TICKs from multi-moment CircuitOperation blocks
  • Fixed MPAD targets counting towards stim.Circuit.num_qubits
  • Fixed stim.PauliString.{before,after} not supporting SPP and SPP_DAG
  • Fixed stim.PauliString.before refusing to cross reset gates
  • Fixed sinter failing to create plots for data points with extremely large shot counts
  • Fixed stim.Tableau.from_stabilizers error 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.Flow class for representing stabilizer flows
    • Added stim.target_pauli
    • Added stim.target_combined_paulis
    • Added stim.PauliStringIterator
  • New stim.Circuit methods:
    • 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
  • New stim.GateData methods:
    • Added stim.GateData.{__eq__,__ne__,__repr__,__init__,__str__}
    • Added stim.GateData.flows
    • Added stim.GateData.generalized_inverse
    • Added stim.GateData.inverse
  • New stim.PauliString methods:
    • stim.PauliString.__init__ now allows sparse syntax (like stim.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.Tableau methods:
    • 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_stabilizers by over 200x
  • New stim.FlipSimulator methods:
    • Added stim.FlipSimulator.broadcast_pauli_errors
  • New gates:
    • Added CZSWAP gate (with alias SWAPCZ)
    • Added SPP gate (generalized S gate that applies to Pauli products)
    • Added SPP_DAG (inverse of SPP)
  • Added sinter.FusionBlossomCompiledDecoder, speeding up decoding with fusion blossom
  • Added sinter plot --ymax command line argument
  • stimcirq now converts PAULI_CHANNEL_2 into 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 --xaxis only applying to one subplot, instead of all subplots
  • Fixed build-from-source not working on IBM PowerPC
  • Fixed HERALDED_PAULI_CHANNEL_1 targeting the wrong qubits (this fix was also backported to 1.12.1)
  • Fixed stim.Circuit.explain_dem_errors not supporting all gates
  • Fixed crumble not allowing e and q to 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_1 targeting fixed indices instead of the given qubits
    • For example, HERALDED_PAULI_CHANNEL_1(0.1) 2 5 3 was behaving like HERALDED_PAULI_CHANNEL_1(0.1) 0 1 2

- C++
Published by Strilanc over 2 years ago

stim - v1.12.0 - Foreseen Flips

Flagship changes:

  • Added support for heralded erasures
  • Added stim.FlipSimulator for 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
  • 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
  • Added stim.Circuit.count_determined_measurements
  • Added stim.Circuit.num_ticks
  • Added stim.Circuit.reference_sample
  • Added stim.CircuitRepeatBlock.name (for duck typing vs stim.CircuitInstruction)
  • Added stim.DemRepeatBlock.type (for duck typing vs stim.DemInstruction)
  • Added stim.GateTarget.pauli_type
  • Added stim.GateTarget.qubit_value
  • Added stim.TableauSimulator.postselect_observable
  • Added optional reference_sample argument to stim.Circuit.compile_sampler
  • Made stim.PauliString.{after,before} much less picky
  • Improved performance of stim.CompiledDetectorSampler by ~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 convert command 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_dem method for custom decoders to implement
    • Improves performance ~2x on high core count machines by avoiding disk usage
  • Added a shorthand to sinter plot: use m.key instead of metadata.get("key", None) in *_func arguments
  • Added square root scales to sinter plot (example: --xaxis "[sqrt]qubit count")
  • Added an optional custom_counts column to sinter's CSV format
  • Added auto option 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 --subtitle with {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_path field for specifying circuits by filepath
  • Added arguments count_observable_error_combos=False and count_detection_events=False to sinter.{iter_collect,collect}

Notable changes to crumble:

  • Added support for MPP operations
  • Added example circuits

Notable bug fixes

  • Fixed stimcirq.__version__ and sinter.__version__ not existing
  • Fixed stimcirq.cirq_circuit_to_stim_circuit choking on tagged operations
  • Fixed stimcirq.cirq_circuit_to_stim_circuit not putting repeat blocks in their own moment
  • Fixed triggering numpy bool8 deprecation warnings
  • Fixed documentation not mentioning how to do pauli feedback
  • Fixed a failure in stim m2d related to appending observables crossing a simd boundary when --obs_out was used
  • Fixed some corner cases where sinter.better_sorted_str_terms produced incomparable values
  • Fixed cmake install doing nothing
  • Fixed some sinter plot crashes on degenerate data
  • Fixed several sinter classes not having evaluatable reprs
  • Fixed stim.Tableau.inverse returning 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 stimzx example project discarding sign information of external stabilizers
  • Fixed stim.Circuit.shortest_graphlike_error and 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:

Breaking changes:

  • stim.DetectorErrorModel.shortest_graphlike_error now defaults ignore_ungraphlike_errors to 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 (and SWAPCX). 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=False argument to stim.read_shot_data_file
  • Added unsigned=False argument to stim.PauliString.from_unitary_matrix
  • Added stim.Tableau.x_sign, stim.Tableau.y_sign, stim.Tableau.z_sign helper methods
  • Added stim.TableauSimulator.depolarize1, stim.TableauSimulator.depolarize2, stim.TableauSimulator.x_error, stim.TableauSimulator.y_error, stim.TableauSimulator.z_error
  • Added a --ran_without_feedback command line option to stim 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-svg which overlays operations over the detector slice diagram
  • The type argument for .diagram methods is no longer keyword-only
  • The tick argument for .diagram methods can now be set to a range(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_predicate to sinter collect, generalizing --postselect_detectors_with_non_zero_4th_coord
  • It's now possible to specify custom decoders
    • Added sinter.Decoder class
    • Added a custom_decoders arg to sinter.collect, sinter.iter_ollect, sinter.predict_on_disk, sinter.predict_observables_bit_packed
    • Added a --customer_decoders_module_function command line argument to sinter collect
  • sinter predict can now be given --metadata_func auto instead 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_func now has access to several more values: stat, stats, decoder, metadata, andstrong_id`.
    • The plot_args_func argument of sinter.plot methods can now take a third argument, stats, the list of stats in the curve
  • Discard rate diagrams now include more Y axis indicators
  • sinter combine now sorts its output
  • Added --order preserve|metadata|error option to sinter 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.StimSampler not 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_stabilizers not 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 stim.DetectorErrorModel.diagram
    • Added diagram type "match-graph-svg"
    • Added diagram type "match-graph-3d"
    • Added diagram type "match-graph-3d-html"
  • Added methods to stim.PauliString:
    • stim.PauliString.from_numpy
    • stim.PauliString.from_unitary_matrix
    • stim.PauliString.to_numpy
    • stim.PauliString.to_tableau
    • stim.PauliString.to_unitary_matrix
  • Added methods to stim.TableauSimulator:
    • stim.TableauSimulator.__init__ now has an optional seed argument
    • stim.TableauSimulator.set_state_from_stabilizers
    • stim.TableauSimulator.set_state_from_state_vector
    • stim.TableauSimulator.do now accepts stim.CircuitInstruction and stim.CircuitRepeatBlock
  • Added methods to stim.Tableau:
    • stim.Tableau.iter_all
    • stim.Tableau.from_circuit
    • stim.Tableau.from_numpy
    • stim.Tableau.from_stabilizers
    • stim.Tableau.from_state_vector
    • stim.Tableau.from_unitary_matrix
    • stim.Tableau.to_circuit
    • stim.Tableau.to_numpy
    • stim.Tableau.to_pauli_string
    • stim.Tableau.to_state_vector
  • Added methods to stim.DetectorErrorModel:
    • stim.DetectorErrorModel.flattened
    • stim.DetectorErrorModel.rounded
    • stim.DetectorErrorModel.compile_sampler
  • Added stim.CompiledDemSampler class with methods:
    • stim.CompiledDemSampler.sample
    • stim.CompiledDemSampler.sample_write
  • Improvements to sinter
    • Added support for pymatching v2
    • Added support for fusion_blossom decoder
    • Added flag --title to sinter plot
    • Added flag --miny to sinter plot
    • Added flag --plot_args_func to sinter plot
    • Added flag --failure_units_per_shot_func to sinter plot
    • Added flag --failure_unit_name argument to sinter plot
    • Added grid lines to the plots made by sinter plot
    • Added filter_func, failure_units_per_shot_func, and failure_unit_name arguments to sinter.plot_error_rate and sinter.plot_discard_rate
    • Added sinter.predict_observables method
    • Added ability to discard shots based on observables being mispredicted
      • Added --postselected_observables_predicate flag to sinter collect
      • Added sinter.Task.postselected_observables_mask field
      • Added postselected_observable_mask argument to sinter.sample_decode
  • Added stim diagram command for producing diagrams, with flags --in, --type, --out, --tick, --remove_noise, --filter_coords.
  • Added stim sample_dem command 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=False argument to stim.CompiledDetectorSampler.sample
  • Added bit_packed=False argument to stim.CompiledDetectorSampler.sample
  • Added bit_packed=False argument to stim.CompiledMeasurementSampler.sample
  • Deprecated stim.CompiledDetectorSampler.sample_bit_packed
  • Deprecated stim.CompiledMeasurementSampler.sample_bit_packed

Notable bug fixes:

  • Fixed stim.Circuit.flattened not fusing all operations
  • Fixed stim.Circuit.without_noise not fusing all operations
  • Fixed PAULI_CHANNEL_2 not 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_model failing when errors affected more than 15 detectors (unless decompose_errors=True)
  • Fixed stim.Circuit.without_noise not 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_word so AVX and SSE code can coexist in the same binary
  • Added stim_python_bindings cmake 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 -fPIC to libstim cmake 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 argument ignore_ungraphlike_errors has changed from from False to True. (Setting it to False can 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.main
    • stim.read_shot_data_file
    • stim.write_shot_data_file
  • New stim.DetectorErrorModel methods:
    • stim.DetectorErrorModel.to_file
    • stim.DetectorErrorModel.from_file
  • New stim.Circuit methods:
    • stim.Circuit.without_noise
    • stim.Circuit.flattened
    • stim.Circuit.search_for_undetectable_logical_errors
    • stim.Circuit.to_file
    • stim.Circuit.from_file
  • New stim.TableauSimulator methods:
    • stim.TableauSimulator.c_xyz
    • stim.TableauSimulator.c_zyx
    • stim.TableauSimulator.cx
    • stim.TableauSimulator.do_circuit
    • stim.TableauSimulator.do_pauli_string
    • stim.TableauSimulator.do_tableau
    • stim.TableauSimulator.h_xz
    • stim.TableauSimulator.num_qubits
    • stim.TableauSimulator.peek_x
    • stim.TableauSimulator.peek_y
    • stim.TableauSimulator.peek_z
    • stim.TableauSimulator.postselect_x
    • stim.TableauSimulator.postselect_y
    • stim.TableauSimulator.postselect_z
    • stim.TableauSimulator.reset_x
    • stim.TableauSimulator.reset_y
    • stim.TableauSimulator.reset_z
    • stim.TableauSimulator.zcx
    • stim.TableauSimulator.zcy
    • stim.TableauSimulator.zcz
  • New stim.Tableau methods:
    • stim.Tableau.to_unitary_matrix
  • New method options:
    • obs_path=None and obs_format for stim.CompiledDetectorSampler.sample_file
    • obs_path=None and obs_format for stim.CompiledMeasurementsToDetectionEventsConverter.convert_file
    • ignore_decomposition_failures=False for stim.Circuit.detector_error_model
    • block_decompose_from_introducing_remnant_edges=False option for the stim.Circuit.detector_error_model
    • bit_pack_result=False for stim.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_ERROR instructions as long they occur in contiguous blocks started by a CORRELATED_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_vector has 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.py not forcing UTF8 encoding when loading README.md, causing crashes on systems configured to use other encodings by default.
  • Fixed stimcirq not understanding probabilistic cirq.DensePauliString gates.
  • 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_error for 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_errors for listing how detector error model symptoms match up with physical circuit error mechanisms
  • When stim.Circuit.detector_error_model fails 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.append as a shorter more pythonic alias for append_operation
  • stim.Circuit.append now allows the targets argument to be a single target, instead a list of targets
  • stim.Circuit.append verifies that a probability argument is given when appending noisy gates
  • stimcirq now converts DETECTOR annotations (via stimcirq.DetAnnotation)
  • stimcirq now converts OBSERVABLE_INCLUDE annotations (via stimcirq.CumulativeObservableAnnotation)
  • stimcirq now converts SHIFT_COORDS annotations (via stimcirq.ShiftCoordsAnnotation)
  • stimcirq now converts REPEAT blocks (via cirq.CircuitOperation)
  • stimcirq now converts MPP measurements (via cirq.PauliMeasurementGate) (inverted results not yet supported due to https://github.com/quantumlib/Cirq/issues/4814)
  • stimcirq now converts operations controlled by sweep targets (via stimcirq.SweepPauli)
  • stimcirq now supports cirq json serialization (via stimcirq.JSON_RESOLVER and stimcirq.JSON_RESOLVERS_DICT)
  • Fixed stim.CircuitInstruction, stim.GateTarget, stim.DemTarget, stim.DemInstruction not 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 MPP targets in the wrong order, creating bad detector error models

Notable changes:

  • Added pickling support to stim.Tableau, stim.Circuit, stim.PauliString, and stim.DetectorErrorModel
  • Added stim.DetectorErrorModel.shortest_graphlike_error for quickly finding simple low weight errors and upper bounding code distance
  • Added several small handy stim.DetectorErrorModel methods:
    • append
    • approx_equals
    • num_errors
    • + and += (concatenation)
    • * and *= (repetition)
  • Added stim.Circuit.approx_equals
  • Fixed circuit.append_operation allowing 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_converter for converting measurements into detection events.
  • stim.Circuit.compiled_[detector_]sampler now takes a seed=None argument.
  • stim.Circuit.compiled_sampler now takes a skip_reference_sample=False argument.
  • Added stim.TableauSimulator.peek_observable_expectation.
  • stim.Circuit.append_operation now accepts stim.CircuitInstruction and stim.RepeatBlockvalues
  • Added stim.Compiled[Detector]Sampler.sample_write for putting results directly onto disk without paying python conversion costs
  • stimcirq now depends on cirq-core instead of all of cirq
  • There is now autogenerated documenting stim's various output formats (e.g. b8)
  • Gate documentation now includes Targets:, Parens arguments:, and Decomposition: 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 100 instead of stim --sample 100. The old style still works but is deprecated.
  • Renamed --frame0 flag to --skip_reference_sample. --frame0 still works but is deprecated.
  • stim help [term] now includes data format help, mode help, and command line flag help.
  • Added stim m2d mode for converting measurement data into detection event data.
  • Added --seed option to stim sample and stim detect
  • There is now an io directory with writers and readers for the various sample data formats
  • Flattened stim_internal:: into stim:: (the distinction wasn't sufficiently curated to be useful)
  • #include "stim.h" now includes all header files in stim
  • Changed simd_word into a #define with 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 3 flips each result with 0.1% chance)
  • Added Pauli product measurement (MPP X0*X1 Z8*Z9 measures X0*X1 then Z8*Z9)
  • Fixed a bug in the frame simulator where MY (Y basis measurement) acted like MRY (Y basis demolition measurement)

Other Changes:

  • stimcirq now adds QUBIT_COORDS annotations
    • Arbitrary cirq.GridQubit / cirq.LineQubit qubits can now survive round trip conversion from cirq to stim back to cirq
  • stim.Circuit and stim.DetectorErrorModel now support slicing (e.g. circuit[:4] is a circuit with the first 4 operations from circuit)
  • Giving decompose_errors=True to stim.Circuit.detector_error_model now 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_operation only accepting raw integers as targets (it now also accepts stim.GateTarget values).

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_file convenience methods
  • Fixed FixedCapVector::operator< not being a consistent ordering.
  • Gate targets are now internally stored as GateTarget structs instead of raw uint32_t values

- 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.DetectorErrorModel and related classes such as stim.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_XYZ and C_ZYX.
    • Ion trap gates: SQRT_XX, SQRT_XX_DAG, SQRT_YY, SQRT_YY_DAG, SQRT_ZZ, SQRT_ZZ_DAG
    • Coordinate annotations: QUBIT_COORDS and SHIFT_COORDS (and DETECTOR now takes optional coordinate arguments).
    • Custom pauli error channels: PAULI_CHANNEL_1(x, y, z) and PAULI_CHANNEL_2(ix, iy, iz, xi, xx, xy, xz, yi, yx, yy, yz, zi, zx, zy, zz)
  • Increased various repetition limits from tens of millions of iterations to quintillions of iterations.
  • Added stim.TableauSimulator.state_vector for 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_hypergraph flag 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.cnot and other two qubit methods not enforcing that the two qubits must be different.
  • Fixed OBSERVABLE_INCLUDE indices 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 --in and --out files 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 stimzx package.
  • Initial work on possible stimjs package.

- C++
Published by Strilanc almost 5 years ago

stim - v1.3.0 - Control, Closure, and Concatenation

User improvements:

  • stimcirq can now convert in both directions, and preserves circuit moment structure when converting
  • stim.TableauSimulator is 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
  • stim.PauliString is now closed under multiplication
    • stim.PauliString.sign is now allowed to be 1j or -1j
    • Added allow_imaginary=False parameter to stim.PauliString.random
    • Multiplying anti-commuting Pauli strings now produces a result instead of an error
  • stim.PauliString and stim.Tableau now 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.PauliString self-concatenates a variable number of times
  • Mutable semantics have been improved
    • stim.PauliString now has a *= operator that works inline
    • Added copy methods to stim.{Circuit,Tableau,PauliString,TableauSimulator}
  • Bug fixes
    • Fixed stim.TableauSimulator.measure reading invalid memory when applied to a qubit that hadn't been touched yet
    • Fixed import stim failing in some environments due to a unicode docstring not being marked as UTF8 (https://github.com/quantumlib/Stim/issues/20)
    • Fixed stim.TableauSimulator.cnot and other controlled operation methods failing when given a classical control
    • Worked around a bug in std::random_device in some environments (https://github.com/quantumlib/Stim/issues/26)

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.Circuit no longer unrolls REPEAT blocks.
  • stim.Circuit.__mul__ now wraps the circuit into a REPEAT block.

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_tableau for 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.py for generating the API reference

- C++
Published by Strilanc about 5 years ago

stim - v1.0.0

Initial public release of stim and stimcirq pypi packages.

- C++
Published by Strilanc about 5 years ago