Skip to content

Commit 2667ce1

Browse files
committed
Add ZXTransformer contrib module using pyzx 0.10.0
A custom transformer which uses ZX-calculus through the PyZX library to perform circuit optimisation. Supports measurements, resets, conditional gates, and hybrid (non-unitary) circuit optimisation.
1 parent 8691276 commit 2667ce1

5 files changed

Lines changed: 776 additions & 0 deletions

File tree

cirq-core/cirq/contrib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@
2424
from cirq.contrib.qcircuit import circuit_to_latex_using_qcircuit as circuit_to_latex_using_qcircuit
2525
from cirq.contrib import json # noqa: F401
2626
from cirq.contrib.circuitdag import CircuitDag as CircuitDag, Unique as Unique
27+
from cirq.contrib.zxtransformer import zx_transformer as zx_transformer # noqa: F401

cirq-core/cirq/contrib/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ pylatex~=1.4
66
# quimb
77
quimb~=1.8
88
opt_einsum
9+
10+
# required for zxtransformer
11+
pyzx>=0.10.0
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2024 The Cirq Developers
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""A custom transformer for Cirq which uses ZX-Calculus for circuit optimization, implemented using
16+
PyZX."""
17+
18+
from cirq.contrib.zxtransformer.zxtransformer import zx_transformer

0 commit comments

Comments
 (0)