Quantum Computing Simulator

Introduction

I wanted to work on something using rust to mostly learn more about Rust because of peer pressure. I feel like most of the code was a lot of math, and because rust does not have the support for math libraries like python does, it was pretty hard.

If I had numpy, most of the code wouldn't have to be written. (But I wouldn't learn about Rust either so I guess everything has a silver lining)

My Approach

I am not a physicist. I might be wrong on the assumptions I make.

But, from what I can understand, a qubit from a software perspective is a more complex bit and quantum registers can just be represented as a matrix.

So at its core, to simulate the actions of a quantum computer from a classical computer, all that it likely required is to use linear algebra to manipulate the Matrices properly

Design Choices

The basic design of the code is this :

Issues

First of all, I guarantee that the most of the code I wrote for my linear algebra is likely ineffcient. To be fair I didn't write this program for performance. That should be fixed, I'll probably never come back to it.

Issue #1

I first had to figure out how to implement a quantum register. Should I do it as a vector of Qubits, or as a Vector of floats?

This one I had to choose a vector of floats because to get the vector, you eventually have to get the kronecker product and the conversion to a kronecker product can't be reversed.

From a OOP perspective, it would have been better to try to use a vector of qubits but, to implement the changes of a quantum gate on the register would require the kronecker product and this conversion cannot be undone.

Issue #2

I guess this is more of a TODO, but I have implemented the tools I would need to implement Shor's Algorithm, but I haven't actually implemented the code at all. At this point the code is mostly a matrix multiplcation library with a few tweaks for quantum computing simulation.

Why did I write this blog post?

If I haven't implemented an algorithm, why would I write this Blog post?

One, I would like some help if possible. Here's the git repository

Two, I feel like writing this blog post will make me work through this final hump.

That is all for this month. Goodbye.