Hi, Miles and Matt
The MPO Hamiltonian itensor is generated as follows
using ITensors
let
N = 2
sites = siteinds("S=1/2",N;conserve_qns = true)
ampo = OpSum()
for j=1:N-1
ampo += "Sz",j,"Sz",j+1
ampo += 0.5,"S+",j,"S-",j+1
ampo += 0.5,"S-",j,"S+",j+1
end
H = MPO(ampo,sites)
Hitensor = ITensor(1.)
for i = 1:N
Hitensor *= H[i]
end
end
Basically, all bond indices are constructed, and the resulting Hitensor only has physical indices. I am trying to get its matrix form using matrix(Hitensor), but it returns the following error message:
ERROR: DimensionMismatch:
Stacktrace:
[1] matrix(T::ITensor)
@ ITensors ~/.julia/packages/ITensors/5CAqA/src/itensor.jl:2818
[2] top-level scope
@ REPL[64]:1
I’ve checked this doc, but still can not find the correct method.
Can you give me an example to obtain it?
By the way, is this matrix still a sparse matrix? Because my purpose of doing all this is to perform ED calculation for benchmark. I know these is a function eigen to do this. But it turns out to be inefficient for obtaining all eigenvalues without eigenvectors (correct me if I am wrong) when the system size becomes relatively large. So here I simply try to firstly generate a sparse matrix then resort to other packages or even using eig from matlab.
Best,
Junsen