mentpy icon indicating copy to clipboard operation
mentpy copied to clipboard

Support `OpenQASM` exports

Open kennethbruskiewicz opened this issue 2 years ago • 2 comments

This translation step should allow interpolation to other representations of quantum processes.

This would include PyZX, Qiskit, and perhaps others libraries commonplace in the ecosystem.

An initial strategy without writing an OpenQASM interpreter from scratch or having to be familiar with the spec yet:

  • [ ] Convert a GraphState from and MBQCircuit into a quantum circuit using H state preparation and CZ gates
  • [ ] Traverse the composition of gates using an intermediary syntax tree representation of the quantum circuit
  • [ ] Compose an equivalent circuit in Qiskit after visiting each qubit
  • [ ] Export Qiskit circuit to OpenQASM

A more direct strategy would write our own transpiler after the second step. Testing and maintaining that transpiler for correctness could create duplicate work, so I'd suggest norming against a trusted transpiler for now.

See also https://github.com/BestQuark/mentpy/issues/4

kennethbruskiewicz avatar Jun 21 '23 17:06 kennethbruskiewicz

The Qiskit library has a Graph State object which takes an adjacency matrix as a function:

https://qiskit.org/documentation/stubs/qiskit.circuit.library.GraphState.html

Potentially, mentpy.GraphState => nx.Graph.adjacency_matrix() => numpy array => qiskit GraphState, then measure the qubits in the parameters passed to MBQCircuit at a point of preparation.

kennethbruskiewicz avatar Jun 21 '23 19:06 kennethbruskiewicz

Clarifying the goals of the QiskitSimulator and seeing if these could be constructed in the same sprint or in two consecutive sprints could he helpful.

https://github.com/BestQuark/mentpy/blob/main/mentpy/simulators/qiskit_simulators.py

Also knowing if these simulators all take OpenQasm makes this issue high-impact.

kennethbruskiewicz avatar Jun 22 '23 18:06 kennethbruskiewicz