Simple exact diagonalization in ITensor

+1 vote
asked Oct 19 by JonSpalding (500 points)

I want to implement some simple exact diagonalization, for a challenging/new system, to benchmark DMRG for larger systems.

Is this simple to do? I need to keep the wavefunctions in MPS format after ED.

Thanks!

Jon

1 Answer

+1 vote
answered Oct 30 by miles (19,400 points)

Hi Jon,
I created a code formula based on your question. Please let me know if it's useful for you, or if adding something else to it would help (including better comments of what the code is doing).

Here is the link:

http://itensor.org/docs.cgi?page=formulas/simple_ed

commented Oct 30 by JonSpalding (500 points)
Thanks Miles! That might do the trick, although I think I am still going to write something up in Python since I want the full energy spectrum.

Jin and I were discussing the possibility of doing some kind of manual translation between MPS and simple ED code. For instance, make an MPO hamiltonian, then extract a full matrix version; apply that to simple vector versions of MPS with regular ED; and then translate the wave function back into MPS. This way we could solve the full eigenproblem using C++ but without losing the functionality of ITensor's analysis tools (SVD especially for getting the entanglement).

I am not sure if we're going to move forward with this approach or not but I think it would be useful.
commented Oct 30 by miles (19,400 points)
Hi Jon,
Sure thing. I think this example will help a lot of people and demonstrates some of the tensor level features of ITensor.

About getting all of the energies: if you use
    ITensor U,d;
    diagHermitian(H,U,d);
and then print "d" (Print(d);) then you should be able to get all of the energies that way.

Yes, it certainly should be possible to extract the storage of an ITensor and export the data into another code such as an ED code. There is a "code formula" about extracting the storage of a dense tensor that should help you. Eventually I want to fully document the storage types and the storage system, which is actually really flexible and interesting (if I may say so myself).

If you have some questions about accessing ITensor storage data or creating ITensors from some data directly, post a specific question on here and I can help you out.
commented Oct 30 by JonSpalding (500 points)
Ok will do! Thanks! This might actually be a lot easier than Python, because I am studying the extended hubbard model.

Would it be easy to pull the elements out of the Hamiltonian MPO and put them into a regular matrix, for purposes of getting the largest possible system size with ED? I figure there is some loss of accessible system size with the method you suggested above, is this so?
commented Oct 30 by miles (19,400 points)
Hi Jon, you should think carefully about the cost of each step if you are doing things in the full Hilbert space. While you could do the steps you mentioned above, just creating the Hamiltonian in the first place in ITensor would scale doubly exponentially with system size and you'd also not be taking advantage of the extreme sparsity of the Hamiltonian matrix. State-of-the-art ED approaches either store the Hamiltonian matrix elements in a sparse format or create the matrix elements on the fly while doing the Lanczos algorithm, say.
commented Oct 30 by JonSpalding (500 points)
So maybe it's not worth my time to get involved with ED?
commented Oct 30 by miles (19,400 points)
Hm, so it just depends on what you want. If you want to do ED separately, I was assuming it's because you want to write a more specialized code than is appropriate for ITensor because you want to reach larger system sizes and access the full spectrum. Doing so becomes hard very quickly, so there's little point in developing a specialized code unless one is going to use the key tricks, such as exploiting the sparsity of H and using algorithms like Lanczos or Davidson. Otherwise the "toy" ED one writes in ITensor (like in the code formula page I made) is good enough just for simple testing and things. Hope that helps to clarify - you can see why I don't think providing all of those ED-specific tricks would really make sense within the set of goals for ITensor itself
Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.
...