Common Lisp, Development, LISP, Quantum Computing, Quantum Programming, Technology

Quantum Computing and Lisp

Quantum Computing is a fascinating field, but currently a contentious one. The only examples we have of real-world, hardware quantum computers are the line of adiabatic quantum computers from D-Wave Systems—and many voices in the scientific community still protest its identification as such simply because it is not a full-fledged gate-model quantum computer complete with persistent quantum data storage and QRAM. However, by the strictest definition, any machine which exploits quantum mechanical phenomena for the purpose of computation is a quantum computer, and the D-Wave One and Two meet this definition.

For us in the Lisp community, Quantum Computing is even more important; one of the most surprising secrets of the D-Wave line of adiabatic quantum computers is that their low-level operating system is programmed in Common Lisp. Specifically, D-Wave uses SBCL. This choice is not accidental or arbitrary—Common Lisp is uniquely suited to the task of quantum computer programming.

Continue reading

Advertisements
Common Lisp, Development, LISP, Quantum Computing, Quantum Programming, Technology

Hacking D-Wave One in Common Lisp: Introducing SILVER-SWORD

I’m pleased to announce that BURGLED-BATTERIES has not failed me (despite being far from finished), and I have been making steady progress with my Common Lisp interface to D-Wave’s Python Pack and Adiabatic Quantum Computer Simulator: SILVER-SWORD. It is now available in alpha as a Quicklisp-installable ASDF package on GitHub: https://github.com/thephoeron/silver-sword

Features left to implement: reading and writing of qubo files, ising to qubo to ising converter functions, chimera graph indexing, and the BlackBox Solver.

Of course, you still need D-Wave’s Python Pack first, so unless you’re already a registered D-Wave developer, SILVER-SWORD won’t be much use to you. You will also need a few other dependencies, which are all conveniently listed in the repo’s README file.

That being said, I have already included a few tutorials, so you can at least see Common Lisp quantum energy programming in action.

Continue reading

Development, Haskell, Quantum Computing, Quantum Programming, Quipper, Technology

The Quipper Quantum Programming Language

I finally got a chance today to play with Peter Selinger’s new quantum programming language, Quipper. Since it was built as an embedded, scalable functional programming language on Haskell, it was quite easy to get up and running; and naturally, with exponential overhead, you are able to simulate an actual quantum computer.

Note: Selinger’s quantum computer simulator within Quipper is designed after an ideal, gate-model quantum computer, which is a substantially different beast from D-Wave’s adiabatic quantum computer. For example, some members of the quantum computing community argue that D-Wave’s line of cryogenically-cooled superconducting chimera-graph flux-qubit processors aren’t ‘true’ quantum computers, primarily because they don’t follow the gate-model, and instead implement their own concept of energy programming to gain most-efficient-solution. The fact is, both are ‘true’ quantum computers, in the sense that they exploit quantum mechanics for computation—and when it comes down to it, flux-qubits are damn cool. In the early days of classical computing, there were a number of competing models of computation as well—but it was eventually discovered that all models that were Turing-complete were effectively equal, so as the most expedient option, the von Neumann model won-out. The question of what counts as a true quantum computer is less simple, of course—but suffice it to say that adiabatic and gate-model quantum computers serve different purposes.

With those differences in mind, we can continue.

You can get Quipper yourself from here: http://www.mathstat.dal.ca/~selinger/quipper/

Familiarity with Haskell, functional programming, and a working installation of The Haskell Platform will get you most of the way. There are a few additional dependencies to install, but everything you need to know is covered in the INSTALLING and README files listed on the language page. Once you’ve got everything set up, the Quipper scripts folder added to your PATH, and all the examples built, continue here.

Continue reading

Common Lisp, Development, LISP, Python, Quantum Computing, Quantum Programming, Technology

Hacking D-Wave One in Common Lisp

Mostly for my own amusement, I’ve tried a variety of approaches to hacking D-Wave’s python pack in Common Lisp, from existing Python/Lisp bridges to Python-in-Lisp implementations to decompiling the binary in order to recreate C++ header files that could then be used as a basis for a direct CFFI bridge, without much success. Being that the D-Wave Developer Portal only ever offered a simulator of the company’s D-Wave One hardware for the Python language, and no C/C++ library with associated header files, this was a fairly significant problem as support for Python–Lisp bridges has always been extremely limited, and until very recently, such bridges did not support CPython libraries such as D-Wave’s Python Pack, or its dependencies such as Numpy. Enter burgled-batteries.

With the burgled-batteries library, I was hacking away at D-Wave’s Python Pack within the SBCL REPL in a matter of minutes. And according to the library’s author, it’s only the beginning. Support for Python introspection and calling Lisp from Python are in the works—but in the mean time, handy macros such as RUN and DEFPYFUN allow you to get at all aspects of a Python library in a manner familiar to those used to working with the CLPython or CFFI Common Lisp libraries.

Using burgled-batteries in its present state, it will now be a fairly straightforward task to recreate the Python Pack’s API in Common Lisp. Sadly, registration to D-Wave’s developer portal has been closed for some time (and very few developers registered for it in the first place), so the only person that will get to enjoy hacking away at a quantum computer in Common Lisp (as far as I know) is me.

That being said, I look forward to the continued development of burgled-batteries, and think it will become an invaluable tool for Lisp and Python hackers everywhere. Just think of all the libraries and frameworks we’ll get to add to Lisp!

Development, Python, Quantum Computing, Quantum Programming, Technology

D-Wave Python Pack 1.4.0-alpha1 Trial 2

I decided to take a break from this long weekend’s coding bender to get back to the D-Wave developer tutorials. Taking a break from one coding project by working on another may seem counter-intuitive to non-programmers, but it’s actually a great way of getting a fresh perspective when one function starts blurring into another.

I decided to take a look at some of the new tutorials, namely Travelling Salesman and the Hadamard Matrix search. I’m pleased to report that they function exactly as advertised (despite some criticism from a certain user on the D-Wave forums).

Continue reading

Development, Python, Quantum Computing, Quantum Programming, Technology

D-Wave Python Pack 1.4.0-alpha1 Trial 1

Today I’ve been benched by a double-whammy sinus cold plus migraine, so there’s really not much I can do. Yesterday, however, I did get to try out the D-Wave Python Pack (Win32/Python2.7 1.4.0-alpha1)—and I was pleasantly surprised by its speed and apparent stability. Oddly, the “Hello Multiverse” tutorial script wouldn’t run as is (and I didn’t have the time to stop and figure out why), but the neural net scripts (which I’m more interested in anyway), worked exactly as advertised. Altogether I’m pleased with the developer beta, and I’m looking forward to the Quantum Cloud service.

I’ve decided, of course, that I need to be up and running in a Windows environment ASAP, so that I can put as much of my free time as possible into quantum programming. This means moseying on over to FutureShop once I’m over my cold and picking up a copy of Windows to install on my MacBook Pro via Bootcamp. At this point, I can’t worry about building a new PC. As much as I happen to enjoy assembling and fine-tuning my own computers, I simply don’t have the time—I know myself, and I won’t be satisfied just throwing something together; I’ll have to hunt down the best components for the best price, tweak the processors, set up my operating systems… (and since my favourite flavour of Linux happens to be Gentoo, that is a time-consuming process on its own). That’s a project for when I’m finished my current development contract. Plus, I really want a six-up display, and that’s kind of a waste of money unless the computer it’s attached to costs at least the same price.

Continue reading

Development, Python, Quantum Computing, Quantum Programming, Technology

D-Wave Developer Portal

I got my access to the D-Wave developer portal beta yesterday—only to be thwarted by a lack of an OS X version of their python pack. Luckily, I have access to a Windows PC during the week, so it’s not a complete fail—but it would have been nice to devote some real time to quantum programming over the weekend. Unfortunately, for a more permanent solution I’ll either have to get a PC of my own, or taint my macbook pro with a bootcamp installation of windows.

There is a linux version as an .egg distribution, which could probably be bootstrapped to work under OS X through Fink, unfortunately it’s only compatible with Python 2.6, and Lion comes with Python 2.7.1. Not entirely a happy day.

I’ll post more when I get a chance to try out the D-Wave python pack.