iTranslated by AI
Understanding Matrix Product States
Purpose
When I tried to understand Matrix Product States (MPS), I didn't get it at all, so I'm going to do some drawing until I feel like I somewhat understand "Matrix Product." [1]
Matrix Product is apparently an example of a tensor network. In the diagram below, representing the tensor on the left as shown on the right is called a Matrix Product. [2]
| Tensor | of | Decomposition into Matrix Product |
|---|---|---|
![]() |
→ | ![]() |
According to reference [2], a "Matrix Product" is explained not as a product of matrices, but as a multi-legged tensor.
Since I feel like the meaning won't eventually become clear just by staring at such diagrams repeatedly, I'd like to consider a specific, simple tensor
Matrix Product through a Concrete Example
Considering a 3rd-order tensor
Consider a 3rd-order tensor

I'll also include an example calculation using NumPy:
T = np.array(range(27)).reshape(3, 3, 3)
print(T)
[[[ 0 1 2]
[ 3 4 5]
[ 6 7 8]][[ 9 10 11]
[12 13 14]
[15 16 17]][[18 19 20]
[21 22 23]
[24 25 26]]]
Grouping tensor indices
Referring to reference [2], let's group the indices of

Here, we flatten the

A = T.reshape(3, -1)
print(A, f'{A.shape=}')
[[ 0 1 2 3 4 5 6 7 8]
[ 9 10 11 12 13 14 15 16 17]
[18 19 20 21 22 23 24 25 26]] A.shape=(3, 9)
Performing Singular Value Decomposition (SVD)
If we treat the aforementioned

Then, if we take the product of

T1, s, vh = np.linalg.svd(A)
s = (s * np.eye(3)).flatten()
s.resize(9, 3)
s = s.T
S = (s @ vh).reshape(3, 3, 3)
print(f'{T1.shape=}, {s.shape=}, {vh.shape=}, {S.shape=}')
T1.shape=(3, 3), s.shape=(3, 9), vh.shape=(9, 9), S.shape=(3, 3, 3)
When drawn as a tensor diagram, it looks like this:

Written as a formula, it would be:
Note that the bond dimension is 3, which appears in T1.shape[1] or S.shape[0].
Repeating the process...
By grouping the indices of tensor

Verifying with Python calculations
Since we have already obtained T1 and S, let's decompose S into a matrix product.
A2 = S.reshape(-1, 3)
u2, s2, T3 = np.linalg.svd(A2)
s2 = (s2 * np.eye(3)).flatten()
s2.resize(9, 3)
T2 = (u2 @ s2).reshape(3, 3, 3)
print(f'{T1.shape=}, {T2.shape=}, {T3.shape=}')
T1.shape=(3, 3), T2.shape=(3, 3, 3), T3.shape=(3, 3)
Now, the tensor
Verification
Let's perform the contraction calculation:
T12 = np.einsum('il,ljm', T1, T2)
T123 = np.einsum('ijm,mk', T12, T3)
print(np.round(T123, 2))
[[[ 0. 1. 2.]
[ 3. 4. 5.]
[ 6. 7. 8.]][[ 9. 10. 11.]
[12. 13. 14.]
[15. 16. 17.]][[18. 19. 20.]
[21. 22. 23.]
[24. 25. 26.]]]
We obtained the original tensor T.
Just to be sure, looking at T1, T2, and T3, they look like this:
print(np.round(T1, 2))
[[-0.17 0.9 0.41]
[-0.51 0.28 -0.82]
[-0.85 -0.34 0.41]]
print(np.round(T2, 2))
[[[-36.97 -0.44 0. ]
[-44.85 -0.07 -0. ]
[-52.73 0.3 -0. ]][[ -4.83 1.4 0. ]
[ -0.51 1.2 0. ]
[ 3.82 1. 0. ]][[ -0. -0. 0. ]
[ 0. -0. -0. ]
[ -0. -0. -0. ]]]
print(np.round(T3, 2))
[[ 0.54 0.58 0.61]
[-0.73 -0.03 0.68]
[ 0.41 -0.82 0.41]]
Summary
In the end, I still don't understand the real benefits of using a matrix product, but I've explored a simple sample to see what steps are required to bring it into the matrix product format.
I haven't looked into other decomposition methods or uniqueness yet, but as this is the first step, I'd like to investigate the remaining questions over time.
References
[1] Matrix product state simulation method
[2] Foundations and Applications of Tensor Networks (Japanese Title: テンソルネットワークの基礎と応用)
[3] Matrix Product State / Tensor Train

Discussion