Learn to Use ITensor

main / classes / decomp

Tensor Decompositions

Methods for computing decompositions such as the singular value decomposition (SVD), Hermitian diagonalization, and density matrix diagonalization.

These methods are defined in "itensor/decomp.h" and "itensor/decomp.cc".


//Singular value decomposition (SVD)
auto T = randomTensor(l1,l2,s1,s2);

//Providing indices of U tells the svd
//method which indices should end up on U,
//other indices of psi will go on V

ITensor U(l1,s1),S,V;

Print(norm(T-U*S*V)); //prints: 0.0


Print(sqr(norm(T-U*S*V)/norm(T))); //prints: 1E-4

//Eigenvalue decomposition
//of Hermitian tensors
//Assumes matching pairs of indices
//with prime level 0 and 1

auto rho = ITensor(s1,s2,prime(s1),prime(s2));
//...set elements of rho...

ITensor U,D;

Print(norm(rho-prime(U)*D*dag(U))); //prints: 0.0

Singular Value Decomposition Algorithms

Hermitian Matrix Algorithms

This page current as of version 2.0.10

Back to Classes
Back to Main