Live data from Hacker News

A tutorial quantum interpreter in 150 lines of Lisp

stylewarning.com

21–30 of 46 posts

Re: A tutorial quantum interpreter in 150 lines of Lisp

#23
post #2

Any recommendations on a textbook to understand this kind of math?

maybe not of your interest, but if one is more from a ML background, there's this nice book/overview by Maria Schuld and Francesco Petruccione, called Machine Learning with Quantum Computers, which is mostly regarding variational algorithm and quantum kernel machine. However, the best intro material is the one by Nielsen and Chuang.

Moreover, if you feel more comfortable by running examples there are qiskit, pennylane and other libraries which shares a lot of tutorials and notebook (and some can be run on a true quantum computer if you have the money or the time to wait in queue!)

Re: A tutorial quantum interpreter in 150 lines of Lisp

#24

Recently, I have been working on some things that sometimes overlap with quantum computation and I have realized that the way all the quantum languages approach this wrong. If you are programming explicitly with CNOT gates, you are doing it wrong. A Python programmer doesn't care about logical gates, and neither should a quantum programmer. To that end, I'm convinced that the interplay between coinduction and inducti…

[dead]

Re: A tutorial quantum interpreter in 150 lines of Lisp

#25
post #3

The hardest part of implementing a quantum state vector simulation is understanding how the tensor product expands an n-qubit gate to apply to an m-qubit system. (A third of the linked post is dedicated to it; appropriately.) If you use a language or framework that's based on tensors to start with, things can be quite succinct (though you still need to understand the concepts). For example, in numpy, if you store the…

> The hardest part of implementing a quantum state vector simulation is understanding how the tensor product expands an n-qubit gate to apply to an m-qubit system. (A third of the linked post is dedicated to it; appropriately.)

This feels like it could be the "git gets easier once you understand branches are homeomorphic endofunctors mapping submanifolds of a Hilbert space" of physics.

Re: A tutorial quantum interpreter in 150 lines of Lisp

#26

You had me until Lisp.

Not everyone is using PHP, sorry. I promise that once you get past the syntax shock, Lisp is not that difficult to grok. It looks like some people here took your comment the wrong way but please don't be discouraged by that. There is a genuine lack of good Lisp outreach, compounded by trolls and bombastic essays that are high on platitudes and low on actual insight, and I'm slowly working on correcting that in my spare time.

Re: A tutorial quantum interpreter in 150 lines of Lisp

#27

"Thanks for interviewing with us today at xyz... please click on that link I just sent you in the chat. Today we will be doing a little quantum coding question. Try to speak out loud so I know what your thinking and your thought process."

"Senior React Developer"

Re: A tutorial quantum interpreter in 150 lines of Lisp

#28
post #10

I'm deciding between Common Lisp and Mojo, so maybe I will try to implement this in Mojo and compare. Anybody have any thoughts on this, since I am a mediocre Lisper and a beginning Mojo person. I am familiar with Numpy and I also program in APL and J.

May I suggest Julia? Efficient and capable of (Common Lisp style) abstractions. Unsurprisingly, there are more than a few quantum projects in the ecosystem already.

Re: A tutorial quantum interpreter in 150 lines of Lisp

#29

I wrote something similar a couple of years ago - https://github.com/adamisntdead/QuSimPy Happy to answer any questions people have, including on other simulation methods other than state vector!

One of the aspects emphasized in TFA is being able to simulate gates of any dimension/number of qubits (like a 3-qubit Toffoli or a 5-qubit Molmer-Sorensen), instead of just 1- and 2-qubit gates. Have you thought about extending your simulator to support gates of greater than two qubits?

I know about the conventional 2-qubit Molmer-Sorensen but not the 5-qubit version. Could I ask what it is?

Re: A tutorial quantum interpreter in 150 lines of Lisp

#30
post #26

You had me until Lisp.

Not everyone is using PHP, sorry. I promise that once you get past the syntax shock, Lisp is not that difficult to grok. It looks like some people here took your comment the wrong way but please don't be discouraged by that. There is a genuine lack of good Lisp outreach, compounded by trolls and bombastic essays that are high on platitudes and low on actual insight, and I'm slowly working on correcting that in my spa…

> It looks like some people here took your comment the wrong way

HN discourages low-effort snark. If someone is going to complain about Lisp, they should explain why.

Post reply on HN