This is the follow-up code for the article Quantum Machine Learning Tensor Network States
The program generates a given number of random unitary matrices of dimensionality 2^n, where n is a given number of qubits, and, for each unitary, tries to approximate one of its eigenstates by using the Matrix Product State (MPS) ansatz with successive increasing the number of ebits it can support (see the original paper for details). Random unitaries are generated by means of the function unitary_group(), which is a part of the SciPy package. For the minimization part of the algorithm, the optimization methods from scipy.optomize.minimize are used. The initial parameters of the MPS ansatz are set randomly for each run.
The program is represented in two versions: as the source code learning-mps.py and as the Jupyter notebook learning-mps.ipynb.
The program requires the following inputs:
- number of qubits (e.g. 4)
- number instances to average over (e.g. 5)
- optimization method (e.g. BFGS)
The program outputs the four files:
- fun_values_flat.txt -- values of the cost function for each iteration;
- overlaps_flat.txt -- overlaps with the closest eigenstate for each iteration;
- entanglements_flat.txt -- entanglement entropies of the found eigenstate for each iteration;
- plot-*.pdf -- the plot of above-mentioned values.
The Qiskit package is required for execution.