Index are used throughout ITensors.jl to represent the dimensions of tensors. In general, collections that are recognized and returned by ITensors.jl functions are either
Index, depending on the context. For example internally an
ITensor has a static number of indices so stores a
Index, while set operations like
commoninds((i, j, k), (j, k, l)) will return a
[j, k] since the operation is inherently dynamic, i.e. the number of indices in the intersection can't in general be known before running the code.
Index can usually be used interchangeably, but one or the other may be faster depending on the operation being performed.
Documentation for priming and tagging collections of Index can be found in the ITensor Priming and tagging section.
Documentation for set operations involving Index collections can be found in the ITensor Index collections set operations section.
Get the first Index matching the pattern function, return
nothing if not found.
Return the first Index in the Indices. If the Indices is empty, return
Create an iterator whose values correspond to a Cartesian indexing over the dimensions of the provided
Create an iterator whose values are Index=>value pairs corresponding to a Cartesian indexing over the dimensions of the provided
i = Index(3; tags = "i") j = Index(2; tags = "j") T = randomITensor(j,i) for iv in eachindval(i,j) @show T[iv...] end
Return the direction of the Index
i in the Indices