+1 vote
asked by (400 points)

Hi, I am curious about what is the computational cost of the permute method. Does it involve copies of all the elements (slower), or does it just somehow affect only the index level and does not touch the data (fast)? Thank you!

1 Answer

+1 vote
answered by (51.6k points)

Hi Chia-Min,
Good question. It really does permute all of the data, so the cost is proportional to the number of tensor elements.

The concept of permuting can be a little bit confusing in the case of ITensors, where the index order should not matter to the user. The way to think about it is that the permute function is a "lower-level" operation which is really permuting the way an ITensor is stored in memory. The usefulness of it is in case a different layout would make a later operation more efficient, or if you want to use a more traditional notation to access tensor elements such as T(1,2,3).

Otherwise, for normal types of operations involving ITensors such as adding them or contracting them with other ITensors, there is never any need to call the permute function.

Hope that helps!

Miles

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.

Categories

...