7 ms·
What is a ket? How do traits work? Quantum computing in Rust, part 1
- ivanbakel 7y ago`assert_eq(A == B, true)`? `assert_eq(A, B)`, or even `assert(A == B)` by all means. And this does not really explain what a `Ket` is, rather unfortunately. I now know it's a pair of complex numbers, but that's not very handy - and the `is_valid` definition is not explained, so I don't even get told what subset of pairs of complex numbers make up valid kets without reading code.
- db48x 7y agoThe title of the article is "Quantum Computing fin Rust, part 1", so the implication is that it is there to teach you about Rust, not to teach Quantum Mechanics which you already know.
- eden_h 7y agoIt's not too much to expect an article entitled "What is a ket?" to explain what a Ket is. Your point is arguable if it was instead "How to implement a Ket in Rust", and even then it's a bit vague. I left with the same feeling that it was a bit barebones in terms of definition.
- Walther 7y agoHeh, what a silly little mistake to make with the asserts. I've now improved their readability. Thank you! You're right, I need to add a better explanation for what a ket is. Same applies to the validity, should explain a bit about normalization. Thanks for the feedback!
- reallydontask 7y agohttps://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation I remember learning about this at uni in one of the more advanced QM modules. I remember thinking: Seriously, couldn't they've come up with a better name?
- eigenloss 7y agoIt's basically a 90-year-old pun involving splitting the word "bracket" into "bra" and "ket".
- _Microft 7y agoWhy bracket? The reason is that there is not only ket vectors |v> but also functionals <u| that can be applied to them, which will look like this <u|v>. So there are brackets around the construct. Think <bra|ket> if you like.
- saalweachter 7y agoSometimes I don't know whether to be proud of or disappointed in our species.
- eigenloss 7y agoYeah, it's not like any programmers have ever come up with bizzare and useless names for abstractions.
- najarvg 7y agoClearly OT but the excessive reliance on foo and bar in many of my early C lang learning examples really slowed down my ability to transfer said techniques into something meaningful. Eventually one of my friends working in the Visual C++ team (I'm dating myself here) explained the connection of foo and bar to fubar and kind of felt like this!
- eigenloss 7y agoI had the same experience; that's mostly what I'm referencing. Trying to use things like The Hacker's Dictionary (largely in-jokes, bad jargon, and obnoxious circular definitions) to clear it up made the problem worse. I get that it's just a humor book, but still.
- 7y ago
- philzook 7y agoReally interesting. Rust is on my radar. You might be interested in a post in Haskell that I made that has a similar feel. http://www.philipzucker.com/functors-and-vectors/ http://www.philipzucker.com/functors-and-vectors/
- reikonomusha 7y agoThis does not present the correct definition of a ket. More specifically, it doesn’t present a reasonably general definition of a ket. It would be like asking “What is a list?” and implementing a data structure that can store only one element. In quantum computation, a ket is a vector in a Hilbert space. A Hilbert space is just a fancy way to describe a typical space you find in linear algebra, where the space allows you to compute lengths and angles. When discussing kets, the usual vector space is the set of complex-element vectors with unit length (or “norm”). The vectors can have any number of elements (or “dimension”), but when discussing qubits, they are 2^n-dimensional for n qubits. (It’s important to note that a ket is not distinguishable from a vector. It’s actually called so because of a notational convention, not because it has deeper underlying meaning. However, physicists will still use the word “ket” instead of “vector” or “quantum state” even if they’re not emphasizing notation.) More interesting, though, is how kets combine with other kets via tensor products. This ingredient is as essential to QC as flour is to cake. This article [0] informally presents a fully general definition of a ket along with the tensor product with an emphasis on why a representation and notation was chosen. But it does require a good understanding of linear algebra already. [0] “Someone shouts |01000>! Who’s excited?” https://arxiv.org/abs/1711.02086 https://arxiv.org/abs/1711.02086
- deleted 7y ago[deleted]
- deleted 7y ago[deleted]
- Walther 7y agoThank you for feedback! Going to read the paper to improve my understanding. I'm writing this blog series in part to learn more - both about quantum computing as well as Rust. As some people say, teaching is a great way to learn (or at least check your knowledge). What do you think would be a good correction or disclaimer to add? Would it be sufficient to e.g. say that in this first part, we only implement a two-component ket? Generalizing the ket type to an arbitrary-size vector while keeping type constraints, perhaps briefly mentioning const generics (an upcoming language feature), etc could easily make for another part in this series. Making the ket into an actual vector could then give way to doing proper linear algebra on them, cleaning up some of the manually implemented operations here, as their teaching purpose has been fulfilled already. Thoughts?
- jkiopire 7y agoNow that you mention it, the "bra" part from bra-ket is kind of sexist. Fully expect it to be renamed in a couple of years after a woman complains that it's putting her off from learning physics.
- Walther 7y agoThank you all for the feedback! I'll continue to make improvements to this post, as well as build more in the next parts. My current understanding is mostly based on this wonderful website: https://quantum.country/qcvc https://quantum.country/qcvc - if you can recommend more good resources, I'm all ears!
- Walther 7y agoForgot to mention, I'm also getting the book "Quantum Computing Since Democritus" by Scott Aaronson soon.
- Gonzih 7y agoOh thats pretty cool, wanted to subscribe to rss/atom feed for a followup blog posts, but cant find any feed link. I hope i wont miss future posts in series.