+1 vote
asked by (260 points)

Dear ITensor family,

I want to access a specific element of MPS, for example:
How to obtain the value of $\psi _{1,1,...,1}$ from the general $\psi _{s1,s2,...,sn}$. Is there have such function?

Best,
Meng

2 Answers

0 votes
answered by (70.1k points)

Hi Meng,
Good question. We should have some examples for that. I'll probably soon make a built-in function that helps with this too.

Please take a look at this new 'code formula' I just posted on the ITensor website with example code showing you how to do the thing you are asking about. I'd appreciate any feedback you may have, such as if you have any questions about it:

http://itensor.org/docs.cgi?vers=cppv3&page=formulas/mps_element

commented by (70.1k points)
Note that in the code the function setElt makes an ITensor which has a single non-zero element equal to 1 (so like a standard basis vector) with the given index value supplied. I’ll expand the writing on the webpage to discuss aspects of the code a bit more.
0 votes
answered by (70.1k points)
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

...