Here’s why quantum computing could be the big break for the Julia Language

logankilpatrick

Logan Kilpatrick

Posted on November 23, 2022

Here’s why quantum computing could be the big break for the Julia Language

In the world of programming languages, a new star is on the rise. The Julia language has been gaining popularity in recent years, thanks to its versatility and ease of use. And it could be about to get a big boost from an unlikely source: quantum computing.

In a paper published late October of 2020, a team of researchers from the Chinese Academy of Sciences and the University of Waterloo proposed using the Julia language as a tool for developing quantum algorithms. The paper, titled “Yao.jl: Extensible, Efficient Framework for Quantum Algorithm Design” presents a set of tools that quantum programmers can use to design and test quantum algorithms with features like GPU support, an automatic differentiation engine, and state of the art performance.

The paper’s authors believe that Julia is well-suited for quantum computing due to its high-level syntax, which makes it easy to express quantum algorithms. Furthermore, they argue that Julia’s Just-In-Time (JIT) compiler can be used to compile quantum programs into efficient native code, which is important for running quantum algorithms on real hardware.

Yao.jl Logo

While it remains to be seen whether or not the Julia language will become the standard for quantum programming, there’s no doubt that it has potential. If you’re interested in learning more about quantum computing, or if you’re simply curious about this emerging new programming language, be sure to check out the paper.

You might also want to check out check out this video about Yao.jl from JuliaCon 2019 which goes over the usage of the package:


So what even is quantum computing and how can I get started doing it in Julia? 🧐

At the most basic level, traditional computing operates in the space of 0’s and 1’s. This is an idea that is central to our computing experience as every single program in the world can be broken down to binary. This changed however with the advent of quantum computing. In quantum computing, there exists the idea that we are not limited to just 0’s and 1’s at any given moment and in fact, [00, 01, 10, 11] can all co-exist whereas traditional computing requires we have only one active state.

If you are like me, you might be scratching your head and thinking: “How is this at all useful”? Well, there are many different cases where quantum computing can be used to solve a bunch of different really complicated math problems that would otherwise not be practical to solve. I will spare you having to look at a math problem right now and instead suggest you watch the below video for an overview on quantum computing.

Let’s play around with a really simple example of using Yao:

julia> using Yao
julia> ArrayReg(rand(ComplexF64, 2^3))
ArrayReg{2, ComplexF64, Array...}
active qubits: 3/3
nlevel: 2
Enter fullscreen mode Exit fullscreen mode

This code creates a register which is a quantum state of a batch of quantum states. This quantum register is analogous to the traditional register in computing you might have touched in C or Assembly.

Next, let’s create a quantum block:

julia> chain(2, put(1=>H), put(2=>X))
nqubits: 2
chain
├─ put on (1)
  └─ H
└─ put on (2)
└─ X
Enter fullscreen mode Exit fullscreen mode

What does the chain function do here you might be asking, well here is what the help section says:

Return a ChainBlock which chains a list of blocks with the same number of qudits. Let G_i be a sequence of n-qudit blocks, the matrix representation of block chain(G_1, G_2, …, G_m) is G_m G_{m-1}\ldots G_1 It is almost equivalent to matrix multiplication except the order is reversed. We make its order different from regular matrix multiplication
because quantum circuits can be represented more naturally in this form.

Again, a little complicated, but the basic gist is that we created a 2-qubit circuit. This is probably as far as we need to go to illustrate that quantum computing is really possibility in Julia. I will be honest that my own understanding of this material is very minimal but getting my hands dirty and playing around with some of these examples helped make things a little more concrete.

I suggest you check out the Yao.jl quick start guide if you want to learn more and see loads of other examples.


Using Julia for quantum computing on AWS ✨

Not only is there a ton of development happening in the the open source quantum computing space, but big players like Amazon are also doubling down on services (like Amazon Braket) that provide quantum computing on the cloud. If you want to play around with this service from Julia, check out the newly announced https://github.com/awslabs/Braket.jl which provides an interface to work with the service.

On November 15th, 2022, AWS announced and released an interface to work with Julia and the AWS Braket service:

https://forem.julialang.org/kshyatt/introducing-braketjl-10f2

While the package is still experimental, the announcement post went on to say:

We’ve created this package because we know there are a lot of current and future quantum experts in the Julia community. We want to allow you to experiment and try out this exciting new technology using all the Julia features we know and love — multiple dispatch, native parallelism, a great package management system, and first class performance. We also want to learn from the Julia community, and better understand how we can enable you to do groundbreaking work in the quantum space.

This is a really excited development for the Quantum Computing ecosystem and those interested in Julia. Stay tuned to see what else is coming!


Wrapping things up 🎁

The field of quantum computing is still in its infancy, but it holds immense promise for the future. And the Julia language may prove to be an important tool for making quantum computing more accessible to developers. So if you’re interested in keeping up with the latest developments in both quantum computing and programming languages, keep an eye on Julia — it may just be the next big thing.

If you want to support the Julia Quantum ecosystem, consider dropping a star on Yao.jl and Braket.jl.

💖 💪 🙅 🚩
logankilpatrick
Logan Kilpatrick

Posted on November 23, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related