[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
RandomBranchSelector
which 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
TensorNetworkBackend
and backends
that operate on a full-state representation, such as
StatevecBackend
andDensityMatrixBackend
, is now clearer with
the introduction of the abstract classesDenseStateBackend
and
DenseState
, which derive fromBackend
andBackendState
,
respectively.StatevecBackend
andDensityMatrixBackend
inherit
fromDenseStateBackend
, whileStatevec
andDensityMatrix
inherit fromDenseState
. Note that the class hierarchy of
BackendState
mirrors that ofBackend
. -
#322: Added a new
optimization
module containing:-
a functional version of
standardize
that returns a standardized
pattern as a new object; -
a function
incorporate_pauli_results
that returns an equivalent
pattern in which theresults
are 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_measurements
after applyingstandardize
and
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
,Axis
andSign
is 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_pattern
is now deprecated. -
#300:
pr_calc
parameter is removed in back-end initializers.
The user can specifypr_calc
in the constructor of
RandomBranchSelector
instead. -
#300:
rng
is 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_pattern
functions 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_measurements
still places C
commands before X and Z commands. -
#312: Backend's
State
has been renamed toBackendState
to avoid
a name conflict with theState
class 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.