Skip to content

Commit

Permalink
Merge pull request #42 from dlyongemallo/status
Browse files Browse the repository at this point in the history
Add status badges to README.md.
  • Loading branch information
dlyongemallo authored Apr 12, 2024
2 parents f2ba55c + a8369c0 commit 793030b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

A transpiler pass for Qiskit which uses ZX-Calculus for circuit optimization, implemented using PyZX.

[![License](https://img.shields.io/github/license/dlyongemallo/qiskit-zx-transpiler.svg)](https://opensource.org/licenses/Apache-2.0)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/qiskit-zx-transpiler)]()
[![PyPI - Package Version](https://badge.fury.io/py/qiskit-zx-transpiler.svg)](https://badge.fury.io/py/qiskit-zx-transpiler)
[![CI Status](https://github.com/dlyongemallo/qiskit-zx-transpiler/actions/workflows/test.yml/badge.svg)](https://github.com/dlyongemallo/qiskit-zx-transpiler/actions/workflows/test.yml)

## Example usage

```python
Expand Down
13 changes: 6 additions & 7 deletions zxpass/zxpass.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def _dag_to_circuits_and_nodes(self, dag: DAGCircuit) -> List[Union[zx.Circuit,
return circuits_and_nodes

def _recover_dag(self, circuits_and_nodes: List[Union[zx.Circuit, DAGOpNode]]) -> DAGCircuit:
"""Recovers a DAG from a list of a pyzx Circuits and DAGOpNodes
"""Recover a DAG from a list of a pyzx Circuits and DAGOpNodes.
:param circuits_and_nodes: The list of (optimized) PyZX Circuits and DAGOpNodes from which to recover the DAG.
:return: An optimized version of the original input DAG to ZXPass.
Expand All @@ -171,11 +171,11 @@ def _recover_dag(self, circuits_and_nodes: List[Union[zx.Circuit, DAGOpNode]]) -
dag.add_clbits(self.clbits)
dag.qregs = self.qregs
dag.add_qubits(self.qubits)
for circuit in circuits_and_nodes:
if isinstance(circuit, DAGOpNode):
dag.apply_operation_back(circuit.op, circuit.qargs, circuit.cargs)
for circuit_or_node in circuits_and_nodes:
if isinstance(circuit_or_node, DAGOpNode):
dag.apply_operation_back(circuit_or_node.op, circuit_or_node.qargs, circuit_or_node.cargs)
continue
for gate in circuit.gates:
for gate in circuit_or_node.gates:
gate_name = gate.qasm_name if not (hasattr(gate, 'adjoint') and gate.adjoint) \
else gate.qasm_name_adjoint
if gate_name not in qiskit_gate_table:
Expand All @@ -195,8 +195,7 @@ def _recover_dag(self, circuits_and_nodes: List[Union[zx.Circuit, DAGOpNode]]) -
return dag

def run(self, dag: DAGCircuit) -> DAGCircuit:
"""
Run the ZX transpiler pass on the given DAG.
"""Run the ZX transpiler pass on the given DAG.
:param dag: The directed acyclic graph to optimize using pyzx.
:return: The transformed DAG.
Expand Down

0 comments on commit 793030b

Please sign in to comment.