Learn to Use ITensor

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

ITensor version 3 has not been released yet. This documentation is a preview only.

ITensor

An ITensor is a tensor with named indices (of type Index). The key feature of the ITensor is automatic contraction over all matching indices, similar to Einstein summation.

An ITensor is created with a fixed number of Index objects specifying its indices. Because Index objects carry identifying information, most of the ITensor interface does not depend on the Index order. For example, given an ITensor constructed with indices a and b, calling T.elt(a=2,b=5) and T.elt(b=5,a=2) accesses the same tensor element.

In addition to real-valued storage, ITensors can have other storage types such as complex storage or various sparse storage types.

If an ITensor is constructed with regular indices (Index objects I for which hasQNs(I)==false) then its storage will be dense.

If instead an ITensor is constructed with indices carrying additional quantum number (QN) block structure (Index objects I for which hasQNs(I)==true) then its storage will be block-sparse. (Up through version 2 of ITensor, such ITensors were called IQTensors.)

The ITensor class is defined in the header "itensor/itensor.h"

Synopsis

auto b1 = Index(5);
auto b3 = Index(8);
auto s2 = Index(2,"Site");
auto s3 = Index(2,"Site");

auto phi = ITensor(b1,s2,s3,b3);

phi.set(b1=2,s2=1,s3=2,b3=2, -0.5);
phi.set(b1=3,s2=2,s3=1,b3=6, 1.4);
//...

auto nrm = norm(phi); //save the original norm of phi
phi /= nrm; //division by a scalar
Print(norm(phi)); //prints: 1.0

//The * operator automatically contracts all matching indices.
//The prime(phi,b3) method primes the b3 Index of the second
//ITensor in the product so it is not contracted.

ITensor rho = phi * prime(phi,b3);

Print(rank(rho)); //prints 2
Print(hasIndex(rho,b3)); //prints: true
Print(hasIndex(rho,prime(b3))); //prints: true
Print(hasIndex(rho,b2)); //prints: false

Constructors and Accessor Methods

Element Access Methods

Prime Level Methods

Index Tag Methods

Operators Supported By ITensors

In this section, expressions like ITensor * ITensor -> ITensor are pseudocode indicating that two ITensors can be multiplied using the * operator, and that the result will be an ITensor.

Complex ITensor Methods

Elementwise Transformation Methods

Other Facts About ITensors

Functions for Modifying ITensors

Functions for Transforming ITensors

Extracting Properties of ITensors

Analyzing ITensor Indices

Other Functions

Advanced / Developer Methods


This page current as of version 3.0.0


Back to Classes
Back to Main