Gate based Quantum Computer
So how does one program a quantum computer? It is not so different from what a classical computer is doing under the hood: Data are stored in registered and these are connected by a temporal sequence of machine-level commands. These commands are very primitive functions of binary logic. On a modern computer, you do not often see them as it would be unmanageable to directly write big applications in this machine language – a programmer has a compiler at her disposal to break down manageable commands into what the chip can process. It is actually fun to try to see how this happens.
A gate-based quantum computer does the same – only that the data is stored in quantum bits and that there are powerful commands that classical computers do not have – such as „write all possible values into my register simultaneously“ or „entangle two qubits“ – and that looking at your data can influence what is in your register. There are already options out there where you can learn coding on a quantum computer – by writing a classical computer program that can call these powerful quantum functions.
Running these programs as a sequence of commands (also called gates) requires to keep the quantum information alive for a long time – a big and daunting task. Once the qubits interact with their large classical environment, they tend to lose their quantum properties. But you cannot isolate them completely either – how would you then run a program? So if you see a quantum computer with gates, you do not only need to know the number of qubits, you also need to know how many of such errors it could make.
Fun fact: The amount of data that a classical computer would need to store to completely memorize the state of a quantum computer is exponential in the number of qubits. So if you have more than 50 qubits, you cannot store their quantum state in the memory of the largest supercomputers known today. This point is not so far away – and then we can do something useful with them.