This 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.<p>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.<p>(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.)<p>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.<p>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.<p>[0] “Someone shouts |01000>! Who’s excited?” <a href="https://arxiv.org/abs/1711.02086" rel="nofollow">https://arxiv.org/abs/1711.02086</a>
`assert_eq(A == B, true)`? `assert_eq(A, B)`, or even `assert(A == B)` by all means.<p>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.
Thank you all for the feedback! I'll continue to make improvements to this post, as well as build more in the next parts.<p>My current understanding is mostly based on this wonderful website: <a href="https://quantum.country/qcvc" rel="nofollow">https://quantum.country/qcvc</a> - if you can recommend more good resources, I'm all ears!
Really interesting. Rust is on my radar. You might be interested in a post in Haskell that I made that has a similar feel.<p><a href="http://www.philipzucker.com/functors-and-vectors/" rel="nofollow">http://www.philipzucker.com/functors-and-vectors/</a>
Oh 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.
<a href="https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation" rel="nofollow">https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation</a><p>I remember learning about this at uni in one of the more advanced QM modules.<p>I remember thinking: Seriously, couldn't they've come up with a better name?