Graphix
Description
Added
#476: Introduced new methods
OpenGraph.extract_circuit,CliffordMap.to_tableauand new functiongraphix.circ_ext.compilation.cm_berg_pass. Circuit extraction can be done natively in Graphix.#484: J & CZ transpilation.
- Replaced
Circuit.transpile()with a new approach based decomposing circuits into J & CZ gates. - Added
Circuit.transpile_to_causal_flow()to produceCausalFlowusing the same decomposition. - Added
instruction.Jclass. - Added
Circuit.transpile_j_to_rzh()method to prepare circuits with J gates for export to OpenQASM. - Added
transpileargument toqasm3_exporter.circuit_to_qasm3andqasm3_exporter.circuit_to_qasm3_lines, which defaults to true and appliesCircuit.transpile_j_to_rzhandCircuit.transpile_measurements_to_z_axismethods. - The transpiler now returns
TranspiledPatternorTranspiledFlow, instead ofTranspileResult.
- Replaced
#490: Introduced new
InstructionandCommandnamespace classes for instruction and command instantiation.#505:
- Added new methods
XZCorrections.to_causal_flowandXZCorrections.to_gflowwhich subsumeStandardizedPattern.extract_causal_flowandStandardizedPattern.extract_gflow. - Added new methods
XZCorrections.to_blochandXZCorrections.downcast_bloch.
- Added new methods
#507: Introduced new methods
PauliString.__str__,PauliString.from_str,PauliString.to_tableau, andPauliString.from_tableau.#510
- Added new attribute
OpenGraph.output_cliffords - Added
cliffordabstract method toAbstractMeasurement. Implemented it forPlaneandAxis.
- Added new attribute
#515:
Pattern.remove_local_clifford_commandstranspiles MBQC+LC patterns into pure MBQC patterns.Clifford.to_opengraphreturns an open graph without local Cliffords that implements the given single-qubit Clifford gate.
#515, #519:
Pattern.reindexreturns a pattern whose nodes have been re-indexed either by a supplied mapping or, by default, consecutively starting at 0.Pattern.node_mappingreturns a mapping that can be passed toPattern.reindex, with flexibility for specifying how nodes are mapped.
#524: Added
Statevec.drawandDensityMatrix.drawmethods (and the underlyingstatevec_to_stranddensity_matrix_to_strfunctions) for pretty-printing states and density matrices in ASCII, Unicode, and LaTeX.#526: Added new method
XZCorrections.to_pauli_flow, which reconstructs a Pauli flow directly from XZ-corrections by solving the per-node correction sets over GF(2). AddedFlowGenericErrorReason.NoPauliFlow, raised when the XZ-corrections admit no compatible Pauli flow.#497, #540: Added an amplitude damping noise model. Introduces
amplitude_damping_channel/two_qubit_amplitude_damping_channel, theAmplitudeDampingNoise/TwoQubitAmplitudeDampingNoisenoise elements, andAmplitudeDampingNoiseModel.#556, #563: Added a context variable
default_output_formatto unify the default output format for displayingPauliFlow,XZCorrections,Pattern, andStateVec.#568:
- Added the following methods to
Pattern. By default, they modify the pattern in place, with an optionalcopyparameter. Ifcopy=True, a modified copy is returned instead.apply, an in-place variant ofmap,blochify, an in-place variant ofto_bloch.
- All classes that have
subsandxreplacemethods (Pattern,Circuit,OpenGraph,Measurement,PauliFlow,XZCorrections,DensityMatrix) now derive from theParameterizableclass, which exposes the methodwith_parameterandwith_parameters, withsubsandxreplaceas their respective aliases. PatternandCircuitnow derive from theInplaceParameterizablesubclass, which additionally provides the following methods:replace_parameter, an in-place variant ofwith_parameter(orsubs),replace_parameters, an in-place variant ofwith_parameters(orxreplace).
- Added the following methods to
#585: Added
rand_outcome.
Fixed
#454, #481: Ensure
Pattern.minimize_spaceonly reduces max-space and does not increase it.#482, #483: Ensure that
to_space_optimal_patternreorders output nodes#510
Pattern.extract_opengraphreturns the same open graph before and after standardization.- The round trip
Pattern->OpenGraph->Flow->XZCorrections->Patternis guaranteed for deterministic patterns in the LC fragment.
#549: Fixed #531.
- Empty outputs layer removed from flow's partial order.
- Flow well-formedness check does not trigger false negative for flows on open graphs without outputs.
#554, #560: Legends accompanying open graph visualizations only include elements present in the graph.
#562: Fixed #553. Handle visualization of empty graphs.
#561: Fixed #555. Method
Pattern.drawcomputes Pauli flow from pattern.#569: Keyword arguments for
simulate_patternare now type-checked.#576: Clifford gates are now properly printed, and their QASM3 decompositions are now optimal.
#583, #585: Compatibility with numpy 2.5.
#586: Fixed #584 Swap transpilation of measured qubits.
Changed
#452: Use
uvfor dependency management#476
- Added new field
dimtoPauliStringto represent the dimension of the Hilbert space. - Define
PauliStringon qubit indices and remove allremapmethods. - Represent
x_mapandz_mapattributes ofCliffordMapas sequences ofPauliStringinstead of mappings. - Rename
PauliFlow.pauli_stringsproperty asPauliFlow.extraction_pauli_strings.
- Added new field
#479:
- Added new methods
OpenGraph.draw,PauliFlow.drawandXZCorrections.draw. - Method
Pattern.draw_graphsubsumed by two different methods:Pattern.draw_flowandPattern.draw_xzcorrections.
- Added new methods
#454, #481: New space minimization API that allows users to select or define custom heuristics.
#484: The dense back‑ends now perform the finalisation step by reordering the output qubits with a new
permutemethod, replacing the oldsort_qubits.#490: Exposed more common classes and methods to top level
__init__.py.- Renamed
Instruction,InstructionWithoutRZZandCommandtoInstructionType,InstructionTypeWithoutRZZandCommandTyperespectively. - Moved
InstructionType,InstructionTypeWithoutRZZ,CommandType,CorrectionandCommandOrNoisetoTYPE_CHECKINGblocks. - Renamed
DrawAnnotationstoDrawPatternAnnotations.
- Renamed
#168, #498:
Pattern.remove_pauli_measurementsreplacesPattern.perform_pauli_measurements. The new algorithm removes all non-input Pauli nodes from patterns that have a flow and returns a pattern that is equivalent for every input state.- Field
Pattern.resultsand functionincorporate_pauli_resultsremoved.
- Field
#507: Static method
PauliString.from_measured_nodeis subsumed by the functionextraction_ps_from_corrected_node.#510:
Pattern.extract_opengraphstandardizes the pattern first.XZCorrections.to_patternapplies Cliffords inOpenGraph.output_cliffordsat the end of the pattern.OpenGraph.iscloseandOpenGraph.is_equal_structurallycheck equality ofOpenGraph.output_cliffords.OpenGraph.composemerges Clifford decorations with measurements or other Clifford decorations on outputs if required..drawmethods allow to show Clifford commands in the outputs.PauliFlow.extract_circuitraisesNotImplementedErrorif the open graph has Clifford decorations.
#468, #511: The
pyzxmodule has been moved to a separate plugin: https://github.com/thierry-martinez/graphix-pyzx/ Consequently, thepyproject.tomlno longer defines anextradependency group for thepyzxpackage.#512: Method
Circuit.simulate(formerlyCircuit.simulate_statevector, see #567) accepts abackend: DenseStateBackend[_DenseStateT] | Literal["statevector", "densitymatrix"]parameter.#567:
Method
Circuit.simulate_statevectorhas been renamedCircuit.simulate.Method
Pattern.simulate_patternhas been renamedPattern.simulate.Field
SimulateResult.statevechas been renamedSimulateResult.state.
#557: Homogeneize namespace. See commit text or COMPATIBILITY.md for a detailed renaming list. Fixed the following convention:
.to_<object>for transformations that can only returnobjector raise an exception. Equivalently, we use.from_<object>for constructors..to_<object>_or_nonefor transformations that can returnobjectorNone. Equivalently, we use.from_<object>_or_nonefor constructors.- accessor methods use nouns instead of verb + noun. Example:
Pattern.max_degreeinstead ofPattern.compute_max_degree.
#518: Numba-jit statevector backend.
- Changed statevector representation from a tensor to a flat array.
- Added
.with_capacitymethod toStatevectorBackendto preallocate a given space in memory. - Added module constant
NUM_QUBIT_PARALLELto determine at which qubit count jit-compiled functions are parallelized. - Dropped support for symbolic simulation and removed
Statevector.xreplaceandStatevector.subsmethods. - Added method
DenseState.project_qubitwhich defaults to callingevolve_singleandremove_qubit. Added specialized code for this method inStatevectorclass. - Unified
test_statevec.pyandtest_statevec_backend.pyinto a single file.
#568: Method
Pattern.infer_pauli_measurementsand functiontranspile_swapsnow operate in place by default, with an optionalcopyparameter. Ifcopy=True, a modified copy is returned instead.#571: Removed method
Pattern.graph
Notes
Files
TeamGraphix/graphix-v0.4.zip
Additional details
Related works
- Is supplement to
- Software: https://github.com/TeamGraphix/graphix/tree/v0.4 (URL)
Software
- Repository URL
- https://github.com/TeamGraphix/graphix