Skip to content

Commit

Permalink
fix inds with set kwarg
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Dec 26, 2024
1 parent 78283a7 commit 75575af
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/TensorNetwork.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,19 @@ function inds end
inds(tn::AbstractTensorNetwork; kwargs...) = inds(sort_nt(values(kwargs)), tn)
inds(::@NamedTuple{}, tn::AbstractTensorNetwork) = inds((; set=:all), tn)

function inds(::NamedTuple{(:set,)}, tn::AbstractTensorNetwork)
function inds(kwargs::NamedTuple{(:set,)}, tn::AbstractTensorNetwork)
tn = TensorNetwork(tn)
if set === :all
if kwargs.set === :all
collect(keys(tn.indexmap))
elseif set === :open
elseif kwargs.set === :open
map(first, Iterators.filter(((_, v),) -> length(v) == 1, tn.indexmap))
elseif set === :inner
elseif kwargs.set === :inner
map(first, Iterators.filter(((_, v),) -> length(v) >= 2, tn.indexmap))
elseif set === :hyper
elseif kwargs.set === :hyper
map(first, Iterators.filter(((_, v),) -> length(v) >= 3, tn.indexmap))
else
throw(ArgumentError("""
Unknown query: set=$(set)
Unknown query: set=$(kwargs.set)
Possible options are:
- :all (default)
- :open
Expand Down

0 comments on commit 75575af

Please sign in to comment.