# The Challenge of Coding for Quantum Computers

While exploiting fundamentally different physics, quantum computing chips are similar to their conventional brethren in that they cannot consume a higher level programming language. In the classical realm, programs have to be translated into machine code either via compilation step or an interpretative layer. For a quantum computer, it always has to be the former, as the chip has to perform quantum evolution (unitary transformations) while being completely shielded from the environment.

Hence, there is always a compilation step required when one wants to code for a quantum computer on a higher abstraction layer.

The following diagram illustrates this process.

The visual development app Quantum Fog outputs unitary matrices that are subsequently compiled by the Qubiter tool into a series of elementary quantum computing operations (e.g. controlled-nots and qubit rotations).

### 1. Quantum Fog

This software is a prototype OS X application for modeling physical situations that exhibit quantum mechanical behavior (See Figure 5 for a screenshot.) It is a tool for investigating and discussing quantum measurement problems graphically, in terms of tailored network diagrams, called quantum Bayesian nets. It can calculate one- and two-variable conditional probability distributions, and create a picture for every Feynman path that contributes to a physical situation. As such, it represents an ideal visual language for quantum computing, and can subsequently feed its output to the *Qubiter *quantum compiler that then assembles a series of elementary quantum computing operations suitable for a gate based architecture.

The following screenshot shows a simple Quantum Bayesian net example in the Quantum Fog application for the qubit teleportation algorithm.

The *Qubiter* software is fully functional but still limited in scope. In its current version 1.11, *Qubiter* takes as input an arbitrary unitary matrix, and returns as output an equivalent sequence of elementary operations (QC operations like controlled-nots and qubit rotations). Such sequences are often represented graphically by qubit circuits.

Future versions of *Qubiter* will take an arbitrary QB net as input, and return an equivalent sequence of elementary operations. We also plan to add further optimizations and some quantum error correction, and add support for additional architectures such as adiabatic quantum computing (AQC). The latter is a research priority as the first commercial QC hardware falls into this category, i.e. D-Wave implements a subset restricted to the Ising (spin-glass) model, and at the time of writing, the Google chip is also expected to implement AQC.

Exploring the applicability of QB net across all feasible quantum computing schemes is an overarching research program; we believe it has paradigm changing potential, but will require a multi-year focus.

In addition, the following modules have been developed and implemented in Java:

### 1. QuanSuite

QuanSuite is a collection of Java applications that compile various input evolution operators U_{in}. The applications output a quantum circuit for U_{in}, where U_{in} is specified either directly, or by giving a Hamiltonian H such that U_{in}=exp(iH). The following applications have been implemented:

Application |
Outputs Quantum Circuit for… |

QuanFou |
Discrete Fourier Transform |

QuanFruit |
The NAND formula evaluator proposed by Farhi-Goldstone-Gutmann in quant‑ph/0702144. This is the most complex application of QuanSuite. It uses classes from QuanGlue, QuanLin, QuanOracle, QuanShi, and QuanTree. |

QuanGlue |
exp(iH), where H = g(|j><k| + h.c.) (I call this H, “glue” of j and k states) |

QuanLin |
exp(iH), where H is incidence matrix of line (finite open string) of states |

QuanOracle |
exp(iH), where H is a “banded oracle”, as described in arXiv:0706.0479 |

QuanShi |
Unitary matrix that takes |j> to |(j+k)mod N> (a “state-shift”) |

QuanTree |
exp(iH), where H is incidence matrix of balanced binary tree |

### 2. QuSAnn with Multiplexor Expander

*QuSAnn* is a code generator for quantum simulated annealing: After the user inputs some parameters, it outputs a quantum circuit for performing simulated annealing. This Java application implements the algorithm of Wocjan et al.(arXiv:0804.4259), which improves on the original algorithm of Somma et al.(arXiv:0712.1008). The quantum circuit generated by *QuSAnn* includes some quantum multiplexors. The application *Multiplexor Expander* allows the user to replace each of those multiplexors by a sequence of more elementary gates such as multiple controlled NOTs and qubit rotations.

### 3. Quibbs

*Quibbs* generates code for quantum Gibbs sampling: after the user inputs configuration files that specify a classical Bayesian network, *Quibbs* outputs a quantum circuit for performing Gibbs sampling of that Bayesian network on a quantum computer. *Quibbs* is a Java implementation of an algorithm that combines various best-of-breed techniques such as: an adaptive fixed-point version of Grover’s algorithm, Szegedy operators, quantum phase estimation and quantum multiplexors.

### 4. QOperAv

QOperAv is a Java tool that can be used to evaluate certain quantum operator averages, hence its name. Like the other software, it compiles these operations into a quantum circuit.

### 5. Lisbeth

This is a Java software package that bundles several components.

*qSym*, calculates the symmetrized version of a given function.*qMobius*, performs the Mobius Transform of a given function.*qMargi*, returns a marginal probability distribution of a given probability distribution.*qMean*, determines the mean value of a given function.*qJennings,*allows one to discover from data the structure of a classical Bayesian network.

In addition, a quantum computing library for the scientific numerical software Mathlab/Octave has been developed.