0 votes
asked by (190 points)
edited by


I am trying to simulate error correcting circuits which involves Hadamard gates and CZ gates. The CZ gates are implemented through the evolution of a specific truncated Hamiltonian which does not follow directly from the operators available through autoMPO. The Hamiltonian is :

where @@\Delta@@ is a control parameter and a function of time, and the ordering of basis elements in the matrix is @@|00\rangle,|01\rangle,|10\rangle,|11\rangle,|02\rangle,|20\rangle@@. I want to create the MPO for this Hamiltonian with the entire basis set (padding zeros for the missing basis elements). Is there a simple way to do this starting from the ITensor or otherwise?

The reason I want to create MPOs is I want to take advantage of approximate contraction methods. My circuit does not have a fixed starting state, so I cannot start out with an MPS, apply regular gates and keep truncating the MPS after each step. Instead I want to contract a bunch of MPOs and finally find the trace of the contracted thing.

Lastly, is there a simple way to represent a Hadamard gate (H) as an MPO on a three-level system i.e. acts as H on first two levels and Identity on the third level?

I have implemented all the above as regular tensors and its working great. The ITensor snippets for a single unitary step and Hadamard are given below :

makeUi(Index const& s1, Index const& s2, float ci, float dt)
  const float g = 15*2*PI;
  const float eta = -220*2*PI;
  const float g2 = SQRT2*g;
  auto H = ITensor(s1,prime(s1),s2,prime(s2));
  H.set(s1=3,s2=1,prime(s1)=3,prime(s2)=1,2*ci + eta);
  auto Ui = expHermitian(-dt*H,1_i);
  return Ui;

makeHad3d(Index const& s)
    auto Had = ITensor(s,prime(s));
    return Had;

The switch to MPOs is a bit rough. Any help would be appreciated.

Thank you for the entire ITensor package, it is really helpful.


1 Answer

+1 vote
answered by (70.1k points)

Hi Aditya,
Thanks for the question. I see what you are wanting to do, but I think the AutoMPO approach might not be the best fit for it. Still, you are welcome to try (see #1 below) and see if it works for you. But there might be a nicer approach anyway (see #2 below) that you could try.

Approach #1:
You could create a custom site set for AutoMPO to use. AutoMPO by itself does not define any operators, but gets them from the site set you provide to it. We don't have detailed tutorials on how to make a new site set, but you can copy one of the ones provided in ITensor which are in the itensor/mps/sites/ folder and use them as examples to copy and start from. For your case, mainly you would just remove all quantum numbers from the site object you create (in its constructor where it makes the Index it holds; this is referring to ITensor version 3+ code). Then you would change the op method to create and return the operators with the names and matrix elements that you want. Finally, you can try using your new site set in AutoMPO to see if it works well for you.

But one caution about this approach besides the question of getting AutoMPO to make what you want: if your next step is to do time evolution by exponentiating the Hamiltonian made from the AutoMPO, then although we provide some tools to do that, we and others have been finding that approach time evolution is not so accurate and has some practical issues. But maybe that's not what you were planning to do. So anyway see the next approach #2 below.

Approach #2:
Because your circuit is made of local gates, you could make your initial "state" be an identity operator on N sites "folded over" or purified into a pure state on 2N sites. The resulting pure state is a product state of Bell pairs with neighboring even and odd sites perfectly entangled with each other. Then you could apply your gates on just the odd-numbered sites of this pure state using normal MPS time evolution techniques. Reinterpreted as an MPO, it would be the one that you want.

Finally, though, I am not sure if your overall idea of combining the MPO's together afterward together will scale well. The bond dimension of the resulting MPO might have to end up being as large as the most entangled possible state that could result from evolving with that sequence of MPOs starting from a product state. So just wanted to caution you about that, but most likely you are well aware of this challenge.

Best regards,

commented by (190 points)
Hi Miles,

Thank you very much for the detailed answer. You have understood the situation really well.

Approach #1:

Yes, my plan is to exponentiate the Hamiltonian for small time steps and evolve the system using these unitaries, and I was hoping to make use of  "toExpH" function. If you say it doesn't work well, I will avoid the trouble of custom creating a SiteSet and go for the second approach that you mention.

Approach #2:

Thank you for pointing out this. I briefly worked out the details on paper and this should work. Yes, as you rightly pointed, the bond dimension in general would grow pretty rapidly. I am currently looking at surface codes and they have a nicer (local) structure. So I am hoping to get a decent advantage from working with approximate MPSs rather than exact descriptions. The blow up in the number of sites by a factor of 2 will hurt, but I think it is still doable.

Once again, thank you very much. That was very helpful.

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.