##### Example codes: readme

Here we provide simple example codes in order to demonstrate important tensor network algorithms. These codes are all presented in three programming languages common for scientific computation: MATLAB (R2016b onwards), Julia (v1.0.1.1) and Python (v3.7.1). Our intention is to help newcomers get started with practical calculations in the field of tensor networks. All codes make use of the general tensor network contraction routine "ncon" found here (MATLAB version) or at the bottom of this page (MATLAB, Julia and Python versions).

â€‹

Our codes are written using the standard data structures and inbuilt functions (native to MATLAB, Julia and Python/Numpy) where-ever possible in order facilitate their understanding. Codes are intended to be copy-pasted direct from the website into a text editor (no installation necessary!), where each algorithm is presented as a stand-alone function that can be run without any external dependencies (apart from the general dependency on the "ncon" routine, as well as some potential dependency on commonly used packages for the programming language in question).

â€‹

As these codes are primarily for teaching purposes we have prioritized simplicity and stability; thus our implementations are not necessarily the most optimal implementations of the algorithms in question, nor do they necessarily contain more sophisticated refinements and improvements (although we strive to make the codes as efficient as possible within this framework).

â€‹

These codes are not intended to be directly used in numerical simulations for research purposes, although we do not object to this. However, we kindly ask that you cite the corresponding article arXiv.xxxxxxxxx if you do use them in research, in order to promote awareness of these resources. See GPL and LGPL for copyright conditions. Please contact us as at "contact@tensors.net" for bug reports or suggestions for improvements.

##### Code examples overview:

###### Exact diagonalization:

This short example code demonstrates the proper use of the standard sparse eigensolver 'eigs' built into MATLAB/Julia (which utilise ARPACK) to compute the exact ground and/or select excited states of a quantum many-body system described by a local Hamiltonian.

###### Density matrix renormalization group (DMRG):

widely used and powerful method for the study of quantum systems on D=1 dimensional lattices and small-width D=2 dimensional lattices. Our code implements DMRG for finite systems with open boundary conditions, following closely the original implementation of White. Two versions are presented: one for matrix product operator (MPO) Hamiltonians and the other for local Hamiltonians written as a sum of two-body terms.

###### Time evolving block decimation (TEBD) for matrix product states (MPS):

method for implementing real or imaginary time evolution of matrix product states (MPS), based on a suzuki-trotter decomposition of a local Hamiltonian. Our code, which follows closely the original proposal of Vidal, demonstrates the use of imaginary time evolution to find the ground state of an infinite (translation-invariant) quantum system in D=1 dimensions.

###### TEBD for infinite projected entangled pair states (iPEPS):

powerful algorithm for finding ground states of local Hamiltonians on lattices in D=2 dimensions via imaginary time evolution. Our code follows much of the original proposal, but makes use of the corner transfer matrix (CTM) approach to contract the iPEPS and utilizes some refinements introduced in the appendix of this reference.

###### Multi-scale entanglement renormalization ansatz (MERA):

tensor network ansatz particularly well-suited to the study of quantum critical systems. Our code implements variational energy minimization to optimize a scale-invariant MERA for the ground state of a quantum critical system in D=1 dimensions, following closely the method presented here while also incorporating some of the later improvements detailed here.

###### Boundary MERA:

extension of the MERA approach for semi-infinite chains, useful for computing boundary conformal data from critical systems. Our code follows much of the methods introduced in the original boundary MERA manuscript, but is based on the version of boundary MERA introduced here. This code could be extended to more general impurity or interface systems as discussed here.

###### Tensor Renormalization Group (TRG)

method for contracting the partition function of a 2D classical system or the Euclidean path integral of a 1D quantum system. Although ultimately equivalent to the original proposal of Levin, our code utilizes optimized isometries rather than the SVD to contract the network, as discussed here.

###### Tensor Network Renormalization (TNR)

upgraded version of the tensor renormalization approach which makes use of disentanglers to achieve a computationally scalable coarse-graining step for 2D classical or 1D quantum systems at a critical point. Our code uses methods introduced in original manuscript in conjunction with some of the later refinements introduced here. Also demonstrated is the construction of MERA from TNR, and the extraction of conformal data using TNR.