A good way to do this in ITensor would be to make a new MPS with n qubits and then assign the MPS tensors of \ket{r} to the sites j=2,3,4,...,n of this MPS and then set the first MPS tensor to the \ket{0} state. I’d do it in the following way:
- make the set of qubit indices
s = siteinds("Qubit",n)
- make \ket{r} by calling
r = randomMPS(s[2:n]; linkdims=chi)
- make an MPS
psi = MPS(s,"0")
of qubits all in the \ket{0} state - finally, write a for loop that just assigns the tensors of the MPS \ket{r} to the appropriate tensors of
psi