Minimal code and results from the paper 'Unveiling Order from Chaos by approximate 2-localization of random matrices'
goe_spectra
countains spectra in text format. goe_spectra/N/k
is the kth sample of system size N (dimention
localized
contains the coeficients localized/N/k
are the pauli_strings.local2
function.
Run python optimize.py
to localize a spectrum and plot the convergence.
The system size N and sample k, number of gradient descent iterations can be set in optimize.py
:
if __name__ == "__main__":
from pauli_strings import*
# this is an example of localizing a 8 qubit GOE spectrum
N = 8 # system size (qbit)
k = 0 # file index (there are 200 spectra for each N stored in goe_spectra, here we open the first one)
iter = 500 # number of iterations
taus = local2(N) # list of 2-local pauli strings
E0 = np.loadtxt('goe_spectra/{}/{}'.format(N,k)) # open the spectrum
# localize the spectrum. The coeficients of the 2-localized H are stored in h
loc = Localizer(E0, taus, maxiter=iter)
h = loc.localize()
# cost vs iteration plot
plt.loglog(loc.history)
plt.xlabel('iteration')
plt.ylabel('cost')
plt.show()
plot_spectrum.py
is an example on how to load the coeficients
The 2-local operators pauli_strings.py
. The localized
are ordered in the same order that the pauli strings are generated in pauli_strings
.
Running python plot_spectrum.py
will load a set of coeficients
The 2-local model used in the paper's also includes 1-local terms (fields). The results in the localized
correspond to this model with fields,
couplings
folder. Each file starts with the sample number followed by the type of the coupling. There are 5 files per sample since there are 5 coupling types.
The couplings_example.py
script shows how to load the couplings and build a Hamiltonian out of them.