Skip to content
Unfolding with quantum computing.
Python Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Unfolding as quantum annealing

This repository is the computational appendix of the following paper:

Kyle Cormier, Riccardo Di Sipio, Peter Wittek . Unfolding as quantum annealing. arXiv:1908.08519, 2019.

Check out package with git clone The required packages are list in requirements.txt. For the baseline results, you will also need RooUnfold; see the instructions below.

Testing out calculations

At the heart of unfolding is a matrix inversion. This problem is mapped to regularized, constrained least-squares fit that is numerically more stable even on classical hardware. In turn, we convert it to a quadratic unconstrained binary optimization problem to solve it on a quantum annealer.

In the file tests/ you can modify the definition of xedges, of the truth-level vector (x) and the response matrix (R). The code compares the product Rx=y carried out with decimal and binary representation, the latter to be used for the quantum computation.

The response matrix is converted to binary by recognizing that the linear vector space is spanned by (n_cols X n_bits) standard basis vectors v, i.e.:

( 0, 0, ..., 1 )
( 0, 1, ..., 0 )
( 1, 0, ..., 0 )

Multiplying Rv "extracts" the column corresponding to the non-zero element, e.g. R x (1,0,...,0)^T returns the first column of R. By iteration, we can convert R from decimal to binary.

The matrix-vector multiplication is carried out as usual, with the only exception that the carry bit has to be taken into account.

python tests/

To test the unfolding:

python tests/

Test QUBO unfolding using the dimod package:

python experiments/ -l 0 # no regularization
python experiments/ -l 1 # regularization strength = 1
python experiments/ -l 2 # regularization strength = 2
# etc..

Chose your backend wisely!

python experiments/ -l 0 -b cpu # use CPU 
python experiments/ -l 0 -b sim -n 2000 # use simulated annealer NEAL
python experiments/ -l 0 -b qpu -n 2000 # use real QPU: you need a DWave Leap token

Closure test

Using e.g. a 5x5 matrix:

python experiments/ -l 0 -n 10000 -b sim

Unfolding with standard methods

Install RooUnfold:

cd $HOME/development
svn co RooUnfold
cd RooUnfold

This will create a library called . You need to create links to this library and the directory with the headers:

cd -
ln -s $HOME/development/RooUnfold/ .
ln -s $HOME/development/RooUnfold/src/ .

Then run:

python experiments/

With systematics:

python experiments/ # this gives you D'Agostini etc.

# Neal
python experiments/ -n 5000 -b sim -l 0.0
python experiments/ -n 5000 -b sim -l 0.5
python experiments/ -n 5000 -b sim -l 1.0

python experiments/ -n 5000 -b qpu -l 0.0
python experiments/ -n 5000 -b qpu -l 0.5  
python experiments/ -n 5000 -b qpu -l 1.0

To speed up:

for i in $(seq 20) ; do python experiments/ -b qpu -l 0 | tail -n 1 ; done
for i in $(seq 20) ; do python experiments/ -b qpu -l 1 | tail -n 1 ; done 

or equivalently:

experiments/ -b qpu -n 20 -l 0
experiments/ -b qpu -n 20 -l 1

Make plots:

python plots/ # unfolded only nominal, no systematics
python plots/ # unfolded w/ systematics

Running in hybrid mode

DWAVE_HYBRID_LOG_LEVEL=INFO python experiments/ -b hyb
You can’t perform that action at this time.