Message Boards Message Boards

GROUPS:

Simulating Quantum Computers with QuESTlink

Posted 6 days ago
297 Views
|
1 Reply
|
10 Total Likes
|

Numerically simulating the behaviour of a quantum computer is crucial in the design and study of new algorithms. Since time and memory costs scale exponentially with the number of simulated qubits, it is essential that simulators are high performance and hardware accelerated. But good research tools must also be intuitive and usable, offer a high-level interface and rapid development time. To this end, the Quantum Technology Theory Group in the University of Oxford, with support from Quantum Motion, created QuESTlink; an open-source installation-free simnulator. QuESTlink allows Mathematica simulation of quantum circuits, specified in a concise symbolic language, using remote multithreaded or GPU-accelerated hardware. A technical overview and a thorough user-guide are available in our whitepaper.

Getting started is easy:

Import["https://qtechtheory.org/questlink.m"]

CreateDownloadedQuESTEnv[]

These functions download the latest version QuESTlink (right from the github), pre-compiled for your operating system, for single-core CPU simulation. See here to compile QuESTlink in multithreaded or GPU modes, or deploy it to remote hardware.

You're now ready to simulate! Let's create a 3 qubit state-vector, initialised in the |010> state.

psi = CreateQureg[3];
InitClassicalState[psi, 2^^010];

The state-vector for psi is stored in a (possibly remote) C++ backend, though we can copy it to the Mathematica front-end if needed. In this case, it's not very interesting:

GetQuregMatrix[psi] // Chop
{0, 0, 1., 0, 0, 0, 0, 0}

Let's create a simple circuit. In the Mathematica front-end, the qubits targeted by a quantum gate are specified using subscript (ctrl -). Since we can't embed subscripts in this post, we'll display a screenshot of the circuit as specified in the front-end, and include a copy-pastable plaintext version at the bottom of this post.

enter image description here

Note qubits are indexed from 0. This is quite a fancy circuit, containing measurements, multi-qubit rotations (around arbitrary Pauli axis) and randomly-generated general unitary matrices (one and two qubits, even multi-controlled!). We'd better see what's going on:

enter image description here

We could even pass this to CalcCircuitMatrix[] to check the analytic symbolic representation of the circuit, although we've baked some floating point numbers into the circuit (and we'd have to throw away our measurements).

Applying this circuit to our state, and viewing the measurement outcomes, is easy:

ApplyCircuit[u, psi]
{{0, 1, 1}}

But QuESTlink can do much more than this. It can also simulate density matrices, decoherence channels and Kraus maps. It can plot density matrices, simulate Hamiltonians in the Pauli basis, compute derivatives of parameterised circuits, and a variety of hardware-accelerated functions like fidelity, purity, and Hilbert-Schmidy distance. Have a look with:

?QuEST`*

Our whitepaper (though you may prefer our arXiv formatting) includes some advanced demonstrations, like studying the effect of decoherence on the accuracy of Trotterisation, and performing quantum variational minimisation of a chemistry Hamiltonian. These demonstrations can be found at the end of the post. Also they are contained in attached paper_demos.nb notebook.

QuESTlink is made using a WSTP layer between Mathematica and QuEST. It is actively maintained and new features are added regularly at the request of users. Its facilities and user-base are actively growing, and it has proven a useful tool to the quantum research community. We hope it'll be of use to you!

The circuit used in this post, in plain-text:

m = RandomVariate @ CircularUnitaryMatrixDistribution[4];
u = {Subscript[H, 0], Subscript[S, 1], Subscript[T, 2], 
  Subscript[C, 0][Subscript[X, 2]], 
  Subscript[Rz, 0][Times[Rational[1, 3], Pi]], 
  Subscript[C, 2][Subscript[Ry, 1][0.1]], Subscript[SWAP, 1, 2], 
  R[0.1, Times[Subscript[X, 1], Subscript[X, 2], Subscript[Z, 0]]], 
  Subscript[C, 0, 1][
   Subscript[U, 2][{{Exp[.1 I], 0}, {0, Exp[.2 I]}}]], 
  Subscript[C, 1][Subscript[U, 0, 2][m]], Subscript[M, 0, 1, 2]}

Attachments:

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract