+1 vote
asked by (290 points)


I am trying to do an example by obtaining the ground state of a non-Hermitian Hamiltonian. Is it possible to do it now in Julia (or in the future version when there is Arnoldi eigensolver). I already know there's one in the C++ version. Thank you!

1 Answer

+1 vote
answered by (70.1k points)

Hi Terry,
The short answer is that this is not currently available in the Julia version at the level of an option you can pass to the dmrg function, if that's what you are asking. Similarly for the C++ version there is no such option, though as you noted we do offer an Arnoldi algorithm code.

But for both versions you could modify the DMRG code to use Arnoldi. For the Julia version this should actually be pretty straightforward, because the eigsolve function we call from Julia is a function offered by the package KrylovKit.jl and that same eigsolve function offers the ability to change the algorithm to Arnoldi. Here is a documentation page on eigsolve explaining about this:

However, not having written non-Hermitian DMRG myself, I'm not sure off hand what other changes might be needed to the rest of the DMRG algorithm. Perhaps not very many other than changing the eigen solver?

Best regards,

commented by (290 points)
Hi Miles,

Thank you so much for your answer! I will be looking into your suggestion.

For the last part, I guess you are probably correct. See this paper for example: https://arxiv.org/pdf/2001.07088.pdf

commented by (14.1k points)
You could try changing this line here: https://github.com/ITensor/ITensors.jl/blob/master/src/mps/dmrg.jl#L108 to `ishermitian::Bool = false`. You can also change the line to `ishermitian::Bool = get(kwargs, :ishermitian, true)` to have DMRG use the keyword argument `ishermitian`, which gets passed to the eigensolver from KrylovKit as Miles alluded to. I didn't make it available yet since I hadn't tested that functionality at all.

Could you try that out for your problem and let us know if it works? We can make it available if we get some confirmation that it works ok.

commented by (290 points)
Hi Matt,

Thank you for your suggestion. I will be working on this for some non-Hermitian Hamiltonian. Just a technical question here as I am a newbie for Julia: should I write a new julia function, say nHdmrg.jl or I create my own package based on ITensor.jl as it is written here: https://itensor.github.io/ITensors.jl/stable/AdvancedUsageGuide.html  

commented by (14.1k points)
Hi Tianqi,

No need to make your own package or make a new function. You can follow the instructions in this section:


to make your own local "development" version of ITensors.

Unfortunately that section needs more details and is a work in progress, but all you have to do is type the command `julia>] dev ITensors` (where `]` enters package mode at the Julia REPL). Then, if you edit the `dmrg` function in the file `~/.julia/dev/ITensors/src/mps/dmrg.jl`, you will see the changes you make when you use ITensors with `using ITensors`.

As that section mentions, if you install the package Revise with `julia>] add Revise`, it makes it so that when you edit your local version of ITensors found in `~/.julia/dev/ITensors`, you don't even have to restart Julia to see the change you make. You can test this by adding a print statement, like `println("Testing Revise")`, inside the `dmrg` function, and then run the `dmrg` function without restarting your Julia session.

To switch back to the "official" ITensors version you had installed, you can type `julia>] free ITensors`. The development version will still be saved and you can use it again by typing `julia>] dev ITensors`. This is the preferred way to develop a package, and you can use it to make a pull request to ITensors.

Let me know if you have any questions or if the process is confusing, I'll try to update that page with more details about the development process.

commented by (290 points)
Hi Matt,

Thanks for your explanation in detail. It is very clear. I will try this and let you all know about my results here at a later time.

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.