
QCL – A Programming Language for Quantum Computers - kushti
http://www.itp.tuwien.ac.at/~oemer/qcl.html
======
reikonomusha
Unfortunately, a language like QCL is a bit far away from being a practical
language for quantum computers, in the sense that it will be difficult to use
on upcoming machines. QCL is of course perfectly fit for experimentation. In
my opinion, when you have a quantum computer that has resources akin to a
classical computer with RAM measured in tens of bits with stable lifetimes
measured in tens of microseconds, using a language that is similar to C gives
you a somewhat wrong impression of what you're able to do. While not
universally true with C programming, C often abstracts away the idea of finite
memory/stack/etc. This is generally a good idea when resources are plentiful.
But this very sharply contrasts with near-term quantum computers. Of course,
just as with C, one could imagine compiling QCL into a simpler language, with
the expectation that QCL programmers can intuit what the compiler will produce
as "machine code".

As discussed in a recent paper [1][2], it's pragmatic to think of quantum
computation in a coprocessor model. QCL takes a different approach: a high-
level language that has a quantum datatype in the midst of the traditional
classical datatypes along with their plethora of classical operations. I think
that cordoning off the quantum computation as much as possible into a separate
processing unit will make eventual adoption much easier. It also makes
integration with existing languages much easier. QCL doesn't preclude this
idea, but having a quantum coprocessor model implicitly manifest in QCL makes
its implementation very difficult.

[1] [https://arxiv.org/abs/1608.03355](https://arxiv.org/abs/1608.03355)

[2]
[https://news.ycombinator.com/item?id=12277552](https://news.ycombinator.com/item?id=12277552)

~~~
repsilat
What do you think of it for pedagogical purposes? Even if it were impossible
to implement, I wonder if an interface closer to traditional programming might
lower some barriers to understanding what a quantum computer can do, and how a
quantum algorithm might work. Perhaps "prototype in Python, rewrite the slow
bits in C" could be adapted to quantum computing.

~~~
reikonomusha
I think a problem with thinking "an interface closer to traditional
programming" is that it's really difficult to get anywhere close to what
traditional programming is in any meaningful sense. It, QCL, _looks_
traditional because it looks like C with qubit registers (i.e., on the
surface, "just another datatype"), but quantum programming is anything but C.
No printf'ing quantum states, no qmemcpy, no qmemset, no stepping debugger, no
hexdumping, etc. These things are more-or-less quantum impossibilities of ever
having, and so we need to think about things in a new way. Trying to hang on
to C(-like) programming for pedagogical purposes is more or less a lost cause.
With that said, I do not claim that there is no utility in something like QCL.
I just don't think it's right, right now.

A very rough analogy, I suppose, would be "let's make Haskell more accessible
by doing away with monads and referential transparency". At that point, you've
departed from the paradigm Haskell puts forth, and you actually haven't made
Haskell any bit accessible.

Your second point about "prototype in Python, rewrite slow bits in C". There
isn't, as far as I'm concerned, that sort of problem with quantum programming
at the moment. Maybe in a decade or two. It is difficult enough to even get an
algorithm working altogether, let alone reasoning about speeding it up. To
reason about speedups, you need a framework in which you can reason about
performance on some machine model. One such machine model is described in the
aforementioned reference.

~~~
djsumdog
This guy has some amazing videos on the basics of quantum computing and QCL:

[https://www.youtube.com/watch?v=GO6TsdwxcwM](https://www.youtube.com/watch?v=GO6TsdwxcwM)

I wish he had the people and support to help make animations and present the
formulas in the correct notations. It starts to make sense though.

I want to get into quantum computing, especially since IBM has one you can
play with on-line (your program queues up like old fashion punch cards):

[https://quantumexperience.ng.bluemix.net/](https://quantumexperience.ng.bluemix.net/)

..but to really use it, you need to know how these super weird quantum gates
work. From what I can tell with QCL, everything a quantum computer can do, we
can do with traditional computers. It's just that simulating 100 qbits takes
an ungodly amount of memory and processing power. Quantum computers can't
replace traditional computers, they're for a very specific problem space that
can be defined with these quantum gate concepts.

~~~
Strilanc
Try the video series Quantum Computing for the Determined [1]

My simulator, Quirk [2], is a bit easier to experiment with than IBM's. But it
still assumes you know the basics.

1:
[https://www.youtube.com/playlist?list=PL1826E60FD05B44E4](https://www.youtube.com/playlist?list=PL1826E60FD05B44E4)

2:
[http://algorithmicassertions.com/quirk](http://algorithmicassertions.com/quirk)

------
pmontra
A suggestion to the author: the documentation must be in HTML pages, not PDF
files. That would help search immensely and make references much easier.
Furthermore, how about loading the code on GitHub or the like instead of
distributing tarballs? Both PDF and tarballs smell of 90s.

Actually I remember tuwien.ac.at from the times where I was downloading
software sources from FTP mirrors in the early 90s, so that's a good nostalgic
fit :-)

A suggestion for other researchers: start with a git repository and
documentation written as .md files. Then write your thesis with LaTeX and
export a PDF if you feel like, but for all the developers the source of truth
will be the repository and the mds.

~~~
gjolund
All of the docs on that site are from the early 2000's

------
lokedhs
I was reading the linked document titled "Quantum Programming in QCL" which
contains the following definition of a Fibonacci function. As far as I can
tell this thing calculates nothing like the Fibonacci sequence. Can anyone
explain what the thinking is behind this code?

    
    
        int Fibonacci(int n) { // calculate the n-th
            int i; // Fibonacci number
            int f; // by iteration
            for i = 1 to n {
                f = 2*f+i;
            }
            return f;
        }

~~~
nylsaar
I don't even qualify as a novice, but it seems f(the first iteration) would
need start with 0.

With this sequence of numbers 1,1,2,3,5,8 it seems to be calculating

f=0 as 2 * 0+1=1 ; f=1 as 2 * 1+1=3 ; f=2 as 2 * 2+1=5 ; f=3 as 2 * 3+2=8 ;

then f=4 should be 2*5+3=13

I'm not sure how 2 is calculated unless i=0, but this is why I'm not even a
novice.

------
boznz
Adds new keywords "INDECISIVE OR", "MAYBE IF" and "PROBABLY EQUALS" :-)

------
panic
Some recent work on rendering graphics with quantum computers:
[http://machinelevel.com/qc/siggraph/hello_siggraph_2016.html](http://machinelevel.com/qc/siggraph/hello_siggraph_2016.html)

~~~
corysama
Discussion:
[https://news.ycombinator.com/item?id=12405428](https://news.ycombinator.com/item?id=12405428)

------
danielam
These languages have been around for some time. QML is another
([http://www.cs.nott.ac.uk/~psztxa/publ/qml.pdf](http://www.cs.nott.ac.uk/~psztxa/publ/qml.pdf))
as is Quipper
([http://www.mathstat.dal.ca/~selinger/quipper/](http://www.mathstat.dal.ca/~selinger/quipper/)).

------
flukus
It really needs a "show me the code" section, not links to a thesis.

------
adamnemecek
I feel like quantum computers are getting all the spotlight but optical
computers are every bit as cool and quite a bit more viable right now.
Furthermore we do need to develop this industry because it would be ridiculous
to still be using wires with quantum computers.

~~~
flukus
Kind of reminds me of how the boeing 747 was only ever meant to be a stopgap
and everyone thought the real future was supersonic.

Optical computers will be drop in replacements for our current ones won't
they?

~~~
adamnemecek
I think at least in our generation, yeah. But who knows. There's also optical
quantum computing.

------
1_listerine_pls
For those interested [https://www.edx.org/course/quantum-mechanics-quantum-
computa...](https://www.edx.org/course/quantum-mechanics-quantum-computation-
uc-berkeleyx-cs-191x)

------
mrspeaker
"Changes in 0.6.4: Dump format supports polar coordinates" made me laugh: I'm
sure it makes a lot of practical sense, but my non-qubit-enabled brain can't
fathom why that would be necessary!

