Learn to Use ITensor

main / classes / diag_itensor

Delta and Diagonal ITensor

A diagonal ITensor is an ITensor with diagonal-sparse storage such that only its diagonal elements Tiii... are non-zero. (Diagonal elements mean elements obtained by setting each Index to the same value.)

Uses of diagonal ITensors include replacing one Index of an ITensor with another; tracing pairs of indices; and "tying" multiple indices into a single Index.

Diagonal ITensors can be constructed either by calling the delta or diagTensor functions:

The functions delta and diagTensor are defined in "itensor/itensor.h"; also see "itensor/itensor.ih".


// Replace T's i Index with another Index l
auto T1 = ITensor(i,j,k);
T1 *= delta(i,l);

// Trace (sum over) a pair of indices
auto T2 = ITensor(i,j,prime(i));
T2 *= delta(i,prime(i));

// Tie multiple indices together
auto T3 = ITensor(i,prime(i),j,prime(i,2));
T3 *= delta(i,prime(i),prime(i,2),prime(i,3));


This page current as of version 2.0.6

Back to Classes
Back to Main