QCL - A Programming Language for Quantum Computers
Despite many common concepts with classical computer science, quantum
computing is still widely considered as a special discipline within the
broad field of theoretical physics. One reason for the slow adoption of
QC by the computer science community is the confusing variety of
formalisms (Dirac notation, matrices, gates, operators, etc.), none of
which has any similarity with classical programming languages, as well
as the rather ``physical'' terminology in most of the available
literature.
QCL (Quantum Computation Language) tries to fill this gap: QCL is a
high level, architecture independent programming language for quantum
computers, with a syntax derived from classical procedural languages
like C or Pascal. This allows for the complete implementation and
simulation of quantum algorithms (including classical components) in one
consistent formalism.
Download
The current version of QCL is 0.6.7 (Dec 22 2022):
Due to limitations of the glibc2, the QCL 0.6 binary distributions no longer contain static binaries. If your systems lacks the necessary libraries for the precompiled binary, you can try qcl-static from qcl-0.5.1-bin.tgz which should run on most Linux systems.
The QCL interpreter is Open Source software under the terms of the GNU General Public Licence (GPL), version 2. See COPYING for details.
Changes in 0.6.7:
Fixed bug when allocating 32 or more qubits at once.
Changes in 0.6.6:
Fixed the != operator for quantum condition (was treated as ==).
Thanks to Sebastian Schmitt for spotting this bug.
Changes in 0.6.5:
Removed -lfl (i.e. linking against libflex) from the linker options as it seems to break compilation on newer systems.
Changes in 0.6.4:
Dump format supports polar coordinates. Minor updates for gcc 4.7. Dropped the 32-bit binary package.
Changes in 0.6.3:
This is a minor bugfix release to fix the emulation of the conditional swap gate (Fredkin gate).
Thanks to Jaroslaw Miszczak for spotting this bug.
Changes in 0.6.2:
This is mostly a maintenance release to catch up with the ever changing GNU C++ standards. No new functionality was added.
- Code cleanups to make gcc 4.1 happy
- Binary distribution for AMD64 plattform
- Output defaults to decimal for <= 64 qubits
- Minor changes in the Makefile
Changes in 0.6.1:
- Fixed -x option bug caused by new dump format introduced in qcl-0.5.1
- Support for user qcl directories ($HOME/.qcl by default)
- New option --qcluserdir and enviroment variable QCLUSERDIR
- --include-path renamed to --qcldir
- New option --light-color for xterms with black background
Changes in 0.6.0:
- Compatibility with GCC 3.x
- Code cleanups for ISO C++ compliance
- Dropped static binary support
Changes in 0.5.1:
- Double declaration as "qufunct operator" for non-boolean implementations
of basis permutations
- Recursive operator definitions
- New auto-dump format which displays registers
- Sample implementation of Deutsch's algorithm
Changes in 0.5.0:
- Conditional Operators, quantum conditions and quantum if-statement (experimental)
- Vectors, matrices and tensors (see linalg.qcl)
- New elementary operators (see default.qcl)
- Plotting of states and spectrums via the new "plot" command
- New and revised sample programs
- break-statement for loops
- Bitwise not, and, or, xor as built-in functions
- Built in function bit(n,i) (i-th bit of binary expansion of n)
- Improved TeXmacs support
- Support for keyboard interrupts (SIGINT, SIGTSTP)
- Optimizations in the simulation layer (more than 300% speedup in some cases)
- Removal of legacy code for old complex- and string-classes
- Improved support for non-Intel platforms
- Rewrite of Error handling to use C++ exceptions
- Major code-cleanups
- Countless bug fixes
Changes in 0.4.3:
Changes in 0.4.2:
- Compile glitch fixed with RedHat 7.2.
- Nicer output of quantum states.
Changes in 0.4.1:
- ANSI C++ compliance (except for local array variables).
- Fixed unitarity testing for matrix operators.
- Minor bugfixes.
Changes in 0.4.0:
- As the available documentation already exceeds the size of the
source code by an order of magnitude, the manual is no
longer part of the main distribution.
If you are new to QCL, you probably want do check out the
Documentation section below.
- A sample implementation of Grover's Database Search algorithm
is contained in the lib directory.
- The QCL searchpath now also looks for qcl-files in ./lib.
- Besides the dynamically linked program, the binary package now also
contains a static binary qcl-static.
- minor bugfixes.
Older Releases:
Feedback
If you have any questions about QCL, if you encounter any problems running
QCL, if you miss certain features, if you have patches, ports, QCL scripts
or suggestions for improvements, or even if you are just a happy user,
then please let me know about it.
Documentation
- Structured Quantum Programming
· [Postscript]
· [PDF]
My PhD thesis on structured programming languages for quantum computing (latest revision Jan 9 2009).
- A Procedural Formalism for Quantum Computing
· [Postscript]
· [PDF]
My master thesis in theoretical physics about QCL.
Besides a general introduction to
quantum programming and a description of the
language, a complete QCL implementation of the
Shor algorithm is presented.
- Quantum Programming in QCL
· [Postscript]
· [PDF]
My master thesis in computing science deals with computational and
architectural questions of quantum programming and illustrates the design of
quantum algorithms in QCL.
For readers with a CS rather than a physical background, this book
also features a brief introduction into quantum physics in general.
- Classical Concepts in Quantum Programming
This paper from the QS2002 conference describes classical concepts in QCL, including new features like conditional operators, quantum conditions and quantum if-statements. The print version appeared in the International Journal of Theoretical Physics 44/7, pp. 943-955, 2005.