0 votes
asked by (250 points)


Do you happen to have a script/code to generate the input tensors for different scenarios?

We’re thinking of saving the tensors from ITensor to a file (in the format widely adopted in HPC sparse tensor community), which can be used to test other packages for your applications as well.


commented by (46.8k points)
Hi Jiawen,
Thanks for the question. Before answering, I have a few questions back to you.

1. what do you mean by input tensors? Do you mean tensors you plan to input into another code? Or is it a tensor with a special property?

2. we do offer the ability to save ITensors to the HDF5 file format using the Julia version of ITensor (ITensors.jl). We are working on that same capability for the C++ version of ITensor and it is almost done. Would that suit your purposes?


1 Answer

0 votes
answered by (8.5k points)
edited by

Hi Jiawen,

I'm working on a response to the email thread to send some examples of generating sparse ITensors.

It is not such an easy question to answer, since different physics problems and tensor network algorithms can lead to very different levels of sparsity, block sizes, tensor orders, etc. Often in ITensor we do not create large sparse tensors directly. Instead, they result organically from algorithms like DMRG, where blocks are generated on the fly in the SVD. Therefore, a good place to start would be to run common calculations like DMRG and extract tensors from the resulting MPS (like one in the middle of the system) for a variety of different problems. Note that specifying different symmetries of your problem (for example for the Hubbard model, choosing parity conservation vs. particle number conservation) is another way to generate tensors with different levels of sparsity.


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.