r/ExplainLikeAPro • • Sep 02 '13

ELAP: How do I program using a quantum computing language?

For instance, what would the nature of assembly language instructions be like in a quantum computing environment?

24 Upvotes

6 comments sorted by

View all comments

12

u/The_Serious_Account Sep 02 '13 edited Sep 03 '13

Quantum algorithms are expressed in linear algebra. An n-qubit input is defined by a 2n dimensional vector of length 1. Your possible quantum operations are any unitary matrix (that is 2n by 2n to fit the vector) and your output is also a 2n dimensional vector of length 1 (this results from the matrix being unitary). The final requirement is that your output must be a basis vector. If it isn't, the vector will probabilistically collapse to one of the basis vectors. The closer it is to a basis vector, the more likely it is it will collapse to it. The 2n basis vectors corresponds to 2n classical bits 2n possible values. That is, n classical bits. Hence your output is not qubits, but regular bits.

Simply put:

y = Ux

Where x is your input, U is your program - expressed as a unitary matrix. And y is your output.

Now, the question is how to construct the unitary matrix, U. There's a handful of matrices that are known as universal gates in the sense that you can construct any unitary matrices from them by putting them together in the right order. This is similar to a NAND-gate being universal.

tl;dr: Learn linear algebra.

Edit: sorry, fixed a mistake and added a bit

3

u/stuntaneous Sep 03 '13

Can you point me in the direction of material a few steps back from this level of understanding?

3

u/The_Serious_Account Sep 03 '13

Depends on how much you're willing to invest in it. The best textbook i know on the subject is Quantum Computation and Quantum Information.

I also like one of the author's youtube channel where he explains the basic concepts fairly well. I would be comfortable with concepts like vectors,basis vectors, matrices, vector spaces and complex numbers before I start.

The best way, imo, to teach quantum computing (and quantum information theory in general) is very different from 'normal' quantum physics. If you hear people mentioning the 'Schrödinger equation' they're probably making it more confusing than it has to be.

1

u/stuntaneous Sep 03 '13

Just what I wanted, thanks. I'm rusty on that maths but I should be right.

1

u/[deleted] Nov 10 '13

Great explanation! I just did my first physics seminar presentation on this topic and didn't really delve into quantum computing as much as just classical electronics expressed in matrices. I'll definitely be checking out the book you linked and hopefully be able to present on quantum next time.