Learn to Use ITensor

main / classes / indexset


Container for storing indices. IndexSets are ordered lists of Index objects, but in certain contexts are treated as sets (order independent).

IndexSet is defined in "itensor/indexset.h". Also see "itensor/indexset_impl.h". An IndexSet is a subclass of Range which is defined in "itensor/tensor/range.h".


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

auto inds = IndexSet(b1,b3,s2,s3);

//Print all the indices
for(auto& i : inds) println(i);

//Or just print the whole set at once
println("inds = ",inds);

Print(order(inds)); //prints 4


Accessor Methods

IndexSet Prime and Tag Methods

IndexSets have all of the same tagging and priming methods that are defined for ITensors.

Note: all of the following functions listed of the form:

.f(TagSet, ...)

.f(TagSet, TagSet, ...)

.f(int, ...)

perform an in-place modification of the IndexSet. ... stands for optional arguments to specify a subset of indices of the IndexSet to apply the operation .f().

Functions of the form:

f(IndexSet, TagSet, ...) -> IndexSet

f(IndexSet, TagSet, TagSet, ...) -> IndexSet

f(IndexSet, int, ...) -> IndexSet

perform the same operation as the above in-place operations and accept the same optional arguments, but do not modify the input IndexSet and instead return a new, modified IndexSet.

Comparison and Set Operations

Other IndexSet Methods and Features

Range Methods

This page current as of version 3.0.0

Back to Classes
Back to Main