A quantum program is not a new kind of application that replaces ordinary software. In practice it is usually a Python script. Most of its lines are classical; a small part describes what the quantum processor should do, and the rest prepares the input and makes sense of what comes back.
What does a quantum program consist of?
The quantum part is a description. For a gate-based machine it is a circuit: which gates act on which qubits, in which order, and which qubits are measured at the end. A quantum annealer has no circuit. Its program is the optimisation problem itself, written as a QUBO: a table of coefficients that defines a cost over yes/no variables.
The classical part does everything else. It turns the data of the problem into a circuit or a QUBO, sends the job, collects the results and processes them. In hybrid algorithms it also runs an optimiser that adjusts the parameters of the circuit from one round to the next.
The division matters: the quantum processor handles only a short subtask, while the classical code controls the flow of the program.
What is the usual workflow?
- Build the circuit in code, starting with a small instance of the problem.
- Test it on a simulator, a classical program that calculates what an ideal processor would return.
- Compile it for a specific processor. This step, often called transpiling, rewrites the circuit so that it uses only the gates the processor supports and the connections that actually exist between its qubits.
- Run it many times. A single run yields one string of 0s and 1s, so the circuit is repeated hundreds or thousands of times.
- Analyse the statistics: which results appeared how often, and what that says about the problem.
Real processors are normally reached through the cloud, so steps 3 and 4 usually involve a remote service and a queue.
Which tools are used?
- Qiskit is an open-source software kit that originated at IBM.
- Cirq is an open-source framework developed by Google.
- PennyLane, developed by Xanadu, is an open-source library focused on hybrid programs and quantum machine learning.
- OpenQASM is a text format for describing circuits. It is a kind of assembly language that serves as a common exchange format between tools.
- For annealers, the problem is expressed as a QUBO and submitted with the manufacturer’s Python tools.
These kits offer the same basic building blocks: objects for circuits and gates, simulators, a compiler and connections to hardware. They overlap in what they do, and most can target simulators and processors from more than one provider. The concepts carry over from one kit to another, so the choice of a first tool matters less than it may seem.
What will a classical developer find unfamiliar?
- States cannot be copied. An unknown quantum state cannot be duplicated, so there is no equivalent of saving a value in a second variable as a backup.
- Measurement destroys the state. Reading a qubit returns 0 or 1 and ends its superposition. Intermediate values cannot be inspected along the way without changing the computation.
- Gates are reversible. Every gate can be undone by another gate, so a circuit does not overwrite or discard information the way classical code does when it reassigns a variable.
- Results are probabilistic. The answer is a distribution over many runs, and on real hardware noise is mixed into it.
- Debugging is different. There are no breakpoints on a quantum processor. Developers test small pieces on a simulator, where the full state can be examined, and compare the ideal results with what the hardware returns.
The way algorithms are designed is unfamiliar too. Instead of branching and looping over data, a quantum algorithm arranges interference so that wrong answers cancel and right ones are reinforced.
Which skills help, and what is a realistic first project?
Linear algebra matters most: qubits and gates are defined with vectors, matrices and complex numbers. Probability and basic statistics are needed to interpret results, and Python to use the tools. A physics degree is not required for writing programs; knowledge of the application area is.
A realistic first project has two stages. First, build a two-qubit circuit that creates an entangled pair, run it on a simulator and check that the results 00 and 11 each appear about half the time. Then run the same circuit on a real processor and observe that 01 and 10 now appear occasionally. That is noise.
In the second stage, take a small optimisation problem with a handful of variables, formulate it as a QUBO and compare a classical solver with a quantum approach. The goal is to learn the workflow, not to outperform classical software.
How Q&Co can help
Q&Co offers training and consulting for teams starting with quantum software, and develops hybrid quantum-classical algorithms for specific industrial problems. If your team wants to move from first experiments to a well-defined pilot, contact us.