# IndexSet

ITensors.IndexSetMethod
IndexSet{N, IndexT}(inds)
IndexSet{N, IndexT}(inds::Index...)

Construct an IndexSet of order N and element type IndexT from a collection of indices (any collection that is convertable to a Tuple).

source
IndexSet{N}(inds)
IndexSet{N}(inds::Index...)

Construct an IndexSet of order N from a collection of indices (any collection that is convertable to a Tuple).

source
IndexSet(inds)
IndexSet(inds::Index...)

Construct an IndexSet from a collection of indices (any collection that is convertable to a Tuple).

source
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
IndexSet{N}(inds::Vector{<:Index})

Convert a Vector of indices to an IndexSet of size N.

Type stable conversion of a Vector of indices to an IndexSet (in contrast to IndexSet(::Vector{<:Index})).

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...)

intersect(f::Function, A::IndexSet, B::IndexSet)

intersect(:Order{N}, A::IndexSet, B::IndexSet; kwargs...)

intersect(f::Function, ::Order{N}, A::IndexSet, B::IndexSet)

Output the IndexSet in the intersection of A and B, optionally filtering with keyword arguments tags, plev, etc. or by a function f(::Index) -> Bool.

Specify the output number of indices N with Order(N).

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

firstintersect(f::Function, A::IndexSet, B::IndexSet)

Output the first Index common to A and B, optionally filtering by tags, prime level, etc. or by a function f.

If no common Index is found, return nothing.

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(f::Function, ::Order{N}, 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.

To make it type stable, specify the desired order by passing an instance of the type Order.

source