For a work on Lindblad Equations I need to build an MPO adding non-local terms. Without entering in so much details please consider the following example:
H = \sum_{i = 1}^{N-1}\sigma_{x}\sigma_{x+1}
As this is very simple, I can do:
using ITensors
using ITensorMPS
N = 4
sites = siteinds("S=1/2", N)
σx = [0 1; 1 0]
os = OpSum()
for i=1:N-1
os += 1, "σx", i, "σx",i+1
end
H = MPO(os, sites)
However, for my personal code, I cannot write the 2-site operator as a product of two local operators. I just have the operator as a 4x4 matrix, I need to do something like:
A = kron(σx,σx) #Example of 2-site operator
os = OpSum()
for i=1:N-1
os += 1, A, i,i+1 #Maybe something like this?
end
H = MPO(os, sites)
Clearly I got an error: MethodError: no method matching +(::Sum{Scaled{ComplexF64, Prod{Op}}}, ::Matrix{Int64})
Basically, I want to add a 2-site operator to the OpSum(). Is there a way to do something like that?