

Quantum Programming with Perl 189
moyix writes: "There's an article over at perl.com that describes how to use a perl module called Quantum::Entanglement. Using this module, one can simulate programming for a quantum computer. Developers looking to keep their skills current well into the next decade should check this out ;) Debian folks can grab libquantum-entanglement-perl and libquantum-superpositions-perl."
Shave and a haircut, qubits! (Score:4, Funny)
thats nice but.. (Score:1)
Re:thats nice but.. (Score:1)
Re:thats nice but.. (Score:1, Offtopic)
perl?!? fuck man, i just don't believe in anything anymore.
Well, of course you can't. That's what EMACS is for.
Re:thats nice but.. (Score:2, Funny)
Re:thats nice but.. (Score:1)
sorting, factoring (Score:2, Informative)
In any case, some researchers at IBM and other places have built small quantum cells than can make use of the above algorithms.
The problem with quantum computing is that many answers are revealed at once, most of which are incorrect. The algorithms need to be able to separate the wrong from the right. It's a task for bright logicians :)
Re:sorting, factoring (Score:2)
Anyway, I want to point out that searching is actually a very general algorithm. Basically, any algorithm that is much faster to validate than construct a solution can be done that way. For instace, one way to factor is to iterate through all numbers less than sqrt(N), testing each one by dividing N by it. This takes O(sqrt(N)) time. Grover's algorithm speeds this up to O(sqrt(sqrt(N)), which is still exponential in the number of bits in N. Not that this is NOT Shor's algorithm, which can indeed factor numbers in polynomic time in the number of bits.
Re:sorting, factoring (Score:2)
Hell, I have an O(1) algorithm for factoring primes!
Factors(p) = { 1, p }.
Now if you had a quantum algorithm for figuring prime factors (or even just a wheelbarrow), then you'd have something. Of course, such an algorithm *DOES* exist.
Re:sorting, factoring (Score:2)
(For those uninitiated, under the Heisenberg interpretation of Quantum Mechanics, you can view any quantum computer's state as a vector space, in which operations are unitary matrices, and making an observation collapses the Schrodinger wave into an eigenvalue.)
For that matter, the same textbook stops using Dirac notation in the latter three quarters of the book, and uses the quantum equivalent of NOTs and XORs as a sort of wiring guide, denoting entanglement and superposition as necessary, to construct a ripple carry adder. This is shortly before it starts diving into Grover's and Shor's algorithms, among others.
Re:sorting, factoring (Score:1)
Which book is that?
Re:sorting, factoring (Score:2, Informative)
Re:sorting, factoring (Score:1)
Re:sorting, factoring (Score:1)
Re:thats nice but.. (Score:2, Informative)
Scientists at IBM Corp.'s (NASDAQ:IBM) San Jose, Calif.-based Almaden Research Center this week rushed to report that they have performed a challenging quantum computer calculation, causing a billion-billion custom-designed molecules in a test tube to become a seven-qubit quantum computer.
With that breakthrough, they solved a simple version of the mathematical problem that is the crux of many of today's data-security cryptographic systems. According to Nabil Amer, manager and strategist of IBM Research's physics of information group, this was quite a feat.
"This result reinforces the growing realization that quantum computers may someday be able to solve problems that are so complex that even the most powerful supercomputers working for millions of years can't calculate the answers," said Amer.
Re:thats nice but.. (Score:2)
But I have myself used a simple NMR quantum computer to execute Grover's search algorithm on a very small (4 element) search space when I was working at MIT. So there.
Re:thats nice but.. (Score:4, Interesting)
For one thing, QCs do exist - in fact, they demonstrated Peter Shor's 1994 factoring algorithm on a recently built 7-qubit box, factoring 15 into 3 and 7. You may say big deal, but it can factor ANY such integer in polynomial time. Usually the NSA is about 10 years ahead of the private sector, so I figure they've got at least 10 qubits by now. You should be worried - most public-key encryption methods rely on the intractibility of factoring.
Secondly, the Heisenberg uncertainty principle only states that you can't predict with 100% accuracy which eigenstate a qubit will collapse into upon measurement. You can, however, compute a probability amplitude (which ends up being a complex number) that it'll be a 0 and another probability that it will be a 1. And it is possible to perform operations upon one or more qubits without measuring it - the idea of creating an operation that doesn't collapse the state is the crux of Quantum Computing.
Unlike macroscopic physics, we don't know WHY things work on the quantum level the way they do. We've gotten relatively decent at predicting the end results though. So, we're just as confused as before... but we're capable of doing useful stuff with it. Don't knock it.
Re:thats nice but.. (Score:4, Funny)
Incoming message for Mr. Shor: Your algorithm doesn't work.
(ob. H2G2 ref.) Wait a minute ... *slaps forehead* Now I understand! 42! It all makes perfect sense now!
Re:thats nice but.. (Score:1)
ps:3 and 5 (typo correction, not flame)
Re:thats nice but.. (Score:4, Insightful)
I wouldn't get too exited about this. Shor's factoring algorithm is a probabilistic algorithm, and for a small number such as 15 you could replace the entire quantum part by rolling some dice and still manage to find factors. So it's possible that the demonstration you refer to messed up somewhere but still managed to factor 15.
Also, NMR quantum computing (which was used for that demonstration) is fundamentally limited to a maximum of around 12 qubits, and I seriously doubt the NSA has got anywhere near 10.
Secondly, the Heisenberg uncertainty principle only states that you can't predict with 100% accuracy which eigenstate a qubit will collapse into upon measurement
This is not the Uncertainty principle. This is the measurement postulate.
The Heisenberg uncertaintly principle says things like " if you know the position of a particle precisely then you can't know anything about it's momentum" etc. Or, to wax technical, the products of the "errors" for position and momentum being greater than half the expectation value of the commutator of the operators represneting position and momentum.
Re:thats nice but.. (Score:2)
Re:thats nice but.. (Score:2)
There is no fundamental theory of quantum computing. As mentioned in another response, there is no boolean algebra equivalent for quantum computing.
Computers are based in absolute truth. Quantum computing relies on probability. That is where my question of praticality comes in.
I do not doubt that the NSA is more technologically advanced but don't give them too much credit...
I get sick of people spouting about how quantum computing is so great because it doesn't even exist yet. This may sound ironic seeing how everyone responded to my post, but it pisses me off when people who have no understanding of quantum mechanics start saying, "Quantum computing means you can executed all your code all at the same time" and stuff like that.
The problem with
No fair! (Score:4, Funny)
Re:No fair! (Score:2)
Entanglement? (Score:5, Funny)
Re:Entanglement? (Score:2, Funny)
print substr("the quick brown fox jumps over a lazy dog.",
$_,1)
for
(1,2,36,3,10,21,38,38,36,
41,9,16,21,7,8,25,36,17,5);
Re:Entanglement? (Score:2)
runtime (Score:1)
Wow (Score:3, Interesting)
The module actually looks pretty cool. It says that some simplifying assumptions were made. Does anyone know if the simulation is reasonably accurate? That is, could you actually set up a quantum computer to behave exactly as the simulated one?
Re:Wow (Score:1)
Adjust reality accordingly.
Perl and Research (Score:2, Insightful)
First of all Perl seems to be an excellent language for Bioinformatics, and Dr. Lincoln Stein is a leading voice in this area. Recently O'Reilly has been giving great coverage in this area.
Nanotechnology seems to be another area where Perl is getting much attention.
I believe the platform and vendor independence, absolute openness, and superb data munging capabilities of it are the main reasons for Perl's adoption in such academic research.
But, although I am an aspiring Perl advocate [pm.org]) and big Larry Wall fan myself, I wonder just how optimized these modules are for such intense low level work....
Re:Perl and Research (Score:2, Informative)
The newsposter misinterpreted that article... (Score:1, Insightful)
oh, by the way... (Score:2, Informative)
Also, I sincerely doubt that quantum computers will function this way, it is not the purpose of quantum computers to store multiple values for a single variable; it is to use physical resources more effectively
Mod this troll down before it's too late (Score:1, Insightful)
> You'll note that it runs on a conventional computer
So what? Any quantum calculation can be simulated on classical hardware, just more slowly.
> a quantum computer would have infinite times the processing power of our current supercomputers
Make that "exponentially faster". Infinity is really really big in case you don't know.
> I know the module is supposed to simulate programming a quantum computer, but it is not trying to simulate a quantum computer
That's a gem.
it is not the purpose of quantum computers to store multiple values for a single variable; it is to use physical resources more effectively
Well that does it, you really don't know what you're talking about at all.
Re:Mod this troll down before it's too late (Score:1)
SO I'm the troll? I may be new to SlashDot, but in the communities I'm used to, it is generally accepted that in order to contradict another's statements, one must supply evidence.
If you want to pull apart my posts piece by piece, at the very least do it correctly!
"> I know the module is supposed to simulate programming a quantum computer, but it is not trying to simulate a quantum computer
That's a gem. "
Read the part of my message you quoted again... There is, in fact, a difference between software and hardware. Unless you are in the habit of burning your Quantum Perl code on ROMs or whatnot, my statement remains perfectly valid.
"Well that does it, you really don't know what you're talking about at all."
What I don't know is what you're talking about... if my statements are inaccurate, let us poor ignorant fools know how, if it won't waste too much of your valuable time... thanks.
and on the off chance you actually know what you're talking about, I admit that my statements were vastly simplified, such as the infinitely greater processing power or more efficient resource management points, but they remain fundamentally valid. In theory, the limit to conventional computers is the limit of resources- the speed of electric currents (or, if/when we develop optic processors, lightwaves), the matter available for physical resources, etc.
A quantum computer would, again in theory, be able to use resources in all of their infinite states and positions in the multiverse. Depending on your views on advanced quantum physics beyond that which has been sufficiently evidenced to be widey accepted, matter is either infinite or finite to a larger extent than our perception, but I believe the former. If you want to hear my theories on the multiverse, email me (solistus@mac.com). Otherwise, stay at the level you're willing to discuss.
By the way, if you are arguing that the purpose of quantum computers is, in fact, to have multiple values for a single variable, and this can be done fairly effectively using Perl on a personal computer, you utterly fail to grasp the magnitude of the potential creation of a quantum computer.
Discover magazine, Sept. 2001 issue, volume 22, #9 has an interesting article on a similar theory to mine on quantum physics as it applies to the multiverse as a whole.
A little ahead of ourselves? (Score:2, Insightful)
Re:A little ahead of ourselves? (Score:2, Informative)
How quickly we forget. [slashdot.org]
Re:A little ahead of ourselves? (Score:1)
there are no working quantum computers (tangible at least.)
Actually there are several prototypes. The latest news is from IBM [ibm.com] although the original photo showed that the researchers were using Sun hardware. They've done a bit of photoshop (or GIMP?) magic since to remove the keyboard and logo on the monitor [ibm.com].
Quantum::Superpositions (Score:5, Interesting)
use Quantum::Superpositions;
if ($x == any($a, $b, $c)) {
while ($nextval < all(@thresholds)) {
$max = any(@value) < all(@values);
A good place to go and discuss the in's and out's of the cooler aspects of the perl community is perlmonks.org [perlmonks.org], check it out some time...
Re:Quantum::Superpositions (Score:4, Interesting)
I have to say that Conway is a brilliant speaker and truly funny. When he announced after a 3 hour talk that what he just spoke about isn't just a nice concept in theory but an actual perl module (only in a single universe and in real, often exponential time), the crowd just lost it and ROTFLed
Re:Quantum::Superpositions (Score:1)
Re:Quantum::Superpositions (Score:2, Interesting)
i have to admit though
any(@value) all(@values) is cool
why? because you dont have to write loops
for doing every different comparision. i bet
there are other benefits to the new syntax also.
but what does this have to do with quantum mechanics???
all of the operator overloading could
just be as easily called "set operators" or something.
then it wouldn't seem so spooky and mysterious,
and would rather seem like some practical
programming.
Re:Quantum::Superpositions (Score:2, Informative)
Of course, Damian is paid by the Perl Community to do this cool stuff. We're still looking to make up the funding for the later half of this year. Want to donate? Get yourself across to the donations page [yetanother.org]
Re:Quantum::Superpositions (Score:1)
Re:Quantum::Superpositions (Score:1)
This is new? (Score:4, Funny)
For some of us, this is nothing new.
Quantum Perl.... (Score:4, Funny)
Next on tap (Score:1)
Errr.... (Score:2)
*cough*
The superpositioned BSOD (Score:2, Funny)
The halted firewall (Score:1)
this module now gives them a chance to have the superpositioned crash: your computer is both crashing and still alive.
Linux can already do that, and it turns out to be useful for firewalls with static rules [slashdot.org].
Re:The superpositioned BSOD (Score:1)
We had a name for those: "TRA". This was when OS/2 crashed and started the panic, which prints "TRAP nnn" and other info, and then panics inside the panic handler. It would just get three letters out.
In retrospect we should have immediately fixed the trap report to read "nnn TRAP", and then those first three chars output would have been informative. Live and learn.
Schrodinger's OS (Score:2)
the superpositioned crash: your computer is both crashing and still alive.
But you still have to look inside to b0xen before you know which state it's in, right?
awww... (Score:2, Funny)
Awwww... I need a life...
At least I might or might not have a life.
Re:awww... (Score:1)
Hmmm.... (Score:4, Funny)
Re:Hmmm.... (Score:1)
"Oh, boy!"
Re:Hmmm.... (Score:3, Funny)
Re:Hmmm.... (Score:1)
use Quantum; my $jump = Quantum::Leap->new($previous_life);
Now it works! Of course, there's that matter of "changing right from wrong" to let the new() function return. =)
-Cyc
Entangled code! (Score:1)
Can you imagine the bugs in quantum code!
Re:Entangled code! (Score:1)
How can one debug Quantum code when the mere act of observation changes the result?!
Article Quote (Score:2)
Is it just me, or doesn't "good Perl code" already work that way unless you've spent the past 10 years developing for it? I for one can't make heads or tails of tight Perl coding methods.
Entangled code? (Score:1)
CRASH (Score:2, Funny)
Stupid function names (Score:2, Informative)
Also, remember that this does not turn your box into a quantum computer. It's well known already that quantum computers cannot do anything that normal computers can't (they both are Turing machines); they just do some things quite a bit faster.
Re:Stupid function names (Score:2)
Sorry, no. It's not well-known. This is like asserting that classical physics is equivalent to quantum physics, which is essentially what you are doing. Perhaps you are restricting your definition of Quantum computers too severely.
I would like to assert myself that Quantum computers should be able to simulate a Quantum reality, whereas Classical computers pretty much can't do this.
Please quote your sources or quit talking out of your ass!
Re:Stupid function names (Score:1)
Re:Stupid function names (Score:2)
The mathematics used to describe quantum mechanics can be performed on classical computers. Therefore, a QM system can be modelled as fully as is desirable, on ordinary computers. It's the same argument as with any kind of simulations: car crashes can be modelled even if there are no moving parts in the computer.
For some references you could check out my paper [cam.ac.uk] which summarizes some of the basics behind quantum computation.
By the way, all semiconductor devices are based on quantum mechanical phenomena so there are very few 'classical computers' around ;-)
Re:Stupid function names (Score:2)
I would like to point out however, in reference to your analogy, that you can't even model a three-body system without approximation on classical computers (yes, you know what I mean). If three bodies in motion can't be modelled with reliable equations, then I have reservations about making the leap to modelling more complex situations realistically.
Re:Stupid function names (Score:2)
That's a very good point. I agree that nothing can be simulated exactly, if only due to the inevitable rounding errors - which can be a severe problem at points of instability.
However, the reason there is research on quantum computation, is the performance with certain mathematical operations. This is expected from quantum mechanics, and it's only the mathematics that needs to be modelled. If the maths break down on real quantum computers, they will be quite useless, because they will not give the mathematically correct results.
Consider it this way: quantum mechanics could only be accepted, when it was shown that it gives the same _macroscopic_ behaviour as classical mechanics. In the same way, in QCs we are looking for an alternative way of doing the same mathematics that we could already do, no matter what weird things happen inside each system.
Now to deal with that nasty Halting Problem.... (Score:1, Interesting)
If this module is powerful enough, perhaps we could find ourselves in quite a mess of a 'turing machine' solving the halting problem due an implementation of quantum effects. Of course this should be impossible so the theory goes, but what if?
My knowledge of computation theory is limited and if there is expert that could sway me one way or the other I think quite a few of us would be interested.
Heisenberg .. (Score:1)
Not only for Perl (Score:4, Informative)
Just thought you'd want to know
Finally (Score:4, Funny)
-Paul Komarek
How is it... (Score:1)
Re:How is it... (Score:1)
"Quantum" programming in Perl, oh brother.. (Score:5, Informative)
Although I can't get to the article right now, I do know a little about quantum computing thanks to having just finished a thesis on the subject.
Studying the actual research in the field reveals that a real quantum device does not at all resemble a superintelligent "infinitely-faster-than-my-Pentium-4" computer of the future. To understand the difference requires understanding the fundamental nature of a quantum device and how it differs from a digital device.
The atomic unit of a quantum computer is a physical system of some sort that exhibits quantum behavior, such as a single electron and its spin. Whatever the implementation, the unit is called a qubit. A single qubit contains information sometimes described as a vector of complex numbers.
A digital computer, of course, operates on bits which allow only two states, the most common implementation of which is a high or low voltage at some defined point in an electrical circuit.
Some operations are natural and easy to perform on bits; these are AND, OR, NOT, XOR, and their Boolean friends. These operations, in turn, lend themselves to an easy and natural implementation of integer math. Other operations do not have a natural representation in digital computers, such as real-number arithmetic. For the relatively few occasions that call for irrational numbers, we make do with approximations and call it "floating-point" math.
The qubit's advantage is that, thanks to quantum mechanics, some operations which are very difficult for a digital computer are easy and natural for qubits. Notably, a set of qubits can perform a Fourier transformation in near constant time--an astounding operation that is so far believed to be impossible on any kind of Turing machine.
The other side of the coin, which is rarely understood by mainstream news reporters, is that the qubit is completely unable to address most of the rest of our favorite operations, such as integer addition. To ask a qubit to count from 0 to 9 is extremely difficult, maybe physically impossible.
If that weren't bad enough, quantum algorithms have to deal with other constraints such as the prohibition against creating a copy of an unknown quantum state. Therefore, your quantum Perl is going to have to start by doing away with the assignment operator. Qubits also have a nasty tendency to occasionally do things completely unexpected and unpredictable; this requires massively redundant calculations to reduce the probability of error to something acceptably small. (Of course digital computers suffer from random bit rot as well; it is solved with similar error detection and correction algorithms.)
All these obstacles discouraged any serious interest in quantum devices for some time. However, recently (1997?) Peter Shor published the first important quantum algorithm, which factors large composite numbers in polynomial time. In case you don't know, a computer with such a capability would have staggering implications. Much of the world's data protection is based on the RSA algorithm which relies on the difficulty of factoring large numbers.
Hence, the last few years have seen no shortage of funding or interest in quantum computing. Unfortunately, the mainstream media has caught just enough of the conversation to get the false idea that quantum computers are going to blow away all of the digital technology in existence, coming soon to a Best Buy near you.
Anyway, the moral of the story is, don't start saving for that Pentium-Q just yet; not only is a quantum device completely inappropriate for the overwhelming majority of computing tasks, but the current state of the art is a machine on the order of 10 qubits or so. (A few hundred qubits will be needed before Shor's algorithm presents a threat to current encryption.)
More realistically, you might expect to see one day in your lifetime a "quantum processing unit" that exists as a special-purpose extension to your digital processor--think along the lines of the 80287 floating point coprocessor. Even this kind of application is decades away at best.
Re:"Quantum" programming in Perl, oh brother.. (Score:1)
I know I won't; looking at the current P4's 'fuzzy math', the last thing I need is my PQ (Pentium-Q) or QPU (Quantum Processing Unit) getting me a decryption key for my database that's 'close enough' and will transform it into pr0n...
Ah, Intel.
--pi
Re:"Quantum" programming in Perl, oh brother.. (Score:1)
you must have broadband...
*sigh*
virtros
Re:"Quantum" programming in Perl, oh brother.. (Score:1)
More than a few hundred qubits will be needed, also. Shor's algorithm requires two registers of length N. Most Diffie-Hellman keys these days are 1024 bits, with some larger. I don't expect to see it in my lifetime, honestly. But when it does, there will be a shitstorm to beat all shitstorms. Some folks need to get cracking on an encryption process that doesn't rely on the intractability of factoring... they've got maybe 50 years to do it.
Re:"Quantum" programming in Perl, oh brother.. (Score:1)
Re:"Quantum" programming in Perl, oh brother.. (Score:1)
credit for this should go to someone else as IANAQP [|:P
ps: If there are typos or spelling errors and you cant understand what was said, I realy dont care and neither does anyone else, so cope with it.
pps: gramer too
Re:"Quantum" programming in Perl, oh brother.. (Score:2, Interesting)
Pick two probably-prime numbers and call them e and p. Compute (message^e) mod p, and send that along the wire. There's a third number you can pick if you already know e and p, that'll decrypt it. No factoring involved, except for picking your probably-primes in the first place.
Any cryptologists are welcome to correct me.
Re:"Quantum" programming in Perl, oh brother.. (Score:2)
Here's a question for you (Score:2)
Re:Here's a question for you (Score:1)
Re:Here's a question for you (Score:2)
Is that possible?
Re:"Quantum" programming in Perl, oh brother.. (Score:1)
Language is so bizarre sometimes.
Early Adaptors... (Score:2)
SendSpamTo(any($a, $b, $c, {....})...
Wow... Quantum Spam... Imagine the possibilities of bandwidth usage...
Or How about...
DOSAttack(any($a, $b, $c, {....})...
A Quantum DOS attack...
Hey just thinking out load how slow the net could be in the future
Re:Early Adaptors... (Score:2)
Schrodingers cat paradox (Score:2, Interesting)
The real use of this... (Score:5, Informative)
The real use of this is for people who want to experiment with quantum _algorithms_ on small data sets and learn and understand better how quantum computers work and how quantum calculations are put together. Writing quantum algorithms is hard and confusing to somebody familiar with classical computation, even if you are familiar with quantum mechanics. There are very few useful quantum algorithms (Gover's search and Shor's factorization algorithms are the two most famous and interesting IMHO). This module might encourage more people to come up with and experiment with quantum algorithms that take advantage of the "inherently parallel" nature of quantum computing.
Note that though I am no expert, I did actually write something modestly similar to this Perl - an interpreter that read a series of meta-language commands and turned them into physical magnet pulses for spin flipping on an NMR quantum computer we had at MIT. We never bothered to write a simulator for it, but now that I think about it, it would be cool to have this. Kudos to these guys for doing this.
Now if somebody could just make a quantum computer with, say, 20 or 30 qubits I might be convinced that quantum computing could eventually do useful calculations and that the decoherence problems and setup problems for a large number of weakly coupled qubit units are not intractable. Perhaps an alternative to NMR as the substrate for quantum computing might get farther.
Hooray! (Score:2, Funny)
QCL (Score:5, Interesting)
QCL is a procedural quantum programming language which provides nonclassical language elements such as unitary operators, running code in reverse, scratch space management, etc. A Linux interpreter (GPL) which simulates a quantum computer with an arbitrary number of qubits is available here [tuwien.ac.at].
The *New* Drake Equation... (Score:1, Funny)
(This is the Drake equation for the 22nd Century)
The Harter Equation:
*If* it's possible to make a quantum computer that can describe a reality equal to or greater than our own universe in detail, and *if* it's possible to create an infinite number of simulated universes with this level of detail, the chance that our universe is actually a quantum simulation would be nearly infinite*. There would be infinitely more artificial universes (that think they're real) than real ones. Now if an artificial universes (like our own?) can create other artificial universes, the chances that we're an original universe becomes even more implausible. Nice dreams!
Reinventing Non-deterministic programming (Score:1)
Well, to be fair: of course doing non-deterministic programming in parallel is exactly what quantum computing is all about. The thing is just - modules to simulate non-deterministic programming (albeit mostly in NP, not in P) have been around a while. Only when the different subtrees can be traversed in PARALLEL, like on a quantum computer, it gets new again. Not that non-deterministic programming on single-state computers is uninteresting...
Damian on Quantum::Superpositions at Zurich, CH (Score:2, Informative)
Re:perl on a quantum computer (Score:1)
This is a simulation of quantum computing, written in Perl.
(Say, have I just been trolled?)
Justin
Re:Real quantum computing (Score:2, Funny)
Did I mention that simulating a quantum system on a deterministic machine will require EXPONENTIAL time and space?
Go Perl.