As we are entering the era when quantum computing are becoming
viable, it is especially important to focus on classical simulations of
quantum systems. They can provide a useful insight into mechanisms
behind quantum phenomena, and be used to verify the results of the new
technology. In addition, current quantum devices are often call
*Noisy Intermediate-Scale Quantum (NISQ)*, due to high amounts of
noise that affects them. As a result, it may still be possible to keep
classical simulations competitive, and incentivise the development of
both paradigms.

In general, simulating quantum circuits is an exponentially hard task
– both in terms of runtime and memory. This is because a quantum state
of \(n\) qubits is equivalent to some
superposition of all possible \(n\)-bit
strings, each weighted by a complex amplitude (whose modulus squared is
equal to the probability of measuring the corresponding string).
Therefore, there are \(2^n\) complex
numbers describing the state. However, many states can be
*separated* into products of smaller states. If a state is
separable into single-qubit states, it is *non-entangled*.
Otherwise, there is some degree of *quantum entanglement* present
– which describes correlations in the measurements of individual qubits
for the given system. This is what differentiates quantum computing from
its classical counterpart, since classicaly, those measurements would be
independent. There are methods for compressing states with less
entanglement, which will be described below. Notwithstanding that, it is
quantum simulations are obviously very energy inefficient.

Two different circuits were selected for benchmarking – *Quantum
Fourier Transform (QFT)* and *Random Quantum Circuit (RAND)*.
Likewise, two platforms were used two create and run the simulations,
each representing a distinct approach. *Quantum Exact Simulation
Toolkit (QuEST)* was used for full state vector simulations, while
*iTensor* was leveraged to perform circuit simulations by
contracting tensor networks of *matrix product states (MPS)* and
*matrix product operators (MPO)*.

Each approach allows different modifications to save the energy. QuEST requires multiprocessing for larger simulations due to memory limitations, which makes it very heavy on inter-node communication. Therefore, it was found to be beneficial to slightly reduce CPU clock frequency, so that most of the CPU time is not wasted waiting for the messages to arrive. On the other hand, iTensor is currently completely serial and single-threaded, but features a representation that makes compression easy for states with limited entanglement. Hence, it was found to be better for some algorithms and input states, despite its limitations.

Below presented are circuits and frameworks used in this work.

*QFT* is a very common component of
other quantum algorithms. It does a quantum analog to Discrete Fourier
Transform on the input state, described by the following formula: \[
QFT_N \lvert x \rangle =
\frac{1}{\sqrt{N}}\sum_{y=0}^{N-1} \omega_N^{xy} \lvert y \rangle
\]

Where \(N=2^n\) is the number of basis states, and \(\omega_N=e^{\frac{2\pi i}{N}}\). This can be re-expressed as a tensor product of single-qubit states: \[ QFT_N \lvert x \rangle = \frac{1}{\sqrt{N}}\bigotimes_{k=1}^n \left( \lvert 0 \rangle + \exp{\frac{2\pi ix}{2^k} \lvert 1 \rangle} \right) \]

Therefore, if the input state is the basis state \(\lvert x \rangle\), its Quantum Fourier
Transform won’t introduce any new entanglement. However, if the input is
in a superposition of basis states \(\lvert
\psi \rangle = \sum_{x=0}^{N-1} \psi_x \lvert x \rangle\), the
corresponding transform will be a superposition of transforms of each
basis state. This way, some amplitudes may cancel each other out, and
alter the entanglement of the result. We say that the QFT is *weakly
entangling*, which means its output can have a different level of
entanglement than input, but it is unlikely to arbitrarily create a very
entangled state.

The circuit is easy to verify, as inputting a \(\vert 0 \rangle\) state should output an
equal superposition of all states. It consists of \(\mathcal{O}(n)\) non-diagonal *Hadamard
gates* and \(\mathcal{O}(n^2)\)
diagonal controlled \(\theta\)
*phase shift gates*. [1]