about the bond dimension of an MPS

Hey all,
I ran into a problem with finding S from a SVD and I would appreciate if someone can help me with my problem.
I am trying to develop in time an MPS in the following way:
I am starting with a product state MPS
|00.....\rangle
and operating with an H: H_{syk}= \sum\limits_{\substack{i,j=1\\\alpha,\beta\in(x,y,z)}}^{N-1}J^{\alpha\beta}_{ij} S^\alpha_i S^\beta_j
e^{-iH_{syk}t}
until I reach maximum entanglement. After that step I am coupling this bath to a spin \psi=\frac{1} {\sqrt{2}}( |00.....0\rangle +|00.....1\rangle)

and operation with the following hamiltonian:
\sum\limits_{\substack{i,j=1\\\alpha,\beta\in(x,y,z)}}^{N-1}J^{\alpha\beta}_{ij} S^\alpha_i S^\beta_j +\sum\limits_{i=1}^{N-1}g_iS_i^zS_N^z

but, the problem is that when I am operating this on my state (for 5 spin half)
e^{-I(H_{syk}+H_{int})t}|000..0\rangle \otimes \psi
and tries to calculate the difference between ‘S[1,1]-S[2,2]’ I get an error because is a 1X1 vector.
can someone help me understand why ?


This is the code I wrote: on the left is the script itself, and on the right the functions
Thanks for all the helpers!

Hi, could you be more specific about what your question is and show us a minimal example of which code causes the issue?

Relatedly, when you post code, please do not post an image or screenshot, but instead please copy and paste the text of the code and post it using “backticks” (```) to surround a code block.

You mention “S” in your question. Does “S” refer to a matrix of singular values from some SVD you are performing? If so, is it on tensors coming from an MPS? Which tensors and how are you calling the SVD? Lastly, have you printed out the S tensor to look at it?