Efficient Representation of Qubits on a Digital Simulator

I was wondering about quantum simulators recently, and I was thinking about how a qubit could be represented on a digital machine. This Stack Overflow post seems to say that one will need at least $$a2^n$$ bits to represent a qubit (albeit partially), where $$n$$ is the number of qubits represented, and $$a$$ is the bit size of the complex number used. This has to do with the matrix representation of a qubit. However, I was thinking of a more efficient way of representing a qubit as a point on a Bloch Sphere. This way, a qubit object would only need to store two units of information. For example, in C, this would look like:

#include <stdlib.h>
#include <math.h>

#define QUBIT_PI (1 << sizeof(short) * 8 - 1)

typedef struct QUBIT_STRUCT
{
unsigned short theta;
unsigned short phi;
} qubit_t;

qubit_t *qubit_from_angles(double theta, double phi)
{
qubit_t *ret = malloc(sizeof(struct QUBIT_STRUCT));
qubit_t->theta = theta / M_PI * QUBIT_PI;
qubit_t->phi = phi / M_PI * QUBIT_PI;

return ret;
}


and a quantum gate would be like:

qubit_t *qubit_X(qubit_t *qubit)
{
qubit->theta = QUBIT_PI - qubit->theta;
qubit->phi = -qubit->phi;

return qubit;
}


Is there anything wrong with storing qubit representations in this manner? Are there any quantum simulators that store qubits like this?

Be careful to differentiate a qubit from a quantum system. As seen here, a qubit can be written as: $$|\psi\rangle=\cos\left(\frac{\theta}{2}\right)\begin{pmatrix}1\\0\end{pmatrix}+\mathrm{e}^{\mathrm{i}\varphi}\sin\left(\frac{\theta}{2}\right)\begin{pmatrix}0\\1\end{pmatrix}$$ As such, two real numbers seems to be enough to represent a single qubit.

But this doesn't feel right.

What about the following qubit? $$|\chi\rangle=\frac{\mathrm{i}}{\sqrt{2}}\begin{pmatrix}1\\0\end{pmatrix}+\frac{\mathrm{i}}{\sqrt{2}}\begin{pmatrix}0\\1\end{pmatrix}$$ As an unitary vector of $$\mathbb{C}^2$$, it is a perfectly valid qubit, but still can't be represented using the previous representation. However, we can write it as: $$|\chi\rangle=\mathrm{i}\left(\cos\left(\frac{\pi}{4}\right)\begin{pmatrix}1\\0\end{pmatrix}+\sin\left(\frac{\pi}{4}\right)\begin{pmatrix}0\\1\end{pmatrix}\right)$$ The $$\mathrm{i}$$ factor is a global phase, and can be safely removed. Two states equal up to a global phase behaves the exact same way, no matter what your experiment is. Also, if you add another qubit, the global phases will multiply themselves to another global phase. All in all, it seems that $$2n$$ real numbers are enough to represent an $$n$$-qubit system.

But this doesn't feel right.

If the previous fact was true, there would be no need for quantum computers at all, let's just simulate them!

The problem is that the previous fact is true only when you don't consider entanglement. For instance, the following $$2$$-qubit system: $$|\varphi\rangle=\frac{1}{\sqrt{2}}\begin{pmatrix}1\\0\\0\\1\end{pmatrix}$$ As an unitary vector of $$\mathbb{C}^{2^2}$$, it is a valid $$2$$-qubit system. But what are the individual representations of its qubits? There are a lot of proofs that there is no way to write this system as: $$|\varphi\rangle=|\alpha\rangle\otimes|\beta\rangle$$ Thus, the only way to represent this system is to store its $$2^2$$ components1.. More generally, you have no choice but to store the $$2^n$$ components of a quantum system to perfectly simulate a general quantum algorithm. Each of these components being complex, this adds up to $$a2^n$$ bytes, where $$a$$ is the number of bytes needed to represent a complex number (though a small optimization may be applied using the normalization constraint).

The same fact applies to quantum gates: you have no choice but to store the $$4^n$$ complex components that defines it (though a small optimization may be performed using the unitary constraint).

Conclusion

All in all, it is possible to represent qubits the way you've described it. As long as you work with single-qubit state, your approach is valid. In fact, as long as your system is separable (that is, it can be written as a tensor product of $$n$$-qubits, i.e. there's no entanglement), your approach would work.

But there is no quantum algorithm that provides a speedup that doesn't use entanglement. As such, your only choice is to store all of the complex components of your system.

1. It may be possible that this fact is not true, since I think it is possible to efficiently represent and compute with gates from the Clifford group only, which is the case of this state. Point is, a general quantum state must be represented with its $$2^n$$ components.

• Okay, thanks for answering my question so thoroughly. I do have one related question, though. Is there a higher dimensional Bloch Sphere that can represent all entangled double qubit states with, say, 4 angles? Commented Mar 18, 2022 at 12:10
• @WilliamRyman Not that I'm aware of. If your state is separable, just represent as many Bloch Spheres as the number of qubits you're working with. If there is some entanglement, then a qubit is represented inside the Bloch sphere and it's quite difficult (if not impossible) to work with this representation at this point (see for instance here: quantumcomputing.stackexchange.com/questions/5147/…) Commented Mar 18, 2022 at 12:31