Slashdot Mirror


Quantum Computing Programming Language

William Walker writes "The Economist has an article in its new issue describing attempts to write a programming language for quantum computers, if and when they appear. It does a good job of putting the challenges of qubits versus regular bits into layman's terms. ... The original paper is here."

24 of 232 comments (clear)

  1. Future work... by Cutriss · · Score: 5, Funny

    Port Slashcode to this, and we'll have FP comments *before* the articles appear!

    --
    "Mod, mod, mod...and another troll bites the dust."
    1. Re:Future work... by br0ck · · Score: 5, Funny

      But, luckily, as soon as they're observed they'll disappear.

  2. A name for the new quantum language by dfn5 · · Score: 4, Funny

    c??

    --
    -- Thou hast strayed far from the path of the Avatar.
    1. Re:A name for the new quantum language by OECD · · Score: 5, Funny

      In honor of Schrodinger: c@

      --
      One man's -1 Flamebait is another man's +5 Funny.
    2. Re:A name for the new quantum language by TeknoHog · · Score: 4, Funny
      As a physicist who likes scripting languages, I propose the following:

      (|Perl> + |Python>)/sqrt{2}

      And as soon as I get a quantum cable connection, you can warez my copy of "The Qubbit, or (|There> + |Back again>)/sqrt{2}".

      --
      Escher was the first MC and Giger invented the HR department.
  3. Heisenberg says... by pr0nbot · · Score: 5, Funny

    attempts to write a programming language for quantum computers, if and when they appear

    Just don't observe them and they will appear!

  4. Seen Quantum::Superpositions by legLess · · Score: 5, Interesting

    Perl's had support for quantum computing for three years, thanks to Damian Conway's Quantum::Superpositions module. I saw him do a presentation in Portland few months back, and it was pretty mind-blowing. It may seem odd to talk about programming a computer that doesn't exists yet, but Q::S actually works.

    The promise of quantum computers is doing computations (as Damian says) "in multiple universes, in constant time" and Q::S obviously can't do this. It can and does, however, act like you're programming a quantum computer by allowing you to give one scalar multiple simultaneous values.

    Like Perl wasn't confusing enough, now it's like programming line noise ... in multiple universes :)

    --
    This isn't as much "normalization" as it is "don't take so many drugs when you're designing tables."
    1. Re:Seen Quantum::Superpositions by nihilogos · · Score: 5, Insightful

      I have to say that while it's an excellent Perl module it's utterly useless for the purpose of describing/studying quantum computers.

      Two criticisms I have from 20 seconds reading the CPAN page are

      1. It only seems to handle equal superpositions
      2. He seems to be unaware that even though you can perform computations in parallel on a superposition , you can only access the result of a SINGLE computation. So the primality testing example he includes isn't going to be running on a quantum computer.

      The language Betteli et al describe isn't breaking any new ground in physics, but it's aim is probably to enable computer scientists to start trying to apply formal methods in analyzing quantum computer programs. Maybe they'll have more luck coming up with new algorithms.

      --
      :wq
    2. Re:Seen Quantum::Superpositions by .com+b4+.storm · · Score: 4, Interesting

      To give people an example of what Quantum::Superpositions does, take the following snippet of code:

      if($foo == 1 && $foo == 2 && $foo == 3) {
      print "hooray";
      }

      With traditional Perl, such a condition could never evaluate to true. After all, if $foo is 1, how can $foo be 2 and 3 as well? Now take a look at the following:

      use Quantum::Superpositions;

      my $foo = any(1, 2, 3);

      if($foo == 1 && $foo == 2 && $foo == 3) {
      print "hooray";
      }

      Thanks to our Quantum-powered Perl (heh), this condition is true. $foo is 1, 2, and 3 all at once. Sort of. In quantum terms, $foo isn't any of those values. But once you test $foo to see if it is 1, it becomes 1. And when you look to see if it's 2, it becomes 2, etc. But if you test $foo to see if it is 4, it is not - that's not one of the possible values.

      --
      "Wow, you're like some kind of superhero able to ward off happiness and success at every turn."
      -- Ryan Stiles
  5. layman's terms... yea right by Christopher_G_Lewis · · Score: 4, Funny

    It does a good job of putting the challenges of qubits versus regular bits into layman's terms.

    Yea right. A sample run past my mom...

    (Mom reads the article...)

    Mom: Will this make FreeCell any easier?

    Me: Well, a quantum computer could actually solve all the possible shuffles of FreeCell in one pass.

    Mom: That wouldn't be any fun... Would the Internet be faster?

    Me: Not until we get rid of your dialup and get you a cable modem.

    and so on :-)

  6. Re:Q! by __aaklbk2114 · · Score: 5, Funny

    Better yet, Q#: the fastest way to negate any speed improvments gained by quantum computers.

  7. Re:that'll never happen by scott1853 · · Score: 4, Funny

    This article is about quantum programming, not Windows programming.

  8. You are correct! by twitter · · Score: 4, Interesting
    So how are they going to handle an infinite number of variables? Oh right, dont worry... Someone else's problem?

    Yes. With an infinite number of universes, there are an infinite number of you typing the code. Most of you will get it right and the computer will average the correct answer for you. So there, an infinite number of monkeys CAN write Shakespere, GUIs or anything else they please.

    Microsoft has been working on this for a long time with their robot code from thier IDE. It still looks random and does not work quite right because they have not figured out how to make regular digital logic uncertian. When they figure that out, they will have it.

    A gold star for you.

    --

    Friends don't help friends install M$ junk.

  9. Sample line of code by jamesmartinluther · · Score: 5, Funny

    my $cat = new Cat('Felix');
    my $occupants = [$cat];
    my $room = new Room($occupants);
    $room->kill_occupant($cat);

    # is he dead?
    $room->status_occupant($cat);
    # doh!

    - James

  10. Re:Isn't this the job of the compiler? by The+Only+Druid · · Score: 5, Insightful

    Yes, not to be patronizing, but you're missing the point.

    No matter how non-linear the programming of current software seems to be [i.e. through multithreading and object oriented programming], the software nonetheless relies on the fact that certain things will occur in a certain chronological order.

    Quantum computing's power is in the ability to perform truly simultaneous, non-sequential operations. As a result, an entirely new language must be written to implement the new types of processes which are possible.

    As an anology, consider the "programming language" of an abacus. When a computer is compared, you dont talk about writing a new "compiler" for abacus code on the computer, you write a new language. Similarly, quantum computing is in many ways something wholy different from normal computers.

    --
    "Stumble before you crawl"
  11. Re:that'll never happen by tomhudson · · Score: 4, Funny

    even worse - half the time, when you order your quantum computer and you open the box, it will be DOA.

  12. Curse my physics background! by dabootsie · · Score: 5, Funny

    If I didn't know the difference between quantum superposition and tachyons, I'd probably have found that funny too.

  13. Re:Ok... by Jason1729 · · Score: 4, Insightful

    Not quite. This is more like Boole working out the basic theories of digital logic in the mid-19th century, long before anyone thought of digital computers.

    Jason
    ProfQuotes

  14. Heisenburg Works for code, too by GuyMannDude · · Score: 4, Funny

    Personally, I'm just waiting for someone to complain to me that they found a bug in my quantum code:

    "It wasn't like that when I originally coded it! You must have looked at it or something! So it's really your bug now, isn't it?

    GMD

  15. Sample code: by Anonymous Coward · · Score: 5, Funny

    if(1 && 0)
    {
    DoBothBranches();
    }
    else
    {
    DoBothBranchesAnyways();
    }
    else
    {
    WhatTheHellIsGoingOn();
    goto PrintAnswerToQuestionYouWereThinkingOf();
    }

  16. Strangeness by Anonymous Coward · · Score: 4, Interesting

    I've put a little thought (very little) and it's a very interesting issue. First, for the doubters, they do have some quantum computing successes, the basics are proven. It's worth figuring out what the language is like. A couple things occur to me.

    (1) Loops. Don't need them. You just have one line, when you use index "i", it contains all the possible values, so all loops are single statements.
    OK, so in general, you won't have issues with flow logic, you write a forumula and theoretically all possible answers are in the output and the input also represents all possible inputs. So this languages is going to have less to do with flow control and more to do with filtering out all the unwanted answers. Not just "wrong" answers that don't fit, but extra answers. To use the looping analogy, if you have a qbyte index and would normally loop through to the total number of elements, the qbyte will loop through all it's values, some of which might be out of range, create numerical problems like divide by zero.

    Ok, this should be easy for you to tear apart since it's not well thought through, but what do you expect, a freaking Quantum genius to post this?

  17. Yay by dubbayu_d_40 · · Score: 4, Funny

    GOTO will be all the rage. Maybe they'll call it LEAP instead!

  18. Perhaps the new language might be Set oriented? by Mr.+Asdf · · Score: 5, Insightful

    Here's my take on the new language. (Sorry this is so simple for you seasoned programmers.)

    Consider how you might factor a large number:

    N = 23489803289

    for (i=3;i lessthan N;i=i+2)
    {
    if (N/i has remainder 0)
    FACTORS = i and N/i
    }

    This algorithm takes up to the square root of N tries to complete. This is really slow for big numbers.

    If you look at the algorithm, even a quantum computer would not really be able to improve on it, unless you had an EXTREMELY smart compiler that could recognize that each try is independent and could be separated. But that is wishful thinking. Instead, consider using sets:

    S: {3, 5, 7, ... ,sqrt(N)}
    (S is the set of odd numbers from 3 to the square root of N)

    Now the code might look like this:

    Function Divide(S(x), N)
    {
    if (N/S(x) has remainder 0)
    FACTORS = S(x) and N/S(x)
    }

    Now the Divide function would be called with the entire set. Compilers would still need to be smart, but the intent here is utilize the parallel processing of the New hardware. So I'm guessing a language similar to LISP might be a good starting point.

    Thoughts?

  19. Re:languages that assume answers by mindriot · · Score: 4, Insightful

    No... quantum computing will not allow you to factor in constant time or anything, or by "assuming the answer", get back the factors. Your idea seems to be "let's take the result and then calculate backwards" so to speak. But that won't work. Now if we could create two superpositions of "all numbers between 0 and sqrt(c)" (to put it in an easy way), calculate the product and then find a way to filter out all results equal to c (which seems to be what you're looking for), then we'd of course be able to simply measure the factors. But the problem is that you can't "filter out" only the results you want to look at. You might be able to slightly increase the likelihood of measuring the 'correct c' and therefore getting correct factors. That's (very simply put) what Shor's algorithm is doing - it only manages to increase the likelihood to measure the right result and therefore retrieve correct factors.

    Note that I'm grossly oversimplifying...

    Another example is trying to solve 3CNF-SAT - figure out whether a formula in 3CNF can be satisfied - in O(1). Classically, it's an NP-complete problem with exponential complexity. Now the naïve attempt would be to create a superposition of all possible inputs, filter out only those that yield "true" as a result, and then measure the "filtered" superposition to get a solution. Same problem; you can't really filter out the "true" results, you can only make it slightly more likely to measure a "1" as a result and therefore retrieve a solution for the input. You'd still need to repeat that for a couple of times, only less often as in the classical case - but still not in O(1), or even O(n).

    So no, quantum computing is not that much of a magic solve-everything-instantly machine... e.g. Grover's algorithm to find an element in an unsorted list will not bring you from classical O(n) to O(1), but rather O(sqrt(n)).

    But then again, maybe you're just trolling :)

    Anyway, I found this paper here very interesting: it's called "Quantum Computing for Non-Physicists".