# How to create a particular initial state as a MPS?

+1 vote

Given an initial state written, in the full Hilber Space, as

$$|\psi\rangle = \otimes_{j=1}^{L/2}|\leftarrow\rangle \otimes_{j=L/2+1}^L |\rightarrow\rangle,$$

such that,

$$\hat{\sigma}_x |\leftarrow\rangle = +|\leftarrow\rangle\$$

$$\hat{\sigma}_x |\rightarrow\rangle = -|\rightarrow\rangle.$$

How can I write it in the form of an MPS?

selected by

One way is to set all qubits in this form (left half of the chain spin up, right half with spin down):

SpinHalf sites = SpinHalf(N);

auto init = InitState(sites);
for(auto n : range1(N)) {
if (n <= N/2) {
init.set(n, "Up");
} else {
init.set(n, "Dn");
}
}
auto psi = MPS(init);


and then applying the Hadamard gate in all the qubits:

for(int n = 1; n <= N; ++n)
{
auto ind = sites(n);
auto indP = prime(sites(n));
}
psi.mapprime(1,0,Site);


You should get the desired product state.

commented by (240 points)
Thank you very much.
I implemented it, but something strange happened: iIn order to control if the states is the desired one, I calculate @@\langle \hat{sigma}\_x (j) \rangle@@ with @@j=1,2,...,L@@. I obtain the right values from @@[1,L-1]@@, but not for @@L@@, for which @@\langle \sigma\_x(L) \rangle = 0@@.

Does it happen also to you? If you could check it would be great.
commented by (680 points)
I just tested and it work as desired, including the last site. Here is my code:

for(int j = 1; j <= N; ++j)
{
psi.position(j);
Real Sxj = (psi.A(j)
* sites.op("Sx",j)
* dag(prime(psi.A(j),Site))).real();
println("Sx_",j," = ",Sxj);
}

and the result for 10 sites:

Sx_1 = 0.5
Sx_2 = 0.5
Sx_3 = 0.5
Sx_4 = 0.5
Sx_5 = 0.5
Sx_6 = -0.5
Sx_7 = -0.5
Sx_8 = -0.5
Sx_9 = -0.5
Sx_10 = -0.5
commented by (240 points)
Okok, it works fine.  Thank you very much!
commented by (310 points)
how can we do the same for julia version?