Density Matrix to MPO

Hi,

in your examples, you describe a simple way to generate an MPS with N sites from a d^N dimensional vector (representing e.g. a quantum state): MPS and MPO Examples · ITensors.jl

Is there a similarly simple way to construct an MPO from a d^N x d^N dense matrix (representing e.g. a Hamiltonian or a density matrix)?

Thanks and best wishes!

I think you can do it with two extra steps as follows:

using ITensors

d=2
N=5
sites=siteinds(d,N)
sites2=[prime.(sites)...,dag.(sites)...] #Make an index set for the doubled Hilbert space.

A2=randn(d^N,d^N)
A2T=ITensor(A2,sites2) #Extra step, convert array to a tensor with the correct indices.
H=MPO(A2T,sites,cutoff=1e-8,maxdim=10)

I hope this helps and that you keep N small :slight_smile:
JR