- Quantum Exact Simulation Toolkit is a high performance simulator of quantum circuits, state-vectors and density matrices.
-
QuEST.jl
is a wrapper forQuEST
, which is written inC
.QuEST.jl
was compiled usingBinaryBuilder.jl
, which is a system for the compilation of binary dependencies --whose aim it to just work anywhere the official Julia distribution does. - Function calls, enumerators, structs, etc were wrapped automatically using
Clang.jl
, which provided the neededC
bindings for the Julia interface. -
Note: Julia is indexed starting at
$1$ and goes until$N$ items in an$N-$ element list.C
indexes an$N-$ element list from$0$ to$N-1$ . - To give the Julia user uniform interface, every
QuEST
call using an integer index, will first shift the index to be in the$0$ indexed form inside the Julia function. The user should be aware of this, but it is the aim of theQuEST.jl
parckage wrapper writer(s) to handle this for the user.
Whilst we are working on getting this package registered with the official Julia registry, to use QuEST.jl
using Pkg
Pkg.add(url = "https://github.com/ediparquantum/QuEST.jl")
or
] add https://github.com/ediparquantum/QuEST.jl
using QuEST
num_qubits = 2
env = createQuESTEnv()
# create a 2 qubit register in the zero state
qubits = createQureg(num_qubits, env)
initZeroState(qubits)
# apply circuit
hadamard(qubits, 1)
controlledNot(qubits, 1, 2)
measure(qubits, 2)
# unload QuEST
destroyQureg(qubits, env)
destroyQuESTEnv(env)
For more in depth tutorials see (C
based)
- QuEST's github
- QuEST C based tutorial - there are some code examples to get an idea of the flow
- QuEST website
- QuEST's webiste documentation
- Decoherence (noise) models
- QuEST's code documentation
- QuESTlink - mathematica
- QuEST whitepaper
To maintain QuEST.jl with future releases of QuEST:
- go to BinaryBuilder.jl doc's page
- Follow instructions to pre-compile the latest version of QuEST according hardware requirements
- The
build_tarballs.jl
file showcasing how to precompile QuEST is found on the Yggdrasil package page here - Best to follow instructions from (1) and use the wizard
- Once this is done the updated pacakge
QuEST_jll.jl
will automatically update with the latest precompiled version. Found on the Julia binary wrapper organisation (JuliaBinaryWrapper), check the repositories for your package (QuEST_jll.jl
). - Now if there are any updated funcation names or new interfaces, this package
QuEST.jl
will need to be updated. See example:
Call C
with a ccall
type function. Consider the Hadamard function as example
function hadamard(qureg, targetQubit)
test_qubit_present(qureg,targetQubit)
targetQubit = c_shift_index(targetQubit)
@ccall libquest.hadamard(qureg::Qureg, targetQubit::Cint)::Cvoid
end
The line starting with @ccall...
is calling the function by accessing the precompiled binary. To presenve segmentation faults and hence prevent Julia crashing at function call I assert the targetQubit
, which is an integer and is in the set of qubits contained in the qureg
, if not, then an error is thrown. Calls to C
need to ensure indices are shifted to the 0
-index, which is done with c_shift_index
.
Then follow standard Julia package management and release for new version.
Some tests and functions were inspired and directly used from the public repository Dighvijay: QuEST.jl made possible from the efforts of Dighvijay on GitHub. We thank them for their valuable contributions.