Eigenvalues of a density matrix

Hello All,

I am a student new to ITensor and Julia. I want to know whether there is a quick way to obtain all eigenvalues of a density matrix. Here is the line of my code. I first use eigen()


This gives error message

MethodError: no method matching eigen(::MPO)

Then I try to use


I get this

UndefVarError: `diagHermitian` not defined

I guess there is something I need to add in my code to fix this. I hope someone can help me on this. Thank you so much.

diagHermitian is from the C++ code and is not in the Julia codebase. Please be sure to read the Julia documentation website here.

If it is small enough to contract all the tensors (be sure to understand the memory requirement of what you need), you can use standard Julia tools

s = siteinds("S=1/2",5)
d = randomMPO(s,1)
M = prod(d) # create one big ITensor, warning!
eigen(M,ishermitian=true)  # this will work now

If it’s too big for that, check out the tools in the exact_diagonalization.jl example.


Many thanks you for your reply. I will look into that.