# Introduction to Factorizing ITensors The real power of tensor algorithms comes from tensor factorization, which can achieve huge compression of high-dimensional data. For example, a [matrix product state](https://tensornetwork.org/mps/) (a.k.a. tensor train) can be viewed as the successive factorization of a very high rank tensor. The ITensor approach to tensor factorizations emphasizes the structure of the factorization, and does not require knowing the index ordering. ITensor offers various tensor factorizations, but in this chapter we focus on the example of the SVD, which is used frequently in physics applications. ### Singular Value Decomposition The singular value decomposition (SVD) is a matrix factorization that is also extremely useful for general tensors. As a brief review, the SVD is a factorization of a matrix M into the product $$ M = U S V^\dagger $$ with U and V having the property @@U^\dagger U = 1@@ and @@V^\dagger V = 1@@. The matrix S is diagonal and has real, non-negative entries known as the singular values, which are typically ordered from largest to smallest. The SVD is well-defined for any matrix, including rectangular matrices. It also leads to a controlled approximation, where the error due to discarding columns of U and V is small if the corresponding singular values discarded are small. For more background reading on the SVD, see our [[SVD article|tutorials/SVD]]. To compute the SVD of an ITensor, you only need to specify which indices are (collectively) the "row" indices (thinking of the ITensor as a matrix), with the rest assumed to be the "column" indices. Say we have an ITensor with indices i,j, and k auto T = ITensor(i,j,k); and we want to treat i and k as the "row" indices for the purpose of the SVD. To perform this SVD, we can call the function `svd` as follows: auto [U,S,V] = svd(T,{i,k}); The notation `auto [U,S,V]` is a convenient C++17 feature that captures multiple return values from a function and defines the variables `U`, `S`, and `V` all in one line. `U`, `S`, and `V` are ITensors. Diagrammatically the SVD operation above looks like: The guarantee of the `svd` function is that the ITensor product `U*S*V` gives us back an ITensor identical to T: Print(norm(U*S*V - T)); //typical output: norm(U*S*V-T) = 1E-13