Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add status badges to README.md. #42

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading