Alexander Pitchford, Benjamin Dive
The code in this repository can be used to generate and analyse the data that produce the numerical results in the paper In situ upgrade of quantum simulators to universal computers. In the paper we present some numerical results that support the viability and scalability of a method for optimising quantum gates within the quantum simulator itself using a local Choi fidelity measure in the optimisation scheme.
This code has primarily been developed and tested with Python 3.6 on a Linux operating system. There is no reason why it should not work on other OS or Python versions. However, the multiprocessing features will not work so well on MS Windows.
QuTiP and its prerequistes are required to run most of the scripts and notebooks. It has been tested with version qutip 4.2. Older versions may work as well.
Jupyter notebook is required to run the notebooks.
You should clone or download this repository to use it.
There are no installation steps. Simply save the files on a computer. There are no extensions that need compiling.
You are free to use this software in your research or other activities, with or without modification, provided that the conditions listed in the LICENSE file are satisfied. We politely request that you acknowledge its source and authors, and cite our paper in any publications that may arise from its use.
Most of the code is organised into modules. There are then Python scripts and notebooks that can be run.
This qso-n_qubit-CNOT script will perform the optimisation of a CNOT on quantum system that can be configured in a wide variety of topologies and interaction types. Details of its actions and options are given in the main docstring of the file.
It requires a parameter file. By default it will use params-quant_self_opt.ini. To run it with the default parameters, in a console, enter:
$ python qso-n_qubit-CNOT.py
The parameters all link to object attributes. These are described where they are first set to their default values in qsoconfig.py.
There are other parameter files provided. params-3qubit-chain-ising.ini is simply a copy of the default file. params-4qubit-ring-heisen.ini is an example with different number of qubits, topology and iteraction type. To run with these parameters:
$ python qso-n_qubit-CNOT.py -p params-4qubit-ring-heisen.ini
params-3qubit-chain-ising_equal-xy_ctrl-cNOT1-sens-nq3fet1e-2.ini will run an automated search for the numerical accuracy threshold. This involves many more pulse optimisations than the other options and hence may take a long time to run on some systems. Again the -p
option can be employed to use these parameters.
Copies can be made of the parameter files and they can be selected using the -p
option.
The optimize_CNOT.ipynb notebook performs the same functions as the qso-n_qubit-CNOT script. It is in a Jupyter notebook format. It does not use parameter files, instead the object attributes are set directly in the notebook, and can be edited in there.
The script and notebook will utilise as many of your system's processors as specified by the num_cpus
parameter.
The data from the automated search for the numerical accuracy threshold can be interploted to provide an estimation of the threshold using the numer_acc_interpolate.py script or interpolate_num_acc_thresh.ipynb notebook. Both are configured to process the example data provided. They can be edited, as described within them, to process any of the three examples, or the data generated by the qso-n_qubit-CNOT script or optimize_CNOT.ipynb notebook.
There are two scripts that can be used to investigate the scaling of the local fidelity error bound. LocalFidTightnessBound.py processes a range of system sizes. LocalFidTightnessBound-batch.py processes one system size, designed for use with some batch job scheduler.