[0.3.2] - 2025-08-12
Added
-
#320: Method for
Pattern:compose -
#310: Method for
OpenGraph:compose -
#277: Methods for pretty-printing
Pattern:to_ascii,
to_unicode,to_latex. -
#300: Branch selection in simulation: in addition to
RandomBranchSelectorwhich corresponds to the strategy that was
already implemented, the user can useFixedBranchSelector,
ConstBranchSelector, or define a custom branch selection by
deriving the abstract classBranchSelector. -
#312: The separation between
TensorNetworkBackendand backends
that operate on a full-state representation, such as
StatevecBackendandDensityMatrixBackend, is now clearer with
the introduction of the abstract classesDenseStateBackendand
DenseState, which derive fromBackendandBackendState,
respectively.StatevecBackendandDensityMatrixBackendinherit
fromDenseStateBackend, whileStatevecandDensityMatrix
inherit fromDenseState. Note that the class hierarchy of
BackendStatemirrors that ofBackend. -
#322: Added a new
optimizationmodule containing:-
a functional version of
standardizethat returns a standardized
pattern as a new object; -
a function
incorporate_pauli_resultsthat returns an equivalent
pattern in which theresultsare incorporated into measurement
and correction domains.
The resulting pattern is suitable for flow analysis. In
particular, if a pattern has a flow, it is preserved by
perform_pauli_measurementsafter applyingstandardizeand
incorporate_pauli_results.
-
Fixed
-
#314, #322: The method
Pattern.standardize()now correctly returns
an equivalent pattern even in the presence of C commands, or raises
an error if no standardized form exists. -
#277: The result of
repr()forPattern,Circuit,Command,
Instruction,Plane,AxisandSignis now a valid Python
expression and is more readable. -
#235, #252, #273: The open graph representation is now compatible
with pyzx 0.9, and conventions have been fixed to ensure that the
semantics is preserved between circuits, ZX graphs, open graphs and
patterns. -
#302, #308, #312:
Pattern,Circuit,PatternSimulator, and
backends are now type-checked.
Changed
-
#277: The method
Pattern.print_patternis now deprecated. -
#300:
pr_calcparameter is removed in back-end initializers.
The user can specifypr_calcin the constructor of
RandomBranchSelectorinstead. -
#300:
rngis no longer stored in the backends; it is now passed as
an optional argument to each simulation method. -
#261: Moved all device interface functionalities to an external
library and removed their implementation from this library. -
#314, #322: The method
Pattern.standardize()now places C commands
after X and Z commands, making the resulting patterns suitable for
flow analysis.
Theflow_from_patternfunctions now fail if the input pattern is
not strictly standardized (as checked by
Pattern.is_standard(strict=True), which requires C commands to be
last).
Note: the methodperform_pauli_measurementsstill places C
commands before X and Z commands. -
#312: Backend's
Statehas been renamed toBackendStateto avoid
a name conflict with theStateclass defined ingraphix.states,
which represents the state of a single qubit. -
#312:
Backend[StateT_co]andDenseStateBackend[DenseStateT_co]
are now parameterized by covariant type variables, allowing
subclasses to narrow the type of the state field to match their
specific state representation. Covariance is sound in this context
because the classes are frozen, and it ensures that
Backend[BackendState]is a supertype of all backend classes.