# How to create and add MPS

Hello there,

Sorry for the newbie question (and if that has been answered elsewhere but I haven't found approaching solutions) but here it is:

I want to create 2 MPS in Julia and add them. The first question is that I would like to customise the core MPS. As such, my first and last core MPS are different from the others in the indices they hold. Is there a way to do that ? I.e. do I have to create a MPS with say N sites and then customise one by one like MPS1 = CustomTensor1; MPS[2] = CustomTensor2, etc... ? Then, I am not sure how would ITensor resolve the indexing then.

The other question is how to change the link dimension ? I heard about pluss* but not sure it was for Julia.

Finally, if I solve question 1 I assume I'd be able to sum them together. However, is that sum equivalent to the operations described in that article (bottom of page 7, top page 8) ?

Thanks for your help, that is really appreciated.

Kind regards,

Roland

commented by (14.1k points)
The only case when there are 2x2 matrices is the first tensor at the edge of the MPS (tensor A[1] of Fig. 1 (a)), which indeed will always have a null space of size 2x0 (keep in mind because of the gauge it is already an orthogonal matrix, which always has a null space of size 0). So there will be no subspace to expand by in that case (and no index added on to the first tensor in the MPD), which is in Fig. 1(a).

For tensor A[2] to A[N-1], as you say the tensors are size 2x2x2 (dxdxd) which get reshaped into matrices of size d^2xd. Because you pick the orthogonal gauge with the gauge center at the end of the MPS (site N), the columns of this matrix are orthogonal to each other and therefore linearly independent. So the (left) nullspace is always the maximum it can be, i.e. (d^2-d) = 2 orthonormal vectors of length d^2 = 4. The left null space of that matrix cannot be empty since it is a rectangular matrix (the columns don't span the entire space).
commented by (120 points)
Hi @MattFishman,

Thank you for you answer, that's clear really.

I am now able to compute the nullspace and place the resulting vectors in G. However, I can't seem to fullfil orthogonality conditions provided by Eq. (8). Any ideas maybe ? I tried several options without much success tbh.

Thanks again !

Roland
commented by (14.1k points)
The two options are that you are putting the null space vectors into G incorrectly, or your MPS tensors weren't properly orthonormalized to begin with. Are you sure your starting MPS fulfills Eq. 2-4? Something you can do is check Eq. 8 component by component, i.e. if you fix i = 0 it should reduce to Eq. 2-4, and then if you fix i = 1 it should reduce to the orthonormality condition of the null space. Both of those should be "trivially" satisfied.
commented by (120 points)
Dear @MattFishman and @Miles,

I guess I manage to successfully achieve what I wanted to do now.

I wanted to thank you once again for your amazing support and help. All this wouldn't have been possible without it.

I guess I will have no more comments there. If there is anything I can help with please let me know.

Kind regards,

Roland
commented by (70.1k points)
Hi Roland,
Glad to hear you achieved what you were trying to do! (Thanks Matt for helping so much on this thread.)

Since you asked about helping with things, there are a few ways you can contribute:
(1) answering questions by others on this forum
(2) submitting improvements to the documentation, such as code examples (full code examples or small code example snippets after documentation of specific functions).
(3) If you find there are some specific features you've made which would be helpful for others, please consider making a pull request on our Github for us to include them in the library. If you do want to do this, though, please contact us first to ask if the contributions are in line with the overall design of the library.

Best,
Miles