Clone via github.
(this is the preferred method—see our git quickstart guide.)
Or download latest
version v1.1.1 (changelog)

ITensor—Intelligent Tensor—is a C++ library for implementing tensor product wavefunction calculations. It is efficient and flexible enough to be used for research-grade simulations.
Features include:

ITensors are nearly as easy to multiply as scalars: all tensors indices are stamped with a unique internal id number; matching indices automatically contract when two ITensors are multiplied, making it simple to transcribe tensor network diagrams into correct, efficient code.

For example, the diagram below (resembling the partial overlap of two matrix product states) can be converted to code as

Installing ITensor:

  1. Clone the latest version:
    git clone itensor
    Or download zip file if you do not have git.
    (Cloning with git allows you to track changes to ITensor and is the preferred method; for more see our git quickstart guide.)
  2. Read the installation instructions.
  3. Learn more from the documentation.

Code Samples

Perform a DMRG Calculation

int N = 100; //Define Hilbert space of N=100 spin-lattice sites SpinOne sites(N); //Create 1d Heisenberg Hamiltonian AutoMPO ampo(sites); for(int j = 1; j < N; ++j) { ampo += 0.5,"S+",j,"S-",j+1; ampo += 0.5,"S-",j,"S+",j+1; ampo += "Sz",j,"Sz",j+1; } auto H = MPO(ampo); //Set up random initial wavefunction MPS psi(sites); //Perform 5 sweeps of DMRG Sweeps sweeps(5); //Specify max number of states kept each sweep sweeps.maxm() = 50, 50, 100, 100, 200; //Run the DMRG algorithm dmrg(psi,H,sweeps); //Continue to analyze wavefunction afterward Real energy = psiHphi(psi,H,psi); for(int j = 1; j <= N; ++j) { //make site j the MPS "orthogonality center" psi.position(j); //Measure magnetization Real Szj = toReal(psi.A(j) * sites.op("Sz",j) * dag(prime(psi.A(j),Site))); println("Sz_",j," = ",Szj); }

Multiply Two ITensors

Index a("a",2), b("b",2), c("c",2);
ITensor Z(a,b), X(c,b);
commaInit(Z,a,b) = 1, 0,
commaInit(X,b,c) = 0, 1, 
                   1, 0;

//the * operator finds and
//contracts common index 'b'
//regardless of index order:

ITensor R = Z * X;

Print( R(a(1),c(2)) ); //Prints: R(a(1),c(2)) = 1
Print( R(a(2),c(1)) ); //Prints: R(a(1),c(2)) = -1

ITensor Collaboration

E. Miles Stoudenmire
Perimeter Institute
Miles has been the primary developer since 2010.
Steven R. White
UC Irvine
Steve developed the original ITensor concept and implementation and remains actively involved.