# IndexSet

ITensors.IndexSetMethod
IndexSet(inds::Vector{<:Index})

Convert a Vector of indices to an IndexSet.

Warning: this is not type stable, since a Vector is dynamically sized and an IndexSet is statically sized. Consider using the constructor IndexSet{N}(inds::Vector).

source

## Priming and tagging methods

ITensors.primeMethod
prime(A::IndexSet, plinc, ...)

Increase the prime level of the indices by the specified amount. Filter which indices are primed using keyword arguments tags, plev and id.

source
Base.mapMethod
map(f, is::IndexSet)

Apply the function to the elements of the IndexSet, returning a new IndexSet.

source

## Set operations

Base.intersectMethod
intersect(A::IndexSet, B::IndexSet; kwargs...)

Output the IndexSet in the intersection of A and B, optionally filtering by tags, prime level, etc.

source
ITensors.firstintersectMethod
firstintersect(A::IndexSet, B::IndexSet; kwargs...)

Output the Index common to A and B, optionally filtering by tags, prime level, etc. If more than one Index is found, throw an error. Otherwise, return a default constructed Index.

source
Base.setdiffMethod
setdiff(A::IndexSet, Bs::IndexSet...)

Output the IndexSet with Indices in A but not in the IndexSets Bs.

source
ITensors.firstsetdiffMethod
firstsetdiff(A::IndexSet, Bs::IndexSet...)

Output the first Index in A that is not in the IndexSets Bs. Otherwise, return a default constructed Index.

source

## Subsets

ITensors.getfirstMethod
getfirst(f::Function, is::IndexSet)

Get the first Index matching the pattern function, return nothing if not found.

source
ITensors.getfirstMethod
getfirst(is::IndexSet)

Return the first Index in the IndexSet. If the IndexSet is empty, return nothing.

source
Base.filterMethod
filter(f::Function, inds::IndexSet)

Filter the IndexSet by the given function (output a new IndexSet with indices i for which f(i) returns true).

Note that this function is not type stable, since the number of output indices is not known at compile time.

source