Introduction to Quantum Computing Languages (QCL)
Alright, so quantum computers sound great, right? But how do we do anything with them?
I mean, think about it right? Every single program that has been written for a traditional computer, from banking software to word processors to the browser that you are using to read this article has been written for a traditional computer architecture, ie an architecture that is based in bits, i.e. 1s and 0s.
Quantum computers, however, are based in qubits. So none of the software that’s been written for a traditional computer will function on an entirely qubit-based processor.
Massive, multinational technology companies are racing to complete a functioning qubit computer with enough processing power to mean something. But when they finally make on, how are they going to run a program on it?
Enter quantum computing languages.
Quantum computing languages are a computer scientists way of abstracting the computing away from the underlying complex math and theoretical physics in a quantum computer.
There are only a few out there right now, but they are designed to resemble existing, traditional computer languages as best as they can in order to lower the barrier to entry for software engineers to write programs for quantum computers.
In this article, we are going to talk about the Quantum Computation Language (QCL). QCL was the first quantum programming language made to resemble existing quantum languages. Its creator, Bernhard Ömer, specifically wanted it to resemble C and Pascal.
So, without further ado, we present QCL:
In order to assist programmers to make the transition from traditional computers to quantum computers, QCL is endowed with several features from most other object-oriented computer languages.
QCL supports many data types that are considered fundamental to modern programming, including ints, booleans, strings, vectors, and matrices.
QCL also supports many built in functions that one can find in other common programming languages, such as Java, C++, and Python. These functions include mathematical functions such as sin, cos, and tan, as well as functions such as print.
However, QCL also supports quantum-specific data types as well as quantum-specific functions.
QCL introduces the quantum register, called a qureg. The qureg is considered to be the foundation quantum data type in QCL.
The qureg is interpreted as an array of qubits. Recall how you can declare an integer as follows in C++:
In QCL, one can declare a qureg as follows:
The above code snippet indicates a qureg of size two, which you can think of as an empty array of type qubit of size 2.
QCL also has quantum-specific functions. The most noteworthy one is the Hadamard transformation.
The Hadamard transformation is used as a one qubit rotation. It effectively maps the basis states of a qubit to a set of superimposed states.
It is called QCL with a simple:
QCL also allows for user defined operators. So one could easily write their own functions in QCL to manipulate a quantum computer. One does this by calling the operator keyword.
operator example(qureg qu
The most intriguing feature of QCL in my mind is the dump() command. When one calls dump, the program dumps out the current state of all of the qubits in the program in terms of their basis states:
It outputs something like this:
dump : STATE: 2 / 16 qubits allocated, 14 / 16 qubits free 0.35355 |0> + 0.35355 |1>…. etc
Pretty cool, right?
Want to learn more about QLC? Want to play around with it yourself? The Quantum Authority has forked a port of QLC to our Github. Be sure to check it out.
QCL is an imperative programming language, meaning that it is object-oriented and made to resemble existing, traditional computing languages. There are also a group of functional quantum programming languages, the most important of which are QFC and QPL, both created by Peter Selinger. We’ll write about them in a future post