+1 vote
asked by (250 points)

Hello everybody,

my question is concerning the rewriting of a density matrix as a vector. I know how to construct an MPS with doubled length for the vectorized density matrix from a basis state (for example the Neel state for spin models) using InitState and direct initialization. Nevertheless, I have problems constructing this double-sized MPS |psi><psi| —> |psi>|psi> from a general, more complicated (larger bond dimension) state |psi> which I have in MPS-form, for example a ground state of some model obtained by DMRG.

Conceptually it is clear to me what to do, but I cannot find a good way to make a duplicate of local tensors A(i) of the wave function MPS |psi> in such a way, that the storage data is the same but the indices are new ones, i.e. they are different from the index set of the state they have been copied from so that one can distinguish the bra and ket part. I tried to use a doTask function to copy the data of the Dense data structure from the original tensor to a new created one, but didn’t really succeed with this. Is there maybe a better way to do this, or maybe an itensor function which I’ve overlooked and which could help here?

Any help is appreciated,
Best,
Stefan

commented by (70.1k points)
Hi Stefan,
To understand better, if I put aside the context of an MPS, is your main question about how to change a particular index of an ITensor while letting it continue to have the same data?
commented by (250 points)
Hi Miles,

I think this could be a possibility. The problem for me right now is to make a duplicate of an existing tensor. That means I would like to have two copies of the same data, same number of indices with the same rank, QN-blocks etc., but in two different tensors (representing the |ket> and <bra| of the density matrix) with distinguishable indices etc.

So if one does a copy of an ITensor A by ITensor B = A; followed by a change of the indices of B while keeping the data this might be an option?
commented by (1.2k points)
Hi, you are not asking for this B = dag(prime(A, 1))?
commented by (250 points)
Hi hermit0308,
I also thought about doing this, but I was hoping to have a solution with different indices (not just primed ones). Miles answer should solve this issue I suppose. Thanks anyways for mentioning this.
Stefan

1 Answer

+1 vote
answered by (70.1k points)
selected by
 
Best answer

Hi Stefan,
One way to do what you are asking is to use a "delta" tensor, which is a diagonal-sparse tensor. Using delta tensor with two indices invokes a special routine that just replaces one index with another.

So if an ITensor A has indices i1,i2,i3, you could do this to replace i2 with a new Index j:

auto j = Index("j",i2.m());
auto B = A;
B *= delta(i2,j);

Now B will have the same data as A but will have indices i1, j, i3 instead.

You can do a similar thing for IQTensors and IQIndices, but make sure in that case to use delta(dag(i2),j), that is you need to flip the arrow of i2 so that the arrow directions are compatible.

Finally, I recently added some functions called "sim" which given an index makes a new index that is distinct, but has the same "physical" properties. This is especially useful for IQIndices. So you can do:

auto j = sim(i);

To make a new IQIndex j that has the same size and QN sectors as an IQIndex j.

Miles

commented by (250 points)
Hi Miles,

thanks a lot, I think that is exactly what I was looking. Unfortunately I need to wait until next week to try it out, but the application of a delta-tensor should solve the problem as far as I can see. The sim()-function also sounds like a useful tool.

Stefan
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

...