Learn to Use ITensor

main / classes / decomp C++v3 | C++v2

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".

Synopsis

auto l1 = Index(12,"l1");
auto l2 = Index(12,"l2");
auto s1 = Index(4,"s1");
auto s2 = Index(4,"s2");

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

//The IndexSet specifies which indices
//of T will end up on U.
//The output is a tuple of the ITensors
//of the decomposition and the new
//indices created in the decomposition

auto [U,S,V] = svd(T,{l1,s1});

Print(norm(T-U*S*V)); //On the order of 1E-15

std::tie(U,S,V) = svd(T,{l1,s1},{"Cutoff",1E-4});

Print(sqr(norm(T-U*S*V)/norm(T))); //On the order of 1E-4

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

auto H = randomITensorC(s1,s2,prime(s1),prime(s2));
H = 0.5*(H+dag(swapTags(H,"0","1")));

auto [Q,D] = diagHermitian(H);

Print(norm(H-prime(Q)*D*dag(Q))); //On the order of 1E-15

Singular Value Decomposition

Hermitian Diagonalization

General Factorizations

Hermitian Matrix Exponentiation

Old Syntax and Spectrum Output

The following are older interfaces for ITensor decomposition functions for backwards compatibility and internal usage.


This page current as of version 3.0.0


Back to Classes
Back to Main