+1 vote
asked by (760 points)
edited by

From this answer


I realized that one can use the "flux" function to get the quantum number flux of an ITensor. However I wonder if there is a method to get the quantum number flux for a particular element in an ITensor?

commented by (70.1k points)
Hi Chia-Min,
Is your original goal still the same? To generate a random ITensor with a certain flux? If so I can answer about that because we already have a function to do that.

Regarding your exact question above, there is not exactly a function to do what you are asking, the reason being that all non-zero elements of a QN ITensor are required by construction to have the same flux. So even if such a function existed, it would always give the same answer as calling `flux` on the whole ITensor. (Or it might throw an error if called on an element which is not allowed to be non-zero.)

commented by (70.1k points)
Based on the earlier version of  your question, I have added a new docs page finally documenting the version of `randomITensor` which accepts an QN argument, and makes a QN ITensor which has the requested flux and all elements set to random numbers which are compatible with the flux:

commented by (760 points)
Hi Miles. Thank you for the comments. Yes I still has that purpose, but I found that using the member function ".generate" with a random number generator seems will do the job and therefore I removed that part.

I have another reason for the flux function for a particular element but it is more complicated as follows. Given an MPS |psi> with no particle number QN, the overall goal is to 1) project |psi> to a particular particle number, and 2) cast the MPS to have particle-number QN. In the process, I need to cast an ITensor that does not have QN structure but should have a well defined QN, to an ITensor having QN structure. In this step I want to copy the elements based on checking the QN flux of the QN ITensor. I have implemented it by reading the QNs from the indices, but I think it would be very useful if there is a build-in function that gives the QN flux of a particular position. Since when assigning element to a QN ITensor, the code will check the flux for the proposed position, I thought there is already such a function there.

Of course if you have any comment about how to cast an MPS to having QN, it is also very helpful, but I think it would be kind of beyond this question.

Please log in or register to answer this question.

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.