Live data from Hacker News

What is a ket? How do traits work? Quantum computing in Rust, part 1

walther.guru

11–20 of 31 posts

Re: What is a ket? How do traits work? Quantum computing in Rust, part 1

#11

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. 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…

Thank 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?

Re: What is a ket? How do traits work? Quantum computing in Rust, part 1

#13
post #11

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. 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…

Thank 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-comp…

I would say you’ve implemented a state vector for a single qubit (when the norm = 1 and when equality is defined to be phase invariant, i.e., x and y are equal whenever there’s an ‘a’ such that e^(ia)x = y.), which can be written down notationally with a ket:

|s> = p|0> + q|1>

where p and q are complex, and |p|^2 + |q|^2 = 1. The ket is the notation |s>, |1>, and |0>, which could also be written purely as column vectors.

At the end it all depends on what you want to present. What will be the climax? Unitary evolution of a pure state? Superoperators on a mixed state? An introduction to linear algebra used in quantum computation and its notation?

In any case I’d present what a quantum state is on N qubits, which requires 2^N-element complex vectors that satisfy a few properties.

Re: What is a ket? How do traits work? Quantum computing in Rust, part 1

#14
post #11

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. 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…

Thank 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-comp…

Having "quantum computing" in the title makes this genuine clickbait when the body lacks any explanation of what a state is or what a ket is. Energy or momentum or spin states are rarely (never, in reality) just numbers.

You made no attempt to explain what the two different states in a single ket mean: hint, it's superposition. Never provided even a trivial justification for why normalization is important; where is the actual physics?

Using Rust here is also quite pointless when you're just doing linear algebra... where is the actual benefit over Python or even Haskell?

You've written a very cute and inefficient math library, but calling this QC is just false advertising.

Re: What is a ket? How do traits work? Quantum computing in Rust, part 1

#15

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?

It's basically a 90-year-old pun involving splitting the word "bracket" into "bra" and "ket".

Why bracket? The reason is that there is not only ket vectors |v> but also functionals that can be applied to them, which will look like this . So there are brackets around the construct. Think if you like.

Re: What is a ket? How do traits work? Quantum computing in Rust, part 1

#16

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?

It's basically a 90-year-old pun involving splitting the word "bracket" into "bra" and "ket".

Sometimes I don't know whether to be proud of or disappointed in our species.

Re: What is a ket? How do traits work? Quantum computing in Rust, part 1

#17

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. 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…

> (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.)

This is not correct when you start talking about continuous-variable states. In the (canonical) position basis, the state of an infinite-dimensional system is commonly expressed as \ket{\psi} = \int \psi(x)\ket{x}dx. Here {\ket{x}} are a basis set, but not square-integrable, since \bra{x}\ket{x} = deltafunction(0). Hence \ket{x} is not a valid quantum mechanical state.

Re: What is a ket? How do traits work? Quantum computing in Rust, part 1

#18

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. 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…

> (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.) This is not correct when you start talking about continuous-variable states. In the (canonical) position ba…

Kets sometimes even represent vector-valued functions (e.g., |f(t)> = e^(iHt)|0> or so) which in and of themselves aren’t states, but representations of system dynamics. We could pontificate as to whether |f(t)> is the function or is merely the image of t -> |f(t)> at some t. :)

In any event, I’m speaking in the context of my comment and of the article: (gate-based) quantum computation. Here, 9 out of 10 dentists will use a ket to denote the (computational) state of the quantum computer. Infinite dimensional states and bases aren’t pertinent at the level of logical computation.

Re: What is a ket? How do traits work? Quantum computing in Rust, part 1

#19

Earlier quoted context omitted.

It's basically a 90-year-old pun involving splitting the word "bracket" into "bra" and "ket".

Sometimes I don't know whether to be proud of or disappointed in our species.

Yeah, it's not like any programmers have ever come up with bizzare and useless names for abstractions.

Re: What is a ket? How do traits work? Quantum computing in Rust, part 1

#20

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. 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…

> In quantum computation, a ket is a vector in a Hilbert space

The blog implements kets as 2-dimensional complex vectors, so I don't see any problem there. A 2-dimensional space is a Hilbert space.

Post reply on HN